@@ -68,9 +68,12 @@ case "$ID" in
68
68
# it, force use of system curl.
69
69
brew uninstall --force --ignore-dependencies openssl gettext
70
70
curl=" /usr/bin/curl"
71
- # The deployment target should be <= to that of the oldest supported Python version.
71
+ if [ -z " $MACOSX_ARCHITECTURE " ]; then
72
+ MACOSX_ARCHITECTURE=" $( uname -m) "
73
+ fi
74
+ # Set the deployment target to be <= to that of the oldest supported Python version.
72
75
# e.g. https://www.python.org/downloads/release/python-380/
73
- if [ " $( uname -m ) " == " x86_64" ]; then
76
+ if [ " $MACOSX_ARCHITECTURE " == " x86_64" ]; then
74
77
export MACOSX_DEPLOYMENT_TARGET=10.9
75
78
else
76
79
export MACOSX_DEPLOYMENT_TARGET=11.0
@@ -83,6 +86,22 @@ case "$ID" in
83
86
;;
84
87
esac
85
88
89
+
90
+ if [ " $ID " == " macos" ]; then
91
+ make_configure_standard_flags=( \
92
+ --prefix=${LIBPQ_BUILD_PREFIX} \
93
+ " CPPFLAGS=-I${LIBPQ_BUILD_PREFIX} /include/ -arch $MACOSX_ARCHITECTURE " \
94
+ " LDFLAGS=-L${LIBPQ_BUILD_PREFIX} /lib -arch $MACOSX_ARCHITECTURE " \
95
+ )
96
+ else
97
+ make_configure_standard_flags=( \
98
+ --prefix=${LIBPQ_BUILD_PREFIX} \
99
+ CPPFLAGS=-I${LIBPQ_BUILD_PREFIX} /include/ \
100
+ LDFLAGS=-L${LIBPQ_BUILD_PREFIX} /lib \
101
+ )
102
+ fi
103
+
104
+
86
105
if [ " $ID " == " centos" ] || [ " $ID " == " macos" ]; then
87
106
88
107
# Build openssl if needed
@@ -94,8 +113,14 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
94
113
95
114
cd " ${openssl_dir} "
96
115
97
- ./config --prefix=${LIBPQ_BUILD_PREFIX} --openssldir=${LIBPQ_BUILD_PREFIX} \
98
- zlib -fPIC shared
116
+ options=(--prefix=${LIBPQ_BUILD_PREFIX} --openssldir=${LIBPQ_BUILD_PREFIX} \
117
+ zlib -fPIC shared)
118
+ if [ -z " $MACOSX_ARCHITECTURE " ]; then
119
+ ./config $options
120
+ else
121
+ ./configure " darwin64-$MACOSX_ARCHITECTURE -cc" $options
122
+ fi
123
+
99
124
make depend
100
125
make
101
126
else
@@ -119,9 +144,7 @@ if [ "$ID" == "macos" ]; then
119
144
| tar xzf -
120
145
121
146
cd " ${krb5_dir} "
122
-
123
- ./configure --prefix=${LIBPQ_BUILD_PREFIX} \
124
- CPPFLAGS=-I${LIBPQ_BUILD_PREFIX} /include/ LDFLAGS=-L${LIBPQ_BUILD_PREFIX} /lib
147
+ ./configure " ${make_configure_standard_flags[@]} "
125
148
make
126
149
else
127
150
cd " ${krb5_dir} "
@@ -143,9 +166,7 @@ if [ "$ID" == "macos" ]; then
143
166
| tar xzf -
144
167
145
168
cd " ${gettext_dir} "
146
-
147
- ./configure --prefix=${LIBPQ_BUILD_PREFIX} --disable-java \
148
- CPPFLAGS=-I${LIBPQ_BUILD_PREFIX} /include/ LDFLAGS=-L${LIBPQ_BUILD_PREFIX} /lib
169
+ ./configure --disable-java " ${make_configure_standard_flags[@]} "
149
170
make -C gettext-runtime all
150
171
else
151
172
cd " ${gettext_dir} "
@@ -173,8 +194,7 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
173
194
cd " ${sasl_dir} "
174
195
175
196
autoreconf -i
176
- ./configure --prefix=${LIBPQ_BUILD_PREFIX} --disable-macos-framework \
177
- CPPFLAGS=-I${LIBPQ_BUILD_PREFIX} /include/ LDFLAGS=-L${LIBPQ_BUILD_PREFIX} /lib
197
+ ./configure " ${make_configure_standard_flags[@]} " --disable-macos-framework
178
198
make
179
199
else
180
200
cd " ${sasl_dir} "
@@ -201,8 +221,7 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
201
221
202
222
cd " ${ldap_dir} "
203
223
204
- ./configure --prefix=${LIBPQ_BUILD_PREFIX} --enable-backends=no --enable-null \
205
- CPPFLAGS=-I${LIBPQ_BUILD_PREFIX} /include/ LDFLAGS=-L${LIBPQ_BUILD_PREFIX} /lib
224
+ ./configure " ${make_configure_standard_flags[@]} " --enable-backends=no --enable-null
206
225
207
226
make depend
208
227
make -C libraries/liblutil/
@@ -243,10 +262,9 @@ if [ ! -d "${postgres_dir}" ]; then
243
262
# Often needed, but currently set by the workflow
244
263
# export LD_LIBRARY_PATH="${LIBPQ_BUILD_PREFIX}/lib"
245
264
246
- ./configure --prefix= ${LIBPQ_BUILD_PREFIX} --sysconfdir=/etc/postgresql-common \
265
+ ./configure " ${make_configure_standard_flags[@]} " --sysconfdir=/etc/postgresql-common \
247
266
--with-gssapi --with-openssl --with-pam --with-ldap \
248
- --without-readline --without-icu \
249
- CPPFLAGS=-I${LIBPQ_BUILD_PREFIX} /include/ LDFLAGS=-L${LIBPQ_BUILD_PREFIX} /lib
267
+ --without-readline --without-icu
250
268
make -C src/interfaces/libpq
251
269
make -C src/bin/pg_config
252
270
make -C src/include
0 commit comments