Browse Source

Introduce PAWPAW_DEBUG

Signed-off-by: falkTX <falktx@falktx.com>
pull/28/head
falkTX 1 year ago
parent
commit
f69b3d984f
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
4 changed files with 52 additions and 12 deletions
  1. +2
    -1
      bootstrap-python.sh
  2. +6
    -0
      setup/check_target.sh
  3. +18
    -4
      setup/env.sh
  4. +26
    -7
      setup/functions.sh

+ 2
- 1
bootstrap-python.sh View File

@@ -157,7 +157,8 @@ function build_conf_python() {
export CFLAGS="$(echo ${CFLAGS} | sed -e 's/-fdata-sections -ffunction-sections//')"
export CFLAGS="$(echo ${CFLAGS} | sed -e 's/-fno-strict-aliasing -flto//')"
export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-Wl,-dead_strip,-dead_strip_dylibs,-x//')"
export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-Wl,-O1,--gc-sections,--no-undefined//')"
export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-Wl,--gc-sections,--no-undefined//')"
export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-Wl,-O1//')"
export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-Wl,--as-needed,--strip-all//')"
export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-fdata-sections -ffunction-sections//')"
export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-fno-strict-aliasing -flto//')"


+ 6
- 0
setup/check_target.sh View File

@@ -197,6 +197,12 @@ function check_target() {

check_target

# always skip tests when cross-compiling
if [ "${CROSS_COMPILING}" -eq 1 ]; then
PAWPAW_SKIP_TESTS=${PAWPAW_SKIP_TESTS:=1}
fi

# always skip stripping if building in debug mode
if [ -n "${PAWPAW_DEBUG}" ] && [ "${PAWPAW_DEBUG}" -eq 1 ]; then
PAWPAW_SKIP_STRIPPING=1
fi

+ 18
- 4
setup/env.sh View File

@@ -61,6 +61,11 @@ PAWPAW_BUILDDIR="${PAWPAW_DIR}/builds/${PAWPAW_TARGET}"
PAWPAW_PREFIX="${PAWPAW_DIR}/targets/${PAWPAW_TARGET}"
PAWPAW_TMPDIR="/tmp"

if [ -n "${PAWPAW_DEBUG}" ] && [ "${PAWPAW_DEBUG}" -eq 1 ]; then
PAWPAW_BUILDDIR+="-debug"
PAWPAW_PREFIX+="-debug"
fi

if [ -z "${PAWPAW_SKIP_LTO}" ] || [ "${PAWPAW_SKIP_LTO}" -eq 0 ]; then
PAWPAW_BUILDDIR+="-lto"
PAWPAW_PREFIX+="-lto"
@@ -90,16 +95,22 @@ fi

## build flags

BUILD_FLAGS="-Os -pipe -I${PAWPAW_PREFIX}/include ${EXTRA_FLAGS}"
BUILD_FLAGS="-pipe -I${PAWPAW_PREFIX}/include ${EXTRA_FLAGS}"
BUILD_FLAGS+=" -ffast-math"
BUILD_FLAGS+=" -fPIC -DPIC -DNDEBUG=1"
BUILD_FLAGS+=" -fdata-sections -ffunction-sections -fno-common -fomit-frame-pointer -fvisibility=hidden"
BUILD_FLAGS+=" -fPIC -DPIC"
BUILD_FLAGS+=" -fdata-sections -ffunction-sections -fno-common -fvisibility=hidden"
BUILD_FLAGS+=" -fno-stack-protector -U_FORTIFY_SOURCE -Wp,-U_FORTIFY_SOURCE"

if [ "${GCC}" -eq 1 ]; then
BUILD_FLAGS+=" -fno-gnu-unique"
fi

if [ -z "${PAWPAW_DEBUG}" ] || [ "${PAWPAW_DEBUG}" -eq 0 ]; then
BUILD_FLAGS+=" -Os -DNDEBUG=1 -fomit-frame-pointer"
else
BUILD_FLAGS+=" -O0 -g -DDEBUG=1 -D_DEBUG=1"
fi

if [ -z "${PAWPAW_SKIP_LTO}" ] || [ "${PAWPAW_SKIP_LTO}" -eq 0 ]; then
BUILD_FLAGS+=" -fno-strict-aliasing -flto"
fi
@@ -185,7 +196,10 @@ elif [ "${WASM}" -eq 1 ]; then
LINK_FLAGS+=" -sAGGRESSIVE_VARIABLE_ELIMINATION=1"
fi
else
LINK_FLAGS+=" -Wl,-O1,--gc-sections,--no-undefined"
LINK_FLAGS+=" -Wl,--gc-sections,--no-undefined"
if [ -z "${PAWPAW_DEBUG}" ] || [ "${PAWPAW_DEBUG}" -eq 0 ]; then
LINK_FLAGS+=" -Wl,-O1"
fi
if [ -z "${PAWPAW_SKIP_STRIPPING}" ] || [ "${PAWPAW_SKIP_STRIPPING}" -eq 0 ]; then
LINK_FLAGS+=" -Wl,--as-needed,--strip-all"
fi


+ 26
- 7
setup/functions.sh View File

@@ -218,16 +218,22 @@ function build_autoconf() {
local pkgdir="${PAWPAW_BUILDDIR}/${pkgname}-${version}"

if [ "${WASM}" -eq 1 ]; then
extraconfrules="--host=$(uname -m)-linux-gnu ${extraconfrules}"
extraconfrules+=" --host=$(uname -m)-linux-gnu"
elif [ -n "${TOOLCHAIN_PREFIX}" ]; then
extraconfrules="--host=${TOOLCHAIN_PREFIX} ac_cv_build=$(uname -m)-linux-gnu ac_cv_host=${TOOLCHAIN_PREFIX} ${extraconfrules}"
extraconfrules+=" --host=${TOOLCHAIN_PREFIX} ac_cv_build=$(uname -m)-linux-gnu ac_cv_host=${TOOLCHAIN_PREFIX}"
fi

if [ -n "${PAWPAW_DEBUG}" ] && [ "${PAWPAW_DEBUG}" -eq 1 ]; then
extraconfrules+=" --disable-debug"
else
extraconfrules+=" --enable-debug"
fi

_prebuild "${pkgname}" "${pkgdir}"

if [ ! -f "${pkgdir}/.stamp_configured" ]; then
pushd "${pkgdir}"
./configure --enable-static --disable-shared --disable-debug --disable-doc --disable-docs --disable-maintainer-mode --prefix="${PAWPAW_PREFIX}" ${extraconfrules}
./configure --enable-static --disable-shared --disable-doc --disable-docs --disable-maintainer-mode --prefix="${PAWPAW_PREFIX}" ${extraconfrules}
touch .stamp_configured
popd
fi
@@ -364,9 +370,15 @@ function build_cmake() {
extraconfrules+=" -DCMAKE_RC_COMPILER=${WINDRES}"
fi

if [ -n "${PAWPAW_DEBUG}" ] && [ "${PAWPAW_DEBUG}" -eq 1 ]; then
extraconfrules+=" -DCMAKE_BUILD_TYPE=Release"
else
extraconfrules+=" -DCMAKE_BUILD_TYPE=Debug"
fi

if [ ! -f "${pkgdir}/.stamp_configured" ]; then
pushd "${pkgdir}/build"
${CMAKE_EXE_WRAPPER} ${cmake} -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_PREFIX="${PAWPAW_PREFIX}" ${extraconfrules} ..
${CMAKE_EXE_WRAPPER} ${cmake} -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_PREFIX="${PAWPAW_PREFIX}" ${extraconfrules} ..
touch ../.stamp_configured
popd
fi
@@ -424,14 +436,20 @@ function build_meson() {
local pkgdir="${PAWPAW_BUILDDIR}/${pkgname}-${version}"

if [ "${CROSS_COMPILING}" -eq 1 ]; then
extraconfrules="--cross-file "${PAWPAW_ROOT}/setup/meson/${PAWPAW_TARGET}.ini" ${extraconfrules}"
extraconfrules+=" --cross-file '${PAWPAW_ROOT}/setup/meson/${PAWPAW_TARGET}.ini'"
fi

if [ -n "${PAWPAW_DEBUG}" ] && [ "${PAWPAW_DEBUG}" -eq 1 ]; then
extraconfrules+=" --buildtype release"
else
extraconfrules+=" --buildtype debug"
fi

_prebuild "${pkgname}" "${pkgdir}"

if [ ! -f "${pkgdir}/.stamp_configured" ]; then
pushd "${pkgdir}"
env NINJA="${ninja}" ${meson} setup build --buildtype release --prefix "${PAWPAW_PREFIX}" --libdir lib ${extraconfrules}
env NINJA="${ninja}" ${meson} setup build --prefix "${PAWPAW_PREFIX}" --libdir lib ${extraconfrules}
touch .stamp_configured
popd
fi
@@ -474,7 +492,8 @@ function build_python() {
export CXXFLAGS="$(echo ${CXXFLAGS} | sed -e 's/-fdata-sections -ffunction-sections//')"
export CXXFLAGS="$(echo ${CXXFLAGS} | sed -e 's/-fno-strict-aliasing -flto//')"
export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-Wl,-dead_strip,-dead_strip_dylibs,-x//')"
export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-Wl,-O1,--gc-sections,--no-undefined//')"
export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-Wl,--gc-sections,--no-undefined//')"
export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-Wl,-O1//')"
export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-Wl,--as-needed,--strip-all//')"
export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-fdata-sections -ffunction-sections//')"
export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-fno-strict-aliasing -flto//')"


Loading…
Cancel
Save