comparison databases/postgresql/postgresql.sh @ 1169:194681a6d42d

databases/postgresql: initial import, closes #2411
author David Demelier <markand@malikania.fr>
date Thu, 10 Oct 2019 13:47:08 +0200
parents
children 6710613b88b9
comparison
equal deleted inserted replaced
1168:4c9819a4c990 1169:194681a6d42d
1 #!/bin/sh
2 #
3 # Copyright (c) 2019 David Demelier <markand@malikania.fr>
4 #
5 # Permission to use, copy, modify, and/or distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
8 #
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 #
17
18 # TODO: add KERBEROS, SELINUX option.
19
20 PKGNAME=postgresql
21 PKGVERSION=12.0
22 PKGREVISION=1
23 PKGLICENSE="CUSTOM"
24 PKGSUMMARY="popular object-relational database management system"
25 PKGDOWNLOAD="https://ftp.postgresql.org/pub/source/v$PKGVERSION/$PKGNAME-$PKGVERSION.tar.gz"
26 PKGDEPENDS=""
27 PKGOPTIONS="COMPLETION ICU LLVM NLS PAM PERL PYTHON SSL TCL XML XSLT ZLIB"
28 PKGUIDS="postgresql:110"
29 PKGGIDS="postgresql:110"
30 PKGPROTECT="etc/rc.d/postgresql"
31
32 : ${CHOST:=$(uname -m)-linux-musl}
33 : ${CBUILD:=$(uname -m)-linux-musl}
34 : ${CC:=clang}
35 : ${CFLAGS:=-O2}
36 : ${CXX:=clang++}
37 : ${CXXFLAGS:=-O2}
38 : ${LDFLAGS:=}
39 : ${LIBS:=}
40 : ${COMPLETION:=yes} # Note: can be readline (or yes) or libedit.
41 : ${ICU:=no}
42 : ${LLVM:=no}
43 : ${NLS:=yes}
44 : ${PAM:=no}
45 : ${PERL:=no}
46 : ${PYTHON:=no}
47 : ${SSL:=yes} # Note: SSL support through libressl.
48 : ${TCL:=no}
49 : ${XML:=no} # Note: XML: support through libxml2.
50 : ${XSLT:=no}
51 : ${ZLIB:=yes}
52
53 case "$COMPLETION" in
54 "readline"|"yes")
55 PKGDEPENDS="readline $PKGDEPENDS"
56 with_completion="--with-readline"
57 ;;
58 "libedit")
59 PKGDEPENDS="libedit $PKGDEPENDS"
60 with_completion="--without-readline --with-libedit-preferred"
61 ;;
62 *)
63 with_completion="--without-readline"
64 ;;
65 esac
66
67 if [ "$ICU" = "yes" ]; then
68 PKGDEPENDS="icu $PKGDEPENDS"
69 with_icu="--with-icu"
70 else
71 with_icu="--without-icu"
72 fi
73
74 if [ "$LLVM" = "yes" ]; then
75 PKGDEPENDS="llvm $PKGDEPENDS"
76 with_llvm="--with-llvm"
77 else
78 with_llvm="--without-llvm"
79 fi
80
81 if [ "$NLS" = "yes" ]; then
82 PKGDEPENDS="gettext $PKGDEPENDS"
83 with_nls="--enable-nls"
84 else
85 with_nls="--disable-nls"
86 fi
87
88 if [ "$PAM" = "yes" ]; then
89 PKGDEPENDS="linux-pam $PKGDEPENDS"
90 with_pam="--with-pam"
91 else
92 with_pam="--without-pam"
93 fi
94
95 if [ "$PERL" = "yes" ]; then
96 PKGDEPENDS="perl $PKGDEPENDS"
97 with_perl="--with-perl"
98 else
99 with_perl="--without-perl"
100 fi
101
102 if [ "$PYTHON" = "yes" ]; then
103 PKGDEPENDS="python $PKGDEPENDS"
104 with_python="--with-python"
105 else
106 with_python="--without-python"
107 fi
108
109 if [ "$SSL" = "yes" ]; then
110 PKGDEPENDS="libressl $PKGDEPENDS"
111 with_ssl="--with-openssl"
112 else
113 with_ssl="--without-openssl"
114 fi
115
116 if [ "$TCL" = "yes" ]; then
117 PKGDEPENDS="tcl $PKGDEPENDS"
118 with_tcl="--with-tcl"
119 else
120 with_tcl="--without-tcl"
121 fi
122
123 if [ "$XML" = "yes" ]; then
124 PKGDEPENDS="libxml2 $PKGDEPENDS"
125 with_xml="--with-libxml"
126 else
127 with_xml="--without-libxml"
128 fi
129
130 if [ "$XSLT" = "yes" ]; then
131 PKGDEPENDS="libxslt $PKGDEPENDS"
132 with_xslt="--with-libxslt"
133 else
134 with_xslt="--without-libxslt"
135 fi
136
137 if [ "$ZLIB" = "yes" ]; then
138 PKGDEPENDS="zlib $PKGDEPENDS"
139 with_zlib="--with-zlib"
140 else
141 with_zlib="--without-zlib"
142 fi
143
144 build()
145 {
146 rm -rf $PKGNAME-$PKGVERSION
147 tar xvf $PKGNAME-$PKGVERSION.tar.gz
148 cd $PKGNAME-$PKGVERSION
149
150 CC="$CC" \
151 CFLAGS="$CFLAGS" \
152 CXX="$CXX" \
153 CXXFLAGS="$CXXFLAGS" \
154 LDFLAGS="$LDFLAGS" \
155 LIBS="$LIBS" \
156 ./configure \
157 --build=$CBUILD \
158 --host=$CHOST \
159 --prefix= \
160 $with_completion \
161 $with_icu \
162 $with_llvm \
163 $with_nls \
164 $with_pam \
165 $with_perl \
166 $with_python \
167 $with_ssl \
168 $with_tcl \
169 $with_xml \
170 $with_xslt \
171 $with_zlib
172 make
173 make install DESTDIR=$DESTDIR
174 install -Dm0644 ../postgresql $DESTDIR/etc/rc.d/postgresql
175
176 cd ..
177 rm -rf $PKGNAME-$PKGVERSION
178 }