Files
macports-base/tests/test-tclsh.in
T
Clemens Lang 0bbe4ad0ee port1.0: Fix running in installation directory
Attempting to normalize the userhome of the macports user might not work
if the user has not yet been created while running tests from within the
source tree, so don't do that unless running as root (where the test
that triggers this is skipped).

Additionally, the SIP workaround path for darwintrace needs to be
configurable, because the path in the installation directory might not
exist yet (CI may not have yet run make install). This path then also
needs to be added to the various sandboxes we configure.

This also means darwintrace.dylib needs to be picked up from the source
tree, so add another variable to test-tclsh.in (and pass that variable
through by modifying test-macports.conf) and check for its existence in
porttrace.tcl.
2026-04-12 14:29:41 +02:00

23 lines
952 B
Bash

#!/bin/sh
DESTROOT="@abs_top_builddir@/vendor/vendor-destroot"
MP_PREFIX="@prefix@/libexec/macports"
LIB_PATH="${DESTROOT}${MP_PREFIX}/lib:${DESTROOT}${MP_PREFIX}/lib/@SQLITE3_LIBNAME@"
# For Linux and *BSD
if [ -z "$LD_LIBRARY_PATH" ]; then
export LD_LIBRARY_PATH="$LIB_PATH"
else
export LD_LIBRARY_PATH="$LIB_PATH:$LD_LIBRARY_PATH"
fi
# DYLD_LIBRARY_PATH tends to get lost on recent macOS due to basic
# tools like /bin/sh being subject to SIP, so we have to edit the load
# commands instead (see vendor/Makefile.in).
# Tcl package search path: vendor libs first, then in-tree src packages
SRCDIR="@abs_top_builddir@/src"
export TCLLIBPATH="${DESTROOT}${MP_PREFIX}/lib ${SRCDIR}/macports1.0 ${SRCDIR}/port1.0 ${SRCDIR}/pextlib1.0 ${SRCDIR}/registry2.0 ${SRCDIR}/machista1.0 ${SRCDIR}/mpcommon1.0 ${SRCDIR}/package1.0 ${SRCDIR}/portlist1.0"
export MACPORTS_SOURCETREE_DARWINTRACE=${SRCDIR}/darwintracelib1.0
exec "${DESTROOT}@TCLSH@" "$@"