Skip to content

Commit

Permalink
Fixed github workflow from thinking our build message should terminat…
Browse files Browse the repository at this point in the history
…e cargo tarpaulin. Updated readme to provide more info on the MWALIB_LINK_STATIC_CFITSIO environment variable and why you might use it
  • Loading branch information
gsleap committed Jun 26, 2020
1 parent 516d8be commit 48f0af2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ jobs:
./configure --prefix=/usr/local --enable-reentrant;
make clean && make;
sudo make install;
sudo ldconfig;
- name: Clean
run: cargo clean
sudo ldconfig;
- name: Run cargo-tarpaulin
run: cargo tarpaulin -v --ignore-tests --timeout=360 --out=Lcov --output-dir=./coverage/
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ You can build mwalib from source:

`cargo build --release`

- MWALIB_LINK_STATIC_CFITSIO environment variable
If this environment variable exists and is set to a non-zero value, rustc will statically link libcfitsio. If the environment variable does not exist or is 0, rustc will dynamically link libcfitsio. This is an attempt to give developers the choice of having a static or dynamic link of the fits library to ease the build and deploy process.

- Use the dynamic-shared and/or static objects in the `target/release` directory

e.g. on linux, `libmwalib.a` or `libmwalib.so`
Expand All @@ -103,6 +106,8 @@ As an alternative to building from source, we produce github releases whenever f
* LICENSE (License for using mwalib in your projects)
* LICENSE-cfitsio (Since libcfitsio is statically compiled into our static and dynamic libraries, we also include it's license)

NOTE: from release 0.3.2 onwards, libcfitsio is statically linked to mwalib in order to reduce issues with conflicting/incompatible versions of cfitsio. Therefore, there is no need for you to have cfitsio installed on your machine.

To install on a regular linux x86/64 distribution, the following would be all that is needed:
- Download release from mwalib [github releases](https://github.com/MWATelescope/mwalib/releases).
`wget "https://github.com/MWATelescope/mwalib/releases/download/v0.3.1/libmwalib-0.3.1-linux_x86_64.tar.gz" -O mwalib.tar.gz`
Expand All @@ -115,7 +120,7 @@ To install on a regular linux x86/64 distribution, the following would be all th
`sudo cp mwalib/include/libmwalib.h /usr/local/include`

- Register the library with ldconfig
'sudo ldconfig'
`sudo ldconfig`

## Consistency checks
(TODO: This is non-exhaustive!)
Expand Down
15 changes: 4 additions & 11 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,10 @@ fn main() {
// 2. libcfitsio.a needs to have been built with the following ./configure statement:
// ./configure --disable-curl --prefix=/usr/local --enable-reentrant
match env::var("MWALIB_LINK_STATIC_CFITSIO") {
Ok(val) => {
match val.as_str() {
"0" => {
println!("cargo:warning=rustc will link with the shared libcfitsio.so library. Set MWALIB_LINK_STATIC_CFITSIO=1 in your environment to link statically.")
},
_ => {
println!("cargo:rustc-link-lib=static=cfitsio");
println!("cargo:warning=rustc will link with the static libcfitsio.a library. Remove MWALIB_LINK_STATIC_CFITSIO from your environment (or set to 0) to link dynamically.");
}
}
Ok(val) => match val.as_str() {
"0" => (),
_ => println!("cargo:rustc-link-lib=static=cfitsio"),
},
Err(_) => println!("cargo:warning=rustc will link with the shared libcfitsio.so library. Set MWALIB_LINK_STATIC_CFITSIO=1 in your environment to link statically."),
Err(_) => (),
}
}
1 change: 1 addition & 0 deletions tools/make_release.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
echo "Making release..."
echo "Cleaning up previous release files..."
rm -rf ../target
Expand Down

0 comments on commit 48f0af2

Please sign in to comment.