forked from omniosorg/omnios-extra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-17.sh
executable file
·190 lines (157 loc) · 5.17 KB
/
build-17.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#!/usr/bin/bash
#
# {{{ CDDL HEADER
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
# }}}
# Copyright 2016 OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright 2024 OmniOS Community Edition (OmniOSce) Association.
. ../../lib/build.sh
PROG=postgresql
PKG=ooce/database/postgresql-17
VER=17.4
SUMMARY="PostgreSQL 17"
DESC="The World's Most Advanced Open Source Relational Database"
SKIP_LICENCES=postgresql
# The icu4c ABI changes frequently. Lock the version
# pulled into each build of postgres.
ICUVER=`pkg_ver icu4c`
ICUVER=${ICUVER%%.*}
BUILD_DEPENDS_IPS="=ooce/library/icu4c@$ICUVER"
# We want to populate the clang-related environment variables
# and set PATH to point to the correct llvm/clang version for
# the postgres JIT code, but we want to build with gcc.
set_clangver
BASEPATH=$PATH set_gccver $DEFAULT_GCC_VER
MAJVER=${VER%.*} # M.m
sMAJVER=${MAJVER//./} # Mm
set_patchdir patches-$sMAJVER
OPREFIX=$PREFIX
PREFIX+=/pgsql-$MAJVER
CONFPATH=/etc$PREFIX
LOGPATH=/var/log$PREFIX
VARPATH=/var$PREFIX
RUNPATH=$VARPATH/run
reset_configure_opts
SKIP_RTIME_CHECK=1
SKIP_SSP_CHECK=1
NO_SONAME_EXPECTED=1
XFORM_ARGS="
-DPREFIX=${PREFIX#/}
-DOPREFIX=${OPREFIX#/}
-DPROG=$PROG
-DPKGROOT=pgsql-$MAJVER
-DMEDIATOR=$PROG -DMEDIATOR_VERSION=$MAJVER
-DVERSION=$MAJVER
-DsVERSION=$sMAJVER
"
CFLAGS+=" -O3"
CPPFLAGS+=" -DWAIT_USE_POLL -DOOCEVER=$RELVER"
# postgresql has large enumerations
CTF_FLAGS+=" -s"
CONFIGURE_OPTS="
--prefix=$PREFIX
--sysconfdir=$CONFPATH
--localstatedir=$VARPATH
--enable-thread-safety
--with-pam
--with-ssl=openssl
--with-lz4
--with-zstd
--with-libxml
--with-libxslt
--with-readline
--without-systemd
--with-system-tzdata=/usr/share/lib/zoneinfo
"
CONFIGURE_OPTS[amd64_WS]+="
--bindir=$PREFIX/bin
--with-llvm LLVM_CONFIG=\"$CLANGPATH/bin/llvm-config --link-static\"
--enable-dtrace DTRACEFLAGS=-64
"
CONFIGURE_OPTS[aarch64]+="
--disable-dtrace
"
# need to build world
MAKE_TARGET=world-bin
MAKE_INSTALL_TARGET=install-world-bin
pre_configure() {
typeset arch=$1
LDFLAGS[$arch]+=" -Wl,-R$OPREFIX/${LIBDIRS[$arch]}"
}
install_man() {
logmsg "Fetching and installing pre-built man pages"
download_source $PROG $PROG $VER-docs $TMPDIR/manpages
for s in 1 3 5; do
logcmd $MKDIR -p "$DESTDIR/$PREFIX/share/man/man$s" \
|| logerr "mkdir failed"
done
pushd $TMPDIR/manpages/$PROG-$VER/doc/src/sgml >/dev/null
logmsg "Renaming man section"
for s in 1 3; do
for f in man$s/*.$s; do $SED -e '/^\.TH/s/"7"/"5"/' \
-e 's/\\fR(7)/\\fR(5sql)/g' \
-e '1s/^\.so man7/.so man5/g;1s/^\(\.so.*\)\.7$/\1.5sql/g' \
$f >| $DESTDIR/$PREFIX/share/man/man$s/`basename $f` \
|| logerr "failed to rename man section for $f"
done
done
for f in man7/*.7; do $SED -e '/^\.TH/s/"7"/"5"/' \
-e 's/\\fR(7)/\\fR(5sql)/g' \
-e '1s/^\.so man7/.so man5/g;1s/^\(\.so.*\)\.7$/\1.5sql/g' \
$f >| $DESTDIR/$PREFIX/share/man/man5/`basename $f \
| $SED s/\.7$/.5sql/` || logerr "failed to rename man section for $f"
done
popd >/dev/null
}
post_install() {
typeset arch=$1
[ $arch = i386 ] && return
# Make ISA binaries for pg_config, to allow software to find the
# right settings for 32/64-bit when pkg-config is not used.
if [ $arch = amd64 ]; then
pushd $DESTDIR$PREFIX/bin >/dev/null
logcmd mkdir -p amd64
logcmd mv pg_config amd64/ || logerr "mv pg_config"
make_isaexec_stub_arch amd64 $PREFIX/bin
popd >/dev/null
fi
install_man
xform $SRCDIR/files/postgres.xml > $TMPDIR/$PROG-$sMAJVER.xml
install_smf ooce $PROG-$sMAJVER.xml
manifest_start $TMPDIR/manifest.client
manifest_add_dir $PREFIX/include '.*'
manifest_add_dir $PREFIX/lib/pkgconfig
manifest_add_dir $PREFIX/lib/amd64/pkgconfig
manifest_add_dir $PREFIX/lib/pgxs '.*'
manifest_add_dir $PREFIX/lib/amd64/pgxs '.*'
manifest_add $PREFIX/lib '.*lib(pq\.|ecpg|pgtypes|pgcommon|pgport).*'
manifest_add $PREFIX/bin '.*pg_config' psql ecpg
manifest_add $PREFIX/share/man/man1 pg_config.1 psql.1 ecpg.1
manifest_add $PREFIX/share psqlrc.sample
manifest_finalise $TMPDIR/manifest.client $OPREFIX
manifest_uniq $TMPDIR/manifest.{server,client}
manifest_finalise $TMPDIR/manifest.server $OPREFIX etc
}
init
download_source $PROG $PROG $VER
patch_source
prep_build
build
#run_testsuite check-world-bin
PKG=${PKG/database/library} SUMMARY+=" client and libraries" \
make_package -seed $TMPDIR/manifest.client
[ "$FLAVOR" != libsandheaders ] \
&& RUN_DEPENDS_IPS="ooce/database/postgresql-common \
=ooce/library/icu4c@$ICUVER" \
make_package -seed $TMPDIR/manifest.server server.mog
clean_up
# Vim hints
# vim:ts=4:sw=4:et:fdm=marker