Explorar o código

Merge pull request #432 from MartinFillon/create-statically-linked-binaries

feat(binaries): added statically linked binaries
Christina Sørensen %!s(int64=2) %!d(string=hai) anos
pai
achega
d082626703
Modificáronse 1 ficheiros con 17 adicións e 0 borrados
  1. 17 0
      Justfile

+ 17 - 0
Justfile

@@ -120,12 +120,24 @@ tar BINARY TARGET:
 zip BINARY TARGET:
     zip -j ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}.zip ./target/{{TARGET}}/release/{{BINARY}}
 
+tar_static BINARY TARGET:
+    tar czvf ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}_static.tar.gz -C ./target/{{TARGET}}/release/ ./{{BINARY}}
+
+zip_static BINARY TARGET:
+    zip -j ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}_static.zip ./target/{{TARGET}}/release/{{BINARY}}
+
 binary BINARY TARGET:
     rustup target add {{TARGET}}
     cross build --release --target {{TARGET}}
     just tar {{BINARY}} {{TARGET}}
     just zip {{BINARY}} {{TARGET}}
 
+binary_static BINARY TARGET:
+    rustup target add {{TARGET}}
+    RUSTFLAGS='-C target-feature=+crt-static' cross build --release --target {{TARGET}}
+    just tar_static {{BINARY}} {{TARGET}}
+    just zip_static {{BINARY}} {{TARGET}}
+
 checksum:
     echo "# Checksums"
     echo "## sha256sum"
@@ -152,13 +164,17 @@ alias c := cross
     ## Linux
     ### x86
     just binary eza x86_64-unknown-linux-gnu
+    just binary_static eza x86_64-unknown-linux-gnu
     just binary eza x86_64-unknown-linux-musl
+    just binary_static eza x86_64-unknown-linux-musl
 
     ### aarch
     just binary eza aarch64-unknown-linux-gnu
+    # BUG: just binary_static eza aarch64-unknown-linux-gnu
 
     ### arm
     just binary eza arm-unknown-linux-gnueabihf
+    just binary_static eza arm-unknown-linux-gnueabihf
 
     ## MacOS
     # TODO: just binary eza x86_64-apple-darwin
@@ -166,6 +182,7 @@ alias c := cross
     ## Windows
     ### x86
     just binary eza.exe x86_64-pc-windows-gnu
+    just binary_static eza.exe x86_64-pc-windows-gnu
     # TODO: just binary eza.exe x86_64-pc-windows-gnullvm
     # TODO: just binary eza.exe x86_64-pc-windows-msvc