Skip to content

Commit dbd503d

Browse files
committed
emsdk/libpq.so/initdb
1 parent d6a9346 commit dbd503d

File tree

2 files changed

+37
-19
lines changed

2 files changed

+37
-19
lines changed

.github/workflows/emsdk.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,17 @@ jobs:
2323
curl https://wasmtime.dev/install.sh -sSf | bash
2424
mkdir -p /opt/python-wasm-sdk/wasisdk/bin
2525
mv -vf $(find $HOME/|grep /wasmtime$) /opt/python-wasm-sdk/wasisdk/bin/
26+
2627
working-directory: /
2728

28-
- name: Build WASM with emsdk
29+
30+
- name: apply patchwork
2931
run: |
3032
chmod +x wasm-build.sh
33+
bash ./wasm-build.sh patchwork
34+
35+
36+
- name: Build WASM with emsdk
37+
run: |
3138
bash ./wasm-build.sh
3239

wasm-build.sh

+29-18
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ echo "
1111
1212
"
1313

14-
if echo "$@"|grep clean
14+
if echo "$@"|grep -q clean
1515
then
1616
make clean
1717
rm $(find |grep \\.js$) $(find |grep \\.wasm$)
@@ -21,20 +21,21 @@ then
2121
fi
2222
fi
2323

24-
if $CI
24+
if echo "$@"|grep -q patchwork
2525
then
2626
echo "
2727
2828
29-
applying patches
29+
applying patchwork from https://github.com/pmp-p/postgres-patchwork/issues?q=is%3Aissue+is%3Aopen+label%3Apatch
3030
3131
3232
"
33-
wget -O- https://github.com/pmp-p/postgres/commit/23a4a59d484ab18847f1848d29f1287551958c9e.diff | patch -p1
34-
33+
wget -O- https://patch-diff.githubusercontent.com/raw/pmp-p/postgres-patchwork/pull/2.diff | patch -p1
34+
wget -O- https://patch-diff.githubusercontent.com/raw/pmp-p/postgres-patchwork/pull/5.diff | patch -p1
35+
wget -O- https://patch-diff.githubusercontent.com/raw/pmp-p/postgres-patchwork/pull/7.diff | patch -p1
3536
sudo mkdir /pgdata
3637
sudo chmod 777 /pgdata
37-
38+
exit 0
3839
fi
3940

4041

@@ -215,18 +216,18 @@ END
215216
cat >$PREFIX/initdb.sh <<END
216217
#!/bin/bash
217218
rm -rf ${PGDATA} /tmp/initdb-*.log
219+
TZ=UTC
218220
${PREFIX}/initdb -k -g -N -U postgres --pwfile=${PREFIX}/password --locale=C --locale-provider=libc --pgdata=${PGDATA} 2> /tmp/initdb-\$\$.log
219221
echo "Ready to run sql command through ${PREFIX}/postgres"
220-
read
221-
222222
grep -v ^initdb.js /tmp/initdb-\$\$.log \\
223223
| tail -n +4 \\
224224
| head -n -1 \\
225225
> /tmp/initdb-\$\$.sql
226-
${PREFIX}/postgres --boot -d 1 -c log_checkpoints=false -X 16777216 -k < /tmp/initdb-\$\$.sql 2>&1 | grep -v 'bootstrap>'
227226
228-
echo clean up
229-
read
227+
md5sum /tmp/initdb-\$\$.sql
228+
229+
${PREFIX}/postgres --boot -d 1 -c log_checkpoints=false -X 16777216 -k < /tmp/initdb-\$\$.sql 2>&1 | grep -v 'bootstrap>'
230+
echo cleaning up sql journal
230231
rm /tmp/initdb-\$\$.log /tmp/initdb-\$\$.sql
231232
END
232233

@@ -243,19 +244,29 @@ END
243244

244245
chmod +x $PREFIX/*.sh
245246

246-
247247
read
248248

249249
$PREFIX/initsql.sh
250250
rm $PGDATA/postmaster.pid
251+
fi
251252

252-
emcc -shared -o /srv/www/html/pygbag/pg/libpq.so \
253-
./src/interfaces/libpq/libpq.a \
254-
./src/port/libpgport.a \
255-
./src/common/libpgcommon.a
253+
mkdir -p ${PREFIX}/lib
254+
rm ${PREFIX}/lib/lib*.so.* ${PREFIX}/lib/libpq.so
255+
256+
emcc -shared -o ${PREFIX}/lib/libpq.so \
257+
./src/interfaces/libpq/libpq.a \
258+
./src/port/libpgport.a \
259+
./src/common/libpgcommon.a
260+
261+
if [ -f /data/git/pg/local.sh ]
262+
then
263+
. /data/git/pg/local.sh
264+
fi
265+
266+
echo "========================================================="
267+
268+
file ${PREFIX}/lib/lib*.so
256269

257-
fi
258-
# TZ=UTC node ./src/bin/initdb/initdb -k -g -N -U postgres --pwfile=/date/git/pg/pw --locale=C --locale-provider=libc --pgdata=${PGDATA}
259270
else
260271
echo build failed
261272
fi

0 commit comments

Comments
 (0)