-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·79 lines (59 loc) · 1.82 KB
/
build.sh
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env bash
tagName=$1
echo "tagName = $tagName"
vString=${tagName#REL}
vString=${vString#_}
majorVersion=${vString%%_*}
vString=${vString#${majorVersion}_}
minorVersion=${vString%%_*}
vString=${vString#${minorVersion}}
vString=${vString#_}
patch=${vString%%-*}
if [ -z "$patch" ]; then
version=$majorVersion.${minorVersion%%-*}
else
version=$majorVersion.$minorVersion.$patch
fi
./configure --prefix="$(pwd)"/pgsql --without-icu --without-zlib --without-readline --with-system-tzdata=/usr/share/zoneinfo/
make
make install
cd contrib || exit
make all
make install
cd ..
if [ "$2" = "osx" ]; then
for binary in $(ls pgsql/bin/)
do
bin_rel=pgsql/bin/$binary
echo install_name_tool -add_rpath '@executable_path/../lib' "$bin_rel" && install_name_tool -add_rpath '@executable_path/../lib' "$bin_rel"
done
for lib_rel in $(ls pgsql/lib/*.dylib)
do
library=${lib_rel#pgsql/lib/}
echo "modifying $lib_rel"
install_name_tool -id "@rpath/$library" "$lib_rel"
otool -L "$lib_rel"
for binary in $(ls pgsql/bin/)
do
bin_rel=pgsql/bin/$binary
install_name_tool -change "$library" "@rpath/$library" "$bin_rel"
echo install_name_tool -change "$(pwd)/pgsql/lib/$library" "@rpath/$library" "$bin_rel" && install_name_tool -change "$(pwd)/pgsql/lib/$library" "@rpath/$library" "$bin_rel"
done
done
for binary in $(ls pgsql/bin/)
do
bin_rel=pgsql/bin/$binary
otool -L "$bin_rel"
done
echo "current directory is $(pwd)"
else
chrpath --replace '$ORIGIN/../lib' pgsql/bin/*
fi
# distribute license
cp COPYRIGHT pgsql
tar -czvf "postgres-$version-$2.tar.gz" pgsql > /dev/null
{
echo "MAJOR_VERSION=$majorVersion"
echo "MINOR_VERSION=$minorVersion"
echo "VERSION=$majorVersion.$minorVersion"
} >> "$GITHUB_OUTPUT"