Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

Commit

Permalink
feat(replace Makefile with build script)
Browse files Browse the repository at this point in the history
  • Loading branch information
laser committed Jun 14, 2019
1 parent 13f7b54 commit 05af63b
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 30 deletions.
18 changes: 9 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
paramcache --test-only
- run:
name: Build the static lib for linking into the example
command: make CARGO_EXTRAFLAGS="--verbose --frozen --package sector-builder-ffi"
command: ./scripts/build-release.sh $(cat ./rust-toolchain) --verbose --frozen --package sector-builder-ffi
- run:
name: run regression tests (examples) against libsector_builder_ffi.a
command: RUSTFLAGS="-L ./target/release -Z sanitizer=leak" cargo run --release --package sector-builder-ffi --example simple --target x86_64-unknown-linux-gnu
Expand Down Expand Up @@ -214,14 +214,14 @@ jobs:
- restore_cache:
keys:
- cargo-v4-{{ checksum "rust-toolchain" }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}-{{ arch }}
- run:
name: Build (release)
command: make CARGO_EXTRAFLAGS="--verbose --frozen --all"
- run:
name: Install jq
command: apt-get install jq -yqq
- run:
name: Run publish-release.sh
name: Build the release
command: ./scripts/build-release.sh $(cat ./rust-toolchain) --verbose --frozen --all
- run:
name: Publish release to GitHub
command: bash ./scripts/publish-release.sh

build_darwin_release:
Expand All @@ -244,17 +244,17 @@ jobs:
- run: rustup default $(cat rust-toolchain)
- run: cargo update
- run: cargo fetch
- run:
name: Build (release)
command: make CARGO_EXTRAFLAGS="--verbose --frozen --all"
- run:
name: Install jq
command: |
mkdir $HOME/.bin
curl --location https://github.com/stedolan/jq/releases/download/jq-1.6/jq-osx-amd64 --output $HOME/.bin/jq
chmod +x $HOME/.bin/jq
- run:
name: Run publish-release.sh
name: Build the release
command: ./scripts/build-release.sh $(cat ./rust-toolchain) --verbose --frozen --all
- run:
name: Publish release to GitHub
command: bash ./scripts/publish-release.sh

workflows:
Expand Down
21 changes: 0 additions & 21 deletions Makefile

This file was deleted.

35 changes: 35 additions & 0 deletions scripts/build-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

set -Eeuo pipefail

build_output_tmp=$(mktemp)

# clean up temp file on exit
#
trap '{ rm -f $build_output_tmp; }' EXIT

# build with RUSTFLAGS configured to output linker flags for native libs
#
RUSTFLAGS='--print native-static-libs' \
cargo +$1 build \
--release ${@:2} 2>&1 | tee ${build_output_tmp}

# parse build output for linker flags
#
linker_flags=$(cat ${build_output_tmp} \
| grep native-static-libs\: \
| head -n 1 \
| cut -d ':' -f 3)

# generate pkg-config
#
sed -e "s;@VERSION@;$(git rev-parse HEAD);" \
-e "s;@PRIVATE_LIBS@;${linker_flags};" sector_builder_ffi.pc.template > sector_builder_ffi.pc

# ensure header file was built
#
find . -type f -name sector_builder_ffi.h | read

# ensure the archive file was built
#
find . -type f -name libsector_builder_ffi.a | read

0 comments on commit 05af63b

Please sign in to comment.