forked from postgres/postgres
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More cleanup #11
Draft
copiltembel
wants to merge
28
commits into
pglite/REL_16_STABLE
Choose a base branch
from
tudor/cleanup
base: pglite/REL_16_STABLE
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
More cleanup #11
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
ecb48c0
remove generated code for initdb.sh
ce945fe
use cat instead of python
3afc138
remove unused env vars;
17ce7cb
dead code cleanup
65bc51e
remove config.site dep in pgbuild
4c133e3
find node in the same way
6f7ab62
introducing pgbuild.wasm.sh
12c5b89
more cleanup
4bdeea2
fix
c826b82
cleanup
d556506
remove PGROOT var from pgbuild.wasm.sh
6be60ff
more simplifications
d2abd3f
more wasi cleanup
7617207
remove EM_PKG_CONFIG_PATH
15ae041
store dynamically created files in the repo
6c80b04
Merge branch 'pglite/REL_16_STABLE' into tudor/cleanup
43c74aa
move wasm_common.h to postgres build instead of copy+hardcode it
d27c08a
Merge branch 'pglite/REL_16_STABLE' into tudor/cleanup
b1b1890
build action for postgres-pglite
b2cfd80
sudo on apt update
77bcd95
try with preinstalled containerd
aa9f175
fix
2a97dd3
cleanup
1b3c6c5
cleanup
4d757e1
revert changes to pgbuild.sh
feab835
renamed pgbuild.wasm.sh;
d1a47f7
moved params to config.site
adc200c
moved build wasm postgres to a different PR
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -240,15 +240,6 @@ END | |
|
||
. ${PGROOT}/pgopts.sh | ||
|
||
# make sure no non-mvp feature gets in. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. some compilers will try to use cpu intrinsics by default and some of them are allowed or emulated but outside MVP which may breaks compat on mobile browsers. Better force off to keep close to wasm MVP |
||
cat > ${PGROOT}/config.site <<END | ||
pgac_cv_sse42_crc32_intrinsics_=no | ||
pgac_cv_sse42_crc32_intrinsics__msse4_2=no | ||
pgac_sse42_crc32_intrinsics=no | ||
pgac_armv8_crc32c_intrinsics=no | ||
ac_cv_search_sem_open=no | ||
END | ||
|
||
|
||
# workaround no "locale -a" for Node. | ||
# this is simply the minimal result a popen call would give. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
echo " | ||
|
||
|
||
|
||
pgbuild.wasm:begin | ||
|
||
CC_PGLITE=$CC_PGLITE | ||
|
||
" | ||
mkdir -p build/postgres | ||
pushd build/postgres | ||
|
||
# create empty package.json to avoid emsdk node conflicts | ||
# with root package.json of project | ||
echo "{}" > package.json | ||
|
||
export MAIN_MODULE="-sMAIN_MODULE=1" | ||
export XML2_CONFIG=$PREFIX/bin/xml2-config | ||
export ZIC=$(pwd)/bin/zic | ||
export EXT=wasm | ||
|
||
cp -r ${PGSRC}/pglite/other/* /tmp/pglite/ | ||
|
||
echo " ==== building wasm MVP:$MVP Debug=${PGDEBUG} with opts : $@ == " | ||
|
||
mkdir -p bin | ||
|
||
cat > bin/zic <<END | ||
#!/bin/bash | ||
TZ=UTC PGTZ=UTC node $(pwd)/src/timezone/zic.cjs \$@ | ||
END | ||
export CONFIG_SITE=${PGSRC}/pglite/config.site | ||
|
||
if emconfigure ${PGSRC}/configure | ||
then | ||
echo configure ok | ||
else | ||
echo configure failed | ||
exit 76 | ||
fi | ||
|
||
mkdir -p /tmp/pglite/bin | ||
|
||
ln -sf /tmp/pglite/bin/emsdk-shared bin/emsdk-shared | ||
|
||
chmod +x bin/zic /tmp/pglite/bin/emsdk-shared | ||
|
||
# for zic and emsdk-shared/wasi-shared called from makefile | ||
export PATH=$(pwd)/bin:$PATH | ||
|
||
EMCC_NODE="-sEXIT_RUNTIME=1 -DEXIT_RUNTIME -sNODERAWFS -sENVIRONMENT=node" | ||
|
||
# EMCC_ENV="${EMCC_NODE} -sFORCE_FILESYSTEM=0" | ||
EMCC_ENV="${EMCC_NODE} -sERROR_ON_UNDEFINED_SYMBOLS" | ||
|
||
# PREFIX only required for static initdb | ||
EMCC_CFLAGS="-sERROR_ON_UNDEFINED_SYMBOLS=1 ${CC_PGLITE} -DPREFIX=/tmp/pglite -Wno-macro-redefined -Wno-unused-function" | ||
|
||
# ZIC=${ZIC:-$(realpath bin/zic)} | ||
|
||
if EMCC_CFLAGS="${EMCC_ENV} ${EMCC_CFLAGS}" emmake make emscripten=1 -j $(nproc) 2>&1 > /tmp/build.log | ||
then | ||
echo build ok | ||
cp -vf src/backend/postgres src/backend/postgres.cjs | ||
|
||
# if running a 32bits zic from current build | ||
unset LD_PRELOAD | ||
|
||
if EMCC_CFLAGS="${EMCC_ENV} ${EMCC_CFLAGS}" emmake make emscripten=1 install 2>&1 > /tmp/install.log | ||
then | ||
echo install ok | ||
pushd /tmp/pglite | ||
|
||
find . -type f | grep -v plpgsql > /tmp/pglite/pg.installed | ||
popd | ||
|
||
goback=$(pwd) | ||
popd | ||
python3 cibuild/pack_extension.py builtin | ||
pushd $goback | ||
|
||
pushd /tmp/pglite | ||
find . -type f > /tmp/pglite/pg.installed | ||
popd | ||
|
||
else | ||
cat /tmp/install.log | ||
echo "install failed" | ||
exit 225 | ||
fi | ||
else | ||
cat /tmp/build.log | ||
echo "build failed" | ||
exit 230 | ||
fi | ||
|
||
# wip | ||
mv -vf ./src/bin/psql/psql.$EXT ./src/bin/pg_config/pg_config.$EXT /tmp/pglite/bin/ | ||
mv -vf ./src/bin/pg_dump/pg_restore.$EXT ./src/bin/pg_dump/pg_dump.$EXT ./src/bin/pg_dump/pg_dumpall.$EXT /tmp/pglite/bin/ | ||
mv -vf ./src/bin/pg_resetwal/pg_resetwal.$EXT ./src/bin/initdb/initdb.$EXT ./src/backend/postgres.$EXT /tmp/pglite/bin/ | ||
|
||
# force node wasm version | ||
cp -vf /tmp/pglite/postgres /tmp/pglite/bin/postgres && chmod +x /tmp/pglite/postgres /tmp/pglite/bin/postgres | ||
|
||
popd | ||
echo "pgbuild:end | ||
|
||
|
||
|
||
|
||
" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# config.site for PostgreSQL custom build | ||
|
||
# Installation prefix | ||
prefix=/tmp/pglite | ||
|
||
# Cache file location | ||
cache_file=/tmp/pglite/config.cache.emscripten | ||
|
||
# Disable spinlocks | ||
ac_cv_spinlock=no | ||
|
||
# Disable large file support | ||
ac_cv_sys_large_files=no | ||
|
||
# Disable LLVM support | ||
with_llvm=no | ||
|
||
# Disable PAM | ||
with_pam=no | ||
|
||
# Explicitly disable OpenSSL | ||
with_openssl=no | ||
|
||
# Disable readline support | ||
with_readline=no | ||
|
||
# Disable ICU support | ||
with_icu=no | ||
|
||
# Enable OSSP UUID | ||
with_uuid=ossp | ||
|
||
# Enable zlib | ||
with_zlib=yes | ||
|
||
# Enable libxml | ||
with_libxml=yes | ||
|
||
# Enable libxslt | ||
with_libxslt=yes | ||
|
||
# Set extension | ||
ac_cv_exeext=.cjs | ||
|
||
# Set template | ||
with_template=emscripten |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
USER="postgres" | ||
PASS="postgres" | ||
md5pass = "md5" + __import__('hashlib').md5(USER.encode() + PASS.encode()).hexdigest() | ||
print(f"localhost:5432:postgres:{USER}:{md5pass}") | ||
|
||
USER="login" | ||
PASS="password" | ||
md5pass = "md5" + __import__('hashlib').md5(USER.encode() + PASS.encode()).hexdigest() | ||
print(f"localhost:5432:postgres:{USER}:{md5pass}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
echo "[$(pwd)] $0 $@" >> /tmp/disable-shared.log | ||
# shared build | ||
${PG_LINK:-emcc} -L${PREFIX}/lib -DPREFIX=/tmp/pglite -shared -sSIDE_MODULE=1 $@ -Wno-unused-function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
node /tmp/pglite/bin/pg_config.cjs $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
. /opt/python-wasm-sdk/wasm32-bi-emscripten-shell.sh | ||
TZ=UTC PGTZ=UTC node /tmp/pglite/bin/initdb.cjs $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
. /opt/python-wasm-sdk/wasm32-bi-emscripten-shell.sh | ||
TZ=UTC PGTZ=UTC PGDATA=${PGDATA} node /tmp/pglite/bin/postgres.cjs $@ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try to avoid patching configure file, this file is auto generated whenever upstream update it with autotools and makes it hard for diff to apply. prefer add changes to CONFIG_SITE when it is possible