-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_build_gdbm.sh
More file actions
executable file
·39 lines (32 loc) · 1.24 KB
/
_build_gdbm.sh
File metadata and controls
executable file
·39 lines (32 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
set -xe
_SC_DIR="$(cd "`dirname "$0"`"; pwd)"
[[ "${5:-1}" == 1 ]] && _VER=1.22 || _VER="$5"
_PKG="gdbm-$_VER"
_PREFIX="$1"
_SCRATCH_DIR="$2"
_UNIVERSAL="$3"
_RPATH="$4"
_NO_TESTS="$6"
if [[ ! -e "$_PREFIX/lib/libgdbm.dylib" ]]
then
cd "$_SCRATCH_DIR"
[[ -s "$_PKG.tar.gz" ]] || curl -OkfSL "https://ftp.gnu.org/gnu/gdbm/$_PKG.tar.gz"
rm -rf "$_PKG"
tar -xf "$_PKG.tar.gz"
cd "$_PKG"
_CFLAGS=-O2
[[ "$_UNIVERSAL" != 1 ]] || _CFLAGS="$_CFLAGS -arch i386 -arch x86_64"
./configure --disable-dependency-tracking "--prefix=$_PREFIX" --disable-static \
--without-readline --disable-libgdbm-compat "CFLAGS=$_CFLAGS"
# Disable bin tools
sed -i- 's/^\(bin_PROGRAMS *=\).*/\1/' src/Makefile
sed -i- 's/\(SUBDIRS *=\).* src .* tests$/\1 src tests/' Makefile
sed -i- -e 's/^gdbmtool /exit 77 || &/;s/; t_wordwrap /; exit 77&/' tests/testsuite
find tests -name Makefile -exec sed -i- 's/^\([A-Z_]* *=\) *gdbmtool/\1/' {} +
sed -i- -e 's/ t_wordwrap\$(EXEEXT)//;s/ t_wordwrap\.c$//' tests/Makefile
[[ "$_NO_TESTS" == 0 ]] || sed -i '' 's/\(SUBDIRS *=.*\) tests$/\1/' Makefile
make -j2 V=1 install
[[ "$_NO_TESTS" != 0 ]] || make check
[[ "$_RPATH" != 1 ]] || "$_SC_DIR/change_to_rpath.sh" "$_PREFIX/lib/libgdbm.dylib"
fi