Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build instructions update and improve CI #100

Merged
merged 2 commits into from Jul 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,38 @@ on:
- 'src/**'

jobs:
compile-wsldl:
compile-wsldl-windows:
name: Compile wsldl
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: make
- name: Build
run: |
cd src
curl -sSfLO https://github.com/akavel/rsrc/releases/download/v0.10.2/rsrc_windows_amd64.exe
.\rsrc_windows_amd64.exe -ico ../res/Fedora/icon.ico -o wsldl.syso
go build
- uses: actions/upload-artifact@v2
with:
name: Build results
name: Build results-Windows
path: |
src/wsldl.exe
if-no-files-found: error
compile-wsldl-linux:
name: Cross-compile wsldl from Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: |
cd src
curl -sSfLO https://github.com/akavel/rsrc/releases/download/v0.10.2/rsrc_linux_amd64
chmod +x rsrc_linux_amd64
./rsrc_linux_amd64 -ico ../res/Fedora/icon.ico -o wsldl.syso
env GOOS=windows GOARCH=amd64 go build
- uses: actions/upload-artifact@v2
with:
name: Build results-Linux
path: |
src/wsldl.exe
if-no-files-found: error
61 changes: 20 additions & 41 deletions DEVELOPERS.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,38 @@
# Developers Document

## 🛠How-to-Build
## 🛠How to Build

### Windows

#### Visual Studio or Build Tools 2017+

Use `x64 Native Tools Command Prompt for VS 2017` or run this in the Windows Command Prompt (replace `2017` with `2019` for VS 2019)
```cmd
:: initialize x64 build environment
CALL "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat" x64
```

Generate wslapi.lib
```cmd
lib /nologo /def:wslapi.def /machine:X64
```

To compile Launcher.exe
```cmd
cl /nologo /O2 /W4 /WX /Ob2 /Oi /Oy /Gs- /GF /Gy /Tc main.c /Fe:Launcher.exe Advapi32.lib Shell32.lib shlwapi.lib wslapi.lib
#### Compile using `Go`
Create wsldl.exe
```cmd
cd src
go build
```

Optionally, to add an icon to the exe, create and link a resource with
```cmd
SET YourDistroName=Fedora

:: create resources
rc /nologo res\%YourDistroName%\res.rc

:: compile to %YourDistroName%.exe
cl /nologo /O2 /W4 /WX /Ob2 /Oi /Oy /Gs- /GF /Gy /Tc main.c /Fe:%YourDistroName%.exe ^
Advapi32.lib Shell32.lib shlwapi.lib wslapi.lib res\%YourDistroName%\res.res
cd src
go get github.com/akavel/rsrc
rsrc -ico ../res/%YourDistroName%/icon.ico -o wsldl.syso
go build
```

### MinGW
Install x86_64 version of MSYS2(https://www.msys2.org).
**Note: Creating wsldl.exe for ARM is currently not supported since Go does not support cross-compiling for `windows/arm64`.**

Run these commands in msys shell
```bash
$ pacman -S mingw-w64-x86_64-toolchain # install tool chain
$ gcc -std=c99 --static main.c -lshlwapi -lwslapi -o Launcher.exe # compile main.c
```
### Linux (cross compile)

Optionally, to add an icon to the exe, create and link a resource with
Run this command in shell
```bash
$ YourDistroName=Fedora
$ windres res/$YourDistroName/res.rc res.o # compile resource
$ gcc -std=c99 --static main.c -lshlwapi -lwslapi -o ${YourDistroName}.exe res.o # compile main.c
$ cd src
$ env GOOS=windows GOARCH=amd64 go build
```

### Linux (cross compile)
Install mingw-w64 toolchain include gcc-mingw-w64-x86-64.

Run this command in shell
Optionally, to add an icon to the exe, create and link a resource with
```bash
$ x86_64-w64-mingw32-gcc -std=c99 --static main.c -lshlwapi -lwslapi -o Launcher.exe # compile main.c
$ cd src
$ go get github.com/akavel/rsrc
$ rsrc -ico ../res/%YourDistroName%/icon.ico -o wsldl.syso
$ env GOOS=windows GOARCH=amd64 go build
```
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ Usage :
```

## 🛠How-to-Build
Please see [DEVELOPERS.md](https://github.com/yuk7/wsldl/blob/main/DEVELOPERS.md)
Please see [DEVELOPERS.md](DEVELOPERS.md)

## 📄License
[MIT](https://github.com/yuk7/wsldl/blob/main/LICENSES.md)
[MIT](LICENSES.md)

Copyright (c) 2017-2020 yuk7
Copyright (c) 2017-2021 [yuk7](https://github.com/yuk7)