Merge branch 'fix/link_zlib_with_test' of https://github.com/mriehl/rust-musl-builder
Merge libgit2 support, but heavily overhaul the tests.
This commit is contained in:
commit
7b30114420
15
.travis.yml
Normal file
15
.travis.yml
Normal file
|
@ -0,0 +1,15 @@
|
|||
language: rust
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
os:
|
||||
- linux
|
||||
|
||||
script:
|
||||
- bash ./test-image
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: never
|
||||
on_failure: always
|
|
@ -98,7 +98,9 @@ ENV OPENSSL_DIR=/usr/local/musl/ \
|
|||
PQ_LIB_STATIC_X86_64_UNKNOWN_LINUX_MUSL=1 \
|
||||
PG_CONFIG_X86_64_UNKNOWN_LINUX_GNU=/usr/bin/pg_config \
|
||||
PKG_CONFIG_ALLOW_CROSS=true \
|
||||
PKG_CONFIG_ALL_STATIC=true
|
||||
PKG_CONFIG_ALL_STATIC=true \
|
||||
LIBZ_SYS_STATIC=1 \
|
||||
TARGET=musl
|
||||
|
||||
# (Please feel free to submit pull requests for musl-libc builds of other C
|
||||
# libraries needed by the most popular and common Rust crates, to avoid
|
||||
|
|
1
examples/linking-with-git2/.dockerignore
Normal file
1
examples/linking-with-git2/.dockerignore
Normal file
|
@ -0,0 +1 @@
|
|||
target
|
7
examples/linking-with-git2/Cargo.toml
Normal file
7
examples/linking-with-git2/Cargo.toml
Normal file
|
@ -0,0 +1,7 @@
|
|||
[package]
|
||||
name = "linking-with-git2"
|
||||
version = "0.1.0"
|
||||
authors = ["Eric Kidd <git@randomhacks.net>"]
|
||||
|
||||
[dependencies]
|
||||
git2 = "0.6"
|
16
examples/linking-with-git2/Dockerfile
Normal file
16
examples/linking-with-git2/Dockerfile
Normal file
|
@ -0,0 +1,16 @@
|
|||
# -*- mode: dockerfile -*-
|
||||
#
|
||||
# An example Dockerfile showing how to add new static C libraries using
|
||||
# musl-gcc.
|
||||
|
||||
# Our first FROM statement declares the build environment.
|
||||
FROM ekidd/rust-musl-builder AS builder
|
||||
|
||||
# Add our source code.
|
||||
ADD . ./
|
||||
|
||||
# Fix permissions on source code.
|
||||
RUN sudo chown -R rust:rust /home/rust
|
||||
|
||||
# Build our application.
|
||||
RUN cargo build
|
11
examples/linking-with-git2/src/main.rs
Normal file
11
examples/linking-with-git2/src/main.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
// A useless example application using `git2`, to make sure that we link it
|
||||
// correctly.
|
||||
|
||||
extern crate git2;
|
||||
|
||||
use git2::Repository;
|
||||
|
||||
fn main() {
|
||||
let _ = Repository::init("test-repo");
|
||||
println!("Hello, world!");
|
||||
}
|
21
test-image
21
test-image
|
@ -13,6 +13,8 @@ docker build -t rust-musl-zlib examples/adding-a-library
|
|||
docker build -t rust-musl-builder-using-diesel examples/using-diesel
|
||||
docker run --rm rust-musl-builder-using-diesel
|
||||
|
||||
echo "==== Verifying static linking"
|
||||
|
||||
# Make sure we can build a static executable.
|
||||
docker run --rm ekidd/rust-musl-builder bash -c "
|
||||
set -euo pipefail
|
||||
|
@ -20,10 +22,6 @@ export USER=rust
|
|||
cargo new --vcs none --bin testme
|
||||
cd testme
|
||||
|
||||
# Add test cases here
|
||||
|
||||
echo -e '\nRunning tests...\n'
|
||||
|
||||
echo -e '--- Test case for x86_64:'
|
||||
cargo build
|
||||
echo 'ldd says:'
|
||||
|
@ -43,5 +41,20 @@ fi
|
|||
echo -e '[PASS] ARMhf binary is statically linked.\n'
|
||||
"
|
||||
|
||||
# Make sure we can build a static executable using `git2`.
|
||||
docker build -t rust-musl-builder-linking-with-git2 examples/linking-with-git2
|
||||
docker run --rm rust-musl-builder-linking-with-git2 bash -c "
|
||||
set -euo pipefail
|
||||
cd /home/rust/src
|
||||
|
||||
echo -e '--- Test case for libgit2:'
|
||||
echo 'ldd says:'
|
||||
if ldd target/x86_64-unknown-linux-musl/debug/linking-with-git2; then
|
||||
echo '[FAIL] Executable is not static!' 1>&2
|
||||
exit 1
|
||||
fi
|
||||
echo -e '[PASS] libgit2 binary is statically linked.\n'
|
||||
"
|
||||
|
||||
# We're good.
|
||||
echo 'OK. ALL TESTS PASSED.' 1>&2
|
||||
|
|
Loading…
Reference in a new issue