|
|
50a0a7 |
#!/bin/sh
|
|
|
50a0a7 |
|
|
|
50a0a7 |
# the purpose of this script is to speed-up the support
|
|
|
50a0a7 |
# of additional variants. it is not very pretty, but
|
|
|
50a0a7 |
# does the job quite well. please read the script in
|
|
|
50a0a7 |
# its entirety before executing it.
|
|
|
50a0a7 |
|
|
|
50a0a7 |
set -eu
|
|
|
50a0a7 |
|
|
|
50a0a7 |
trap usage 1 EXIT
|
|
|
50a0a7 |
|
|
|
50a0a7 |
py_refdir=$(pwd)
|
|
|
50a0a7 |
py_hoppla=$(basename "$0")
|
|
|
50a0a7 |
py_differ=
|
|
|
50a0a7 |
|
|
|
50a0a7 |
usage()
|
|
|
50a0a7 |
{
|
|
|
50a0a7 |
printf '%s: %s %s\n' "$py_hoppla" \
|
|
|
50a0a7 |
'please read this script' \
|
|
|
50a0a7 |
'and understand what it does.' >&2
|
|
|
50a0a7 |
exit 1
|
|
|
50a0a7 |
}
|
|
|
50a0a7 |
|
|
|
50a0a7 |
if ! [ -z ${4:-} ]; then
|
|
|
50a0a7 |
printf '%s: too many arguments.\n' "$py_hoppla" >&2
|
|
|
50a0a7 |
exit 1
|
|
|
50a0a7 |
fi
|
|
|
50a0a7 |
|
|
|
50a0a7 |
if ! [ -z ${3:-} ]; then
|
|
|
50a0a7 |
if [ "$3" != '--diff-only' ] && [ "$3" != '-d' ]; then
|
|
|
50a0a7 |
printf '%s: %s %s\n' "$py_hoppla" \
|
|
|
50a0a7 |
'invalid third argument' \
|
|
|
50a0a7 |
'(must be --diff-only or -d).' >&2
|
|
|
50a0a7 |
exit 1
|
|
|
50a0a7 |
else
|
|
|
50a0a7 |
py_differ=yes
|
|
|
50a0a7 |
fi
|
|
|
50a0a7 |
fi
|
|
|
50a0a7 |
|
|
|
50a0a7 |
py_base_ver="$1"
|
|
|
50a0a7 |
py_curr_ver="$2"
|
|
|
50a0a7 |
|
|
|
50a0a7 |
PY_SOURCE_PREFIX=${PY_SOURCE_PREFIX:-}
|
|
|
50a0a7 |
|
|
|
50a0a7 |
if [ -z $PY_SOURCE_PREFIX ]; then
|
|
|
50a0a7 |
PY_SOURCE_PREFIX=$py_refdir
|
|
|
50a0a7 |
fi
|
|
|
50a0a7 |
|
|
|
50a0a7 |
for py_ver in "$py_base_ver" "$py_curr_ver"; do
|
|
|
50a0a7 |
case "$py_ver" in
|
|
|
50a0a7 |
[0-9].[0-9].[0-9] )
|
|
|
50a0a7 |
if ! [ -d "$PY_SOURCE_PREFIX"/Python-$py_ver ]; then
|
|
|
50a0a7 |
printf '%s: %s: %s\n' "$py_hoppla" \
|
|
|
50a0a7 |
"$PY_SOURCE_PREFIX"/Python-$py_ver \
|
|
|
50a0a7 |
'the directory does not exist.' >&2
|
|
|
50a0a7 |
exit 1
|
|
|
50a0a7 |
fi
|
|
|
50a0a7 |
;;
|
|
|
50a0a7 |
* )
|
|
|
50a0a7 |
printf '%s: %s %s\n' "$py_hoppla" \
|
|
|
50a0a7 |
">>$py_ver<<" 'is not a valid python version.' >&2
|
|
|
50a0a7 |
exit 1
|
|
|
50a0a7 |
esac
|
|
|
50a0a7 |
done
|
|
|
50a0a7 |
|
|
|
50a0a7 |
for py_ver in $py_base_ver $py_curr_ver; do
|
|
|
50a0a7 |
if [ -z $py_differ ]; then
|
|
|
50a0a7 |
mkdir $py_refdir/$py_ver.build
|
|
|
50a0a7 |
cd $py_refdir/$py_ver.build
|
|
|
50a0a7 |
|
|
|
50a0a7 |
printf '%s: configure.\n' $py_ver
|
|
|
50a0a7 |
|
|
|
50a0a7 |
"$PY_SOURCE_PREFIX"/Python-$py_ver/configure \
|
|
|
50a0a7 |
--enable-ipv6 > /dev/null
|
|
|
50a0a7 |
|
|
|
50a0a7 |
printf '%s: make.\n' $py_ver
|
|
|
50a0a7 |
|
|
|
50a0a7 |
make V=2 >pylog
|
|
|
50a0a7 |
else
|
|
|
50a0a7 |
cd $py_refdir/$py_ver.build
|
|
|
50a0a7 |
fi
|
|
|
50a0a7 |
|
|
|
50a0a7 |
py_dot=$(printf '%s' $py_ver | sed -e 's/\.[^.]*$//g')
|
|
|
50a0a7 |
py_abi=$(printf '%s' $py_dot | sed -e 's/\.//g')
|
|
|
50a0a7 |
|
|
|
50a0a7 |
grep -e ' -c ' pylog | grep -v -e 'build/temp.' -e '/install' \
|
|
|
50a0a7 |
| sed -e 's@Python-'$py_ver/'@Python-pyver/@g' \
|
|
|
50a0a7 |
-e 's@-Wstrict-prototypes@@g' \
|
|
|
50a0a7 |
-e 's@-Werror=implicit-function-declaration@@g' \
|
|
|
50a0a7 |
-e 's@-Wno-unused-result@@g' \
|
|
|
50a0a7 |
-e 's@-Wsign-compare@@g' \
|
|
|
50a0a7 |
-e 's@-DNDEBUGe@@g' \
|
|
|
50a0a7 |
-e 's@-DPy_BUILD_CORE@@g' \
|
|
|
50a0a7 |
-e 's@-g -fwrapv -O3 -Wall@@g' \
|
|
|
50a0a7 |
-e 's@-std=c99 -Wextra@@g' \
|
|
|
50a0a7 |
-e 's@-Wno-missing-field-initializers@@g' \
|
|
|
50a0a7 |
-e 's@-Wno-unused-result@@g' \
|
|
|
50a0a7 |
-e 's@-Wno-unused-parameter@@g' \
|
|
|
50a0a7 |
-e 's/ */ /g' \
|
|
|
50a0a7 |
| sort > cccore.log
|
|
|
50a0a7 |
|
|
|
50a0a7 |
grep -e ' -c ' pylog | grep -e 'build/temp.' \
|
|
|
50a0a7 |
| sed -e 's@Python-'$py_ver/'@Python-pyver/@g' \
|
|
|
50a0a7 |
-e 's@'/$py_ver.build'@/pyver.build@g' \
|
|
|
50a0a7 |
-e 's@'$py_dot/'@pydot/@g' \
|
|
|
50a0a7 |
-e 's@-Wstrict-prototypes@@g' \
|
|
|
50a0a7 |
-e 's@-Werror=implicit-function-declaration@@g' \
|
|
|
50a0a7 |
-e 's@-Wno-unused-result@@g' \
|
|
|
50a0a7 |
-e 's@-Wsign-compare@@g' \
|
|
|
50a0a7 |
-e 's@-DNDEBUGe@@g' \
|
|
|
50a0a7 |
-e 's@-DBLAKE2_USE_SSE=1@@g' \
|
|
|
50a0a7 |
-e 's@-g -fwrapv -O3 -Wall@@g' \
|
|
|
50a0a7 |
-e 's@-std=c99 -Wextra@@g' \
|
|
|
50a0a7 |
-e 's@-Wno-missing-field-initializers@@g' \
|
|
|
50a0a7 |
-e 's@-Wno-unused-result@@g' \
|
|
|
50a0a7 |
-e 's@-Wno-unused-parameter@@g' \
|
|
|
50a0a7 |
-e 's/ */ /g' \
|
|
|
50a0a7 |
| sort > ccext.log
|
|
|
50a0a7 |
|
|
|
50a0a7 |
grep -e ' -shared ' pylog | grep -e '.cpython-' \
|
|
|
50a0a7 |
| sed -e 's@Python-'$py_ver/'@Python-pyver/@g' \
|
|
|
50a0a7 |
-e 's@.cpython-'$py_abi'@.cpython-pyabi.@g' \
|
|
|
50a0a7 |
-e 's@'-$py_dot'/@-pydot/@g' \
|
|
|
50a0a7 |
| sort > pyext.log
|
|
|
50a0a7 |
|
|
|
50a0a7 |
find . -name '*.cpython-*' \
|
|
|
50a0a7 |
| sed -e 's@.cpython-'$py_abi'@.cpython-pyabi.@g' \
|
|
|
50a0a7 |
-e 's@'-$py_dot'/@-pydot/@g' \
|
|
|
50a0a7 |
| sort > pyext.lst
|
|
|
50a0a7 |
|
|
|
50a0a7 |
find "$PY_SOURCE_PREFIX"/Python-$py_ver/Include -maxdepth 1 -name '*.h' \
|
|
|
50a0a7 |
| sed -e 's@Python-'$py_ver/'@Python-pyver/@g' \
|
|
|
50a0a7 |
| sort > pyhdr.lst
|
|
|
50a0a7 |
done
|
|
|
50a0a7 |
|
|
|
50a0a7 |
diffdir=$py_base_ver-vs-$py_curr_ver
|
|
|
50a0a7 |
logfiles="cccore.log ccext.log pyext.log pyext.lst pyhdr.lst"
|
|
|
50a0a7 |
genfiles="pyconfig.h Modules/config.c"
|
|
|
50a0a7 |
|
|
|
50a0a7 |
cd $py_refdir
|
|
|
50a0a7 |
mkdir -p $diffdir
|
|
|
50a0a7 |
|
|
|
50a0a7 |
for f in $logfiles $genfiles; do
|
|
|
50a0a7 |
diffname=$(basename $f | sed -e 's/\.[^.]*$//g')
|
|
|
50a0a7 |
|
|
|
50a0a7 |
diff -u \
|
|
|
50a0a7 |
$py_refdir/$py_base_ver.build/$f \
|
|
|
50a0a7 |
$py_refdir/$py_curr_ver.build/$f \
|
|
|
50a0a7 |
> $diffdir/$diffname.diff || true
|
|
|
50a0a7 |
done
|
|
|
50a0a7 |
|
|
|
50a0a7 |
trap '' 0
|
|
|
50a0a7 |
echo yay.
|
|
|
50a0a7 |
|
|
|
50a0a7 |
exit 0
|