diff --git a/templates/lib/before_deploy.sh b/templates/lib/before_deploy.sh index a44b684..b84b6d1 100644 --- a/templates/lib/before_deploy.sh +++ b/templates/lib/before_deploy.sh @@ -5,9 +5,7 @@ PKG_NAME="{{PKG_NAME}}" set -ex main() { - local src=$(pwd) \ - stage \ - linking_args + local src=$(pwd) stage case $TRAVIS_OS_NAME in linux) @@ -20,17 +18,13 @@ main() { test -f Cargo.lock || cargo generate-lockfile - # TODO: combine with -C lto - case $TYPE in - static) - linking_args="--crate-type staticlib" - ;; - *) - linking_args="--crate-type cdylib" - ;; - esac + if [[ "$TYPE" == "static" ]]; then + cargo crate-type static + else + cargo crate-type dynamic + fi - cross rustc --lib --target $TARGET --release -- $linking_args + cross rustc --lib --target $TARGET --release -- -C lto case $TYPE-$TRAVIS_OS_NAME in static-*) diff --git a/templates/lib/install.sh b/templates/lib/install.sh index 5e8f360..23f9eeb 100644 --- a/templates/lib/install.sh +++ b/templates/lib/install.sh @@ -46,6 +46,9 @@ main() { # Install test dependencies rustup component add rustfmt-preview rustup component add clippy-preview + + # For defining the type of lib to produce: dynamic OR static + cargo install --force cargo-crate-type } main