Skip to content

Commit cba6f0a

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

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

build/pkg-install.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
tag=`expr substr $tag 2 8`
34+
./build.sh "$@"
35+
cp libblst.a "${DST}/.."
36+
cp bindings/blst.h* "${DST}/../../include"
37+
cat > "${DST}/blst.pc" << blst.pc
38+
libdir=\${pcfiledir}/..
39+
incdir=\${pcfiledir}/../../include
40+
Name: blst
41+
Version: $tag
42+
Description: blst core library
43+
Cflags: -I\${incdir}
44+
Libs: -L\${libdir} -lblst
45+
blst.pc
46+
)

0 commit comments

Comments
 (0)