forked from electric-sql/pglite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpg-git.sh
76 lines (65 loc) · 1.97 KB
/
pg-git.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
if [ -f postgresql/postgresql-${PG_VERSION}.patched ]
then
echo version already selected and patch stage already done
else
git clone --no-tags --depth 1 --single-branch --branch master https://github.com/postgres/postgres postgresql-${PG_VERSION}
if pushd postgresql-${PG_VERSION}
then
echo
> ./src/template/emscripten
> ./src/template/wasi
> ./src/include/port/wasi.h
> ./src/makefiles/Makefile.wasi
for patchdir in \
postgresql-debug postgresql-wasi \
postgresql-wasm postgresql-wasm-${PG_VERSION} \
postgresql-pglite postgresql-pglite-${PG_VERSION}
do
if [ -d ../patches/$patchdir ]
then
cat ../patches/$patchdir/*.diff | patch -p1 || exit 24
fi
done
touch postgresql-${PG_VERSION}.patched
popd
fi
# either a submodule dir or a symlink.
# release only use symlink
rm postgresql 2>/dev/null
ln -s postgresql-${PG_VERSION} postgresql
fi
export PGSRC=$(realpath postgresql-${PG_VERSION})
if [ -f ${PGROOT}/pg.installed ]
then
echo "skipping pg build, using previous install from ${PGROOT}"
else
if $WASI
then
echo "TODO $(which clang)"
CNF="${PGSRC}/configure --prefix=${PGROOT} \
--disable-spinlocks --disable-atomics \
--without-zlib --disable-largefile --without-llvm \
--without-pam --disable-largefile --without-zlib --with-openssl=no \
--without-readline --without-icu \
${PGDEBUG}"
# --cache-file=${PGROOT}/config.cache.wasi
if \
ZIC=/usr/sbin/zic \
CC=wasi-c \
CXX=wasi-c++ \
CONFIG_SITE==${PGDATA}/config.site CONFIGURE=true \
$CNF \
--host=$(arch) --target=wasm32-unknown-wasi --with-template=wasi
then
echo configure ok
make -j 1
else
echo configure failed
exit 57
fi
read
else
echo "Building $ARCHIVE (patched) from $PGSRC"
. cibuild/pgbuild.sh
fi
fi