-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #260 from malbarbo/static-musl
static builder on travis
- Loading branch information
Showing
7 changed files
with
96 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright 2018 The Tectonic Project | ||
# Licensed under the MIT License. | ||
|
||
FROM alpine:edge | ||
|
||
RUN apk update && \ | ||
apk add \ | ||
g++ \ | ||
git \ | ||
rust \ | ||
cargo \ | ||
fontconfig-dev \ | ||
freetype-static \ | ||
glib-static \ | ||
graphite2-dev \ | ||
graphite2-static \ | ||
harfbuzz-dev \ | ||
harfbuzz-static \ | ||
icu-dev \ | ||
icu-static \ | ||
openssl-dev \ | ||
zlib-dev | ||
|
||
ADD pkg-config-rs.sh / | ||
RUN /pkg-config-rs.sh | ||
|
||
ENV PKG_CONFIG_ALL_STATIC=1 | ||
ENV OPENSSL_STATIC=1 | ||
ENV OPENSSL_DIR=/usr | ||
|
||
# cc-rs does not support static linking stdc++, | ||
# so we omit linking information on build.rs by setting CXXSTDLIB='' | ||
# and specify static linking in RUSTFLAGS | ||
ENV CXXSTDLIB="" | ||
ENV RUSTFLAGS="-L /usr/lib -l static=stdc++ -C target-feature=+crt-static" | ||
|
||
# Use a patched pkg-config-rs to allow static linking with system libraries. | ||
# The --no-default-features flag removes serde-derive as a dep, which doesn't | ||
# work when linking statically (rust-lang#40147). | ||
CMD cd /tectonic && \ | ||
echo -e "[patch.crates-io]\npkg-config = { path = \"/pkg-config-rs\" }" >> Cargo.toml && \ | ||
cargo test --release --no-default-features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/sh | ||
# Copyright 2018 The Tectonic Project | ||
# Licensed under the MIT License. | ||
|
||
set -ex | ||
|
||
git clone --branch 0.3.14 https://github.com/alexcrichton/pkg-config-rs /pkg-config-rs | ||
|
||
# make pkg-config-rs allows static linking with system libraries | ||
cd /pkg-config-rs | ||
patch -p1 <<'EOF' | ||
diff --git a/src/lib.rs b/src/lib.rs | ||
index 88dd310..ffcd7ae 100644 | ||
--- a/src/lib.rs | ||
+++ b/src/lib.rs | ||
@@ -547,7 +547,7 @@ fn is_static_available(name: &str, dirs: &[PathBuf]) -> bool { | ||
}; | ||
dirs.iter().any(|dir| { | ||
- !system_roots.iter().any(|sys| dir.starts_with(sys)) && | ||
+ // !system_roots.iter().any(|sys| dir.starts_with(sys)) && | ||
dir.join(&libname).exists() | ||
}) | ||
} | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters