-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compile latest release tag and install it as pkg-config package.
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
_IFS="$IFS"; IFS=':' | ||
for dir in $PKG_CONFIG_PATH `pkg-config --variable pc_path pkg-config`; do | ||
if [ -d "${dir}" -a -w "${dir}" -a -d "${dir}/../../include" ]; then | ||
DST="$dir" | ||
break | ||
fi | ||
done | ||
IFS="$_IFS"; unset _IFS | ||
|
||
if [ -z "${DST}" ]; then | ||
echo "no suitable pkg-config directory found." | ||
exit 1 | ||
fi | ||
|
||
if [ `basename $0` = "pkg-install.sh" ]; then | ||
SRC=`dirname $0` | ||
SRC=`(cd $SRC/..; [ -d .git ] && pwd)` | ||
fi | ||
|
||
export DST | ||
cd ${TMPDIR:-/tmp} | ||
|
||
trap 'rm -rf blst.$$' 0 | ||
git clone ${SRC:-"https://github.com/supranational/blst"} blst.$$ | ||
( trap '[ $? -ne 0 ] && rm "${DST}/blst.pc" 2>/dev/null' 0 | ||
cd blst.$$ | ||
tag=`git tag --sort=v:refname | tail -1` | ||
git checkout --detach ${tag} | ||
./build.sh "$@" | ||
cp libblst.a "${DST}/.." | ||
cp bindings/blst.h* "${DST}/../../include" | ||
cat > "${DST}/blst.pc" << blst.pc | ||
libdir=\${pcfiledir}/.. | ||
incdir=\${pcfiledir}/../../include | ||
Name: blst | ||
Version: $tag | ||
Description: blst core library | ||
Cflags: -I\${incdir} | ||
Libs: -L\${libdir} -lblst | ||
blst.pc | ||
) |