Skip to content

Commit 958b46f

Browse files
committed
Add build/pkg-install.sh.
Compile latest release tag and install it as pkg-config package.
1 parent b555988 commit 958b46f

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

build/pkg-install.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
_IFS="$IFS"; IFS=':'
6+
for dir in $PKG_CONFIG_PATH `pkg-config --variable pc_path pkg-config`; do
7+
if [ -d "${dir}" -a -w "${dir}" -a -d "${dir}/../../include" ]; then
8+
DST="$dir"
9+
break
10+
fi
11+
done
12+
IFS="$_IFS"; unset _IFS
13+
14+
if [ -z "${DST}" ]; then
15+
echo "no suitable pkg-config directory found."
16+
exit 1
17+
fi
18+
19+
if [ `basename $0` = "pkg-install.sh" ]; then
20+
SRC=`dirname $0`
21+
SRC=`(cd $SRC/..; [ -d .git ] && pwd)`
22+
fi
23+
24+
export DST
25+
cd ${TMPDIR:-/tmp}
26+
27+
trap 'rm -rf blst.$$' 0
28+
git clone ${SRC:-"https://github.com/supranational/blst"} blst.$$
29+
( trap '[ $? -ne 0 ] && rm "${DST}/blst.pc" 2>/dev/null' 0
30+
cd blst.$$
31+
tag=`git tag --sort=v:refname | tail -1`
32+
git checkout --detach ${tag}
33+
./build.sh "$@"
34+
cp libblst.a "${DST}/.."
35+
cp bindings/blst.h* "${DST}/../../include"
36+
cat > "${DST}/blst.pc" << blst.pc
37+
libdir=\${pcfiledir}/..
38+
incdir=\${pcfiledir}/../../include
39+
Name: blst
40+
Version: $tag
41+
Description: blst core library
42+
Cflags: -I\${incdir}
43+
Libs: -L\${libdir} -lblst
44+
blst.pc
45+
)

0 commit comments

Comments
 (0)