Skip to content

Commit

Permalink
hostpic, o2g3
Browse files Browse the repository at this point in the history
  • Loading branch information
pmp-p committed Dec 3, 2024
1 parent 775ad39 commit e7d5dfb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
gosdk: false
rustsdk: false
nimsdk: false
COPTS: -Os -g0
COPTS: -Os -g3

steps:
- uses: actions/checkout@v3.3.0
Expand Down
13 changes: 6 additions & 7 deletions scripts/cpython-build-host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ then
unset CPPFLAGS
unset LDFLAGS

#export OPT="$CPOPTS -DNDEBUG -fwrapv"
mkdir -p $ROOT/src/cpython${PYBUILD}/Tools/wasm
cat > $ROOT/src/cpython${PYBUILD}/Tools/wasm/config.host-wasm32-emscripten <<END
ac_cv_lib_intl_textdomain=no
Expand Down Expand Up @@ -101,27 +100,27 @@ END
fi
fi

# CFLAGS="-fPIC" CPPFLAGS="-fPIC"
CNF="${ROOT}/src/cpython${PYBUILD}/configure \
CNF="${ROOT}/src/cpython${PYBUILD}/configure \
--prefix=$HOST_PREFIX $PYOPTS $GIL"
if CC=clang CXX=clang++ $CNF
if CC="clang" CXX="clang++" CCSHARED="-fPIC" $CNF
then

if make -j$(nproc)
then
if make install
then
echo "CPython $PYTHON_FOR_BUILD ready" 1>&2
else
echo "CPython $PYTHON_FOR_BUILD failed to install" 1>&2
exit 117
exit 114
fi
else
echo "
failed to build $PYTHON_FOR_BUILD
CC=clang CXX=clang++ $CNF
" 1>&2
exit 125
exit 122
fi
else
echo "
Expand All @@ -134,7 +133,7 @@ CC=clang CXX=clang++ $CNF
==========================================================================
" 1>&2
exit 149
exit 135
fi

popd
Expand Down
19 changes: 12 additions & 7 deletions scripts/cpython-fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ echo "

mkdir -p src

pushd src 2>&1 >/dev/null
pushd src

NOPATCH=false
PYPATCH=true
Expand All @@ -22,7 +22,7 @@ if echo $PYBUILD |grep -q 15$
then
if [ -d cpython${PYBUILD} ]
then
pushd cpython${PYBUILD} 2>&1 >/dev/null
pushd cpython${PYBUILD}
# put the tree back to original state so we can pull
# Programs/python.c Modules/readline.c
git restore .
Expand Down Expand Up @@ -133,9 +133,9 @@ popd
# 3.10 is not wasm stable
if [ -f support/__EMSCRIPTEN__.patches/${PYBUILD}-host.diff ]
then
pushd src/cpython${PYBUILD} 2>&1 >/dev/null
pushd src/cpython${PYBUILD}
patch -p1 < ../../support/__EMSCRIPTEN__.patches/${PYBUILD}-host.diff
popd 2>&1 >/dev/null
popd
fi


Expand All @@ -147,10 +147,15 @@ if $NOPATCH
then
echo "finally there"
else
# do some patching for 3.11+ to allow more shared libs
pushd src/cpython${PYBUILD} 2>&1 >/dev/null
pushd src/cpython${PYBUILD}

# do some patching for 3.11+ to allow shared libs and move js to pymain
patch -p1 < ../../support/__EMSCRIPTEN__.embed/cpython${PYBUILD}.diff
popd 2>&1 >/dev/null

# patch host to be PIC
patch -p1 < ../../support/hostpic.diff

popd
fi

echo "
Expand Down

0 comments on commit e7d5dfb

Please sign in to comment.