Skip to content

Commit

Permalink
Improved Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
proofrock committed Apr 28, 2024
1 parent 81350b4 commit 34b7a57
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 3 additions & 3 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ Builds a statically linked binary under the current architecture, in the `bin/`
Builds binaries for the 6 supported OSs/architectures, also creating the distribution archives in
the `bin/` folder. Uses [xgo](https://github.com/techknowlogick/xgo) for cross compiling.

It's actually a three-stage process: the first time use `make dist-pre` to setup the environment;
then `make dist` to build the binaries. Then you need to re-own the output dir; run the command
outputted by the last `make dist`. Finally, do `make dist-post`.
It's actually a two-stage process: the first time use `make dist-pre` to setup the environment;
then `make dist` to build the binaries and package them. Root password required, to re-own the
files (xgo produces them as root).

## Docker targets

Expand Down
8 changes: 3 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,16 @@ dist-pre:
dist:
xgo -gcflags='-trimpath -a' -tags="netgo osusergo sqlite_omit_load_extension" -ldflags='-w -extldflags "-static"' --targets=linux/amd64,linux/arm-6,linux/arm64 ./src/
xgo -trimpath --targets=windows-10.0/amd64,darwin/* ./src/
echo "Run 'sudo chown -R $(whoami):$(whoami) \"github.com\" && make dist-post'"

dist-post:
sudo chown -R `stat -c "%U:%G" Makefile` "github.com"
mv github.com/proofrock/ bin
rm -rf github.com/
mv bin/ws4sql-windows-10.0-amd64.exe bin/ws4sql.exe
cd bin/ && zip -9 ws4sql-v0.17.0beta1-win-x86_64.zip ws4sql.exe
rm bin/ws4sql.exe
mv bin/ws4sql-darwin-10.12-amd64 bin/ws4sql
cd bin/ && bash -c "tar c ws4sql | gzip -9 > ws4sql-v0.17.0beta1-darwin-x86_64.tar.gz"
cd bin/ && zip -9 ws4sql-v0.17.0beta1-darwin-x86_64.zip ws4sql
mv bin/ws4sql-darwin-10.12-arm64 bin/ws4sql
cd bin/ && bash -c "tar c ws4sql | gzip -9 > ws4sql-v0.17.0beta1-darwin-arm64.tar.gz"
cd bin/ && zip -9 ws4sql-v0.17.0beta1-darwin-arm64.zip ws4sql
mv bin/ws4sql-linux-amd64 bin/ws4sql
cd bin/ && bash -c "tar c ws4sql | gzip -9 > ws4sql-v0.17.0beta1-linux-x86_64.tar.gz"
mv bin/ws4sql-linux-arm64 bin/ws4sql
Expand Down

0 comments on commit 34b7a57

Please sign in to comment.