Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/Doxyfile
/setupenv.bash
/autom4te.cache
/port.sh

doc/*.gz
doc/*.mtree
Expand All @@ -21,8 +22,8 @@ src/*
!src/*/
src/*/*_autoconf.tcl
src/cregistry/macports.sqlext
src/darwintracelib1.0/*.d
src/darwintracelib1.0/sip_copy_proc.[ch]
src/darwintrace1.0/*.d
src/darwintrace1.0/sip_copy_proc.[ch]
src/machista1.0/tests/libmachista-test
src/port/*
!src/port/*.tcl
Expand Down
4 changes: 2 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ include Mk/macports.autoconf.mk

all:: Mk/macports.autoconf.mk

Mk/macports.autoconf.mk: Mk/macports.autoconf.mk.in src/config.h.in Makefile.in doc/Makefile.in src/Makefile.in src/cregistry/Makefile.in src/darwintracelib1.0/Makefile.in src/machista1.0/Makefile.in src/macports1.0/Makefile.in src/mpcommon1.0/Makefile.in src/package1.0/Makefile.in src/pextlib1.0/Makefile.in src/port/Makefile.in src/port1.0/Makefile.in src/programs/Makefile.in src/programs/daemondo/Makefile.in src/registry2.0/Makefile.in tests/Makefile.in vendor/Makefile.in config.status
Mk/macports.autoconf.mk: Mk/macports.autoconf.mk.in src/config.h.in Makefile.in doc/Makefile.in src/Makefile.in src/cregistry/Makefile.in src/darwintrace1.0/Makefile.in src/machista1.0/Makefile.in src/macports1.0/Makefile.in src/mpcommon1.0/Makefile.in src/package1.0/Makefile.in src/pextlib1.0/Makefile.in src/port/Makefile.in src/port1.0/Makefile.in src/programs/Makefile.in src/programs/daemondo/Makefile.in src/registry2.0/Makefile.in tests/Makefile.in vendor/Makefile.in config.status
./config.status
${MAKE} clean

Expand Down Expand Up @@ -156,7 +156,7 @@ test::
# want things getting rebuilt after they're signed just because a dependency
# has a later mtime because it was also signed.
codesign::
@for subdir in vendor src/darwintracelib1.0 src/machista1.0 src/macports1.0 src/registry2.0 src/pextlib1.0 src/programs/daemondo ; do\
@for subdir in vendor src/darwintrace1.0 src/machista1.0 src/macports1.0 src/registry2.0 src/pextlib1.0 src/programs/daemondo ; do\
echo ===\> making $@ in ${DIRPRFX}$$subdir; \
( cd $$subdir && $(MAKE) DIRPRFX=${DIRPRFX}$$subdir/ $@) || exit 1; \
done
Expand Down
29 changes: 27 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -3213,6 +3213,27 @@ printf "%s\n" "$as_me: WARNING: Please consider upgrading as some ports fail com
;;
esac

# Check whether the source location is valid; Tcl does not build in
# locations containing spaces, and we don't support out-of-source
# builds.
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for in-tree build" >&5
printf %s "checking for in-tree build... " >&6; }
if test "x$srcdir" != "x."; then
as_fn_error $? "failed; out-of-source builds not supported" "$LINENO" 5
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ok" >&5
printf "%s\n" "ok" >&6; }
fi

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether source directory location is valid" >&5
printf %s "checking whether source directory location is valid... " >&6; }
if echo "$ac_abs_confdir" | grep -q ' '; then
as_fn_error $? "failed; path to source directory must not contain spaces" "$LINENO" 5
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ok" >&5
printf "%s\n" "ok" >&6; }
fi

# Checks for programs.


Expand Down Expand Up @@ -9991,8 +10012,10 @@ printf "%s\n" "yes" >&6; }


# Output
ac_config_files="$ac_config_files Doxyfile Makefile Mk/macports.autoconf.mk doc/Makefile doc/base.mtree doc/macosx.mtree doc/macports.conf doc/prefix.mtree doc/pubkeys.conf portmgr/dmg/postflight setupenv.bash src/Makefile src/cregistry/Makefile src/compat/Makefile src/darwintracelib1.0/Makefile src/machista1.0/Makefile src/macports1.0/Makefile src/macports1.0/macports_autoconf.tcl src/macports1.0/macports_test_autoconf.tcl src/mpcommon1.0/Makefile src/package1.0/Makefile src/package1.0/package_test_autoconf.tcl src/pextlib1.0/Makefile src/port/Makefile src/port1.0/Makefile src/port1.0/port_autoconf.tcl src/port1.0/port_test_autoconf.tcl src/programs/Makefile src/registry2.0/Makefile src/registry2.0/registry_autoconf.tcl tests/Makefile tests/test.tcl tests/test/library.tcl tests/test/trace/test.tcl vendor/Makefile"
ac_config_files="$ac_config_files Doxyfile Makefile Mk/macports.autoconf.mk doc/Makefile doc/base.mtree doc/macosx.mtree doc/macports.conf doc/prefix.mtree doc/pubkeys.conf portmgr/dmg/postflight setupenv.bash src/Makefile src/cregistry/Makefile src/compat/Makefile src/darwintrace1.0/Makefile src/machista1.0/Makefile src/macports1.0/Makefile src/macports1.0/macports_autoconf.tcl src/macports1.0/macports_test_autoconf.tcl src/mpcommon1.0/Makefile src/package1.0/Makefile src/package1.0/package_test_autoconf.tcl src/pextlib1.0/Makefile src/port/Makefile src/port1.0/Makefile src/port1.0/port_autoconf.tcl src/port1.0/port_test_autoconf.tcl src/programs/Makefile src/registry2.0/Makefile src/registry2.0/registry_autoconf.tcl tests/Makefile tests/test.tcl tests/test/library.tcl tests/test/trace/test.tcl vendor/Makefile"


ac_config_files="$ac_config_files port.sh"

ac_config_files="$ac_config_files vendor/tclsh"

Expand Down Expand Up @@ -10708,7 +10731,7 @@ do
"src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
"src/cregistry/Makefile") CONFIG_FILES="$CONFIG_FILES src/cregistry/Makefile" ;;
"src/compat/Makefile") CONFIG_FILES="$CONFIG_FILES src/compat/Makefile" ;;
"src/darwintracelib1.0/Makefile") CONFIG_FILES="$CONFIG_FILES src/darwintracelib1.0/Makefile" ;;
"src/darwintrace1.0/Makefile") CONFIG_FILES="$CONFIG_FILES src/darwintrace1.0/Makefile" ;;
"src/machista1.0/Makefile") CONFIG_FILES="$CONFIG_FILES src/machista1.0/Makefile" ;;
"src/macports1.0/Makefile") CONFIG_FILES="$CONFIG_FILES src/macports1.0/Makefile" ;;
"src/macports1.0/macports_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/macports1.0/macports_autoconf.tcl" ;;
Expand All @@ -10729,6 +10752,7 @@ do
"tests/test/library.tcl") CONFIG_FILES="$CONFIG_FILES tests/test/library.tcl" ;;
"tests/test/trace/test.tcl") CONFIG_FILES="$CONFIG_FILES tests/test/trace/test.tcl" ;;
"vendor/Makefile") CONFIG_FILES="$CONFIG_FILES vendor/Makefile" ;;
"port.sh") CONFIG_FILES="$CONFIG_FILES port.sh" ;;
"vendor/tclsh") CONFIG_FILES="$CONFIG_FILES vendor/tclsh" ;;
"src/cxx_stdlib_overridden.tcl") CONFIG_FILES="$CONFIG_FILES src/cxx_stdlib_overridden.tcl" ;;
"src/dedup_portfiles.tcl") CONFIG_FILES="$CONFIG_FILES src/dedup_portfiles.tcl" ;;
Expand Down Expand Up @@ -11287,6 +11311,7 @@ printf "%s\n" "$as_me: $ac_file is unchanged" >&6;}


case $ac_file$ac_mode in
"port.sh":F) chmod +x port.sh ;;
"vendor/tclsh":F) chmod +x vendor/tclsh ;;
"src/cxx_stdlib_overridden.tcl":F) chmod +x src/cxx_stdlib_overridden.tcl ;;
"src/dedup_portfiles.tcl":F) chmod +x src/dedup_portfiles.tcl ;;
Expand Down
20 changes: 19 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,23 @@ case "$XCODE_VERSION" in
;;
esac

# Check whether the source location is valid; Tcl does not build in
# locations containing spaces, and we don't support out-of-source
# builds.
AC_MSG_CHECKING(for in-tree build)
if test "x$srcdir" != "x."; then
AC_MSG_ERROR([failed; out-of-source builds not supported])
else
AC_MSG_RESULT([ok])
fi

AC_MSG_CHECKING(whether source directory location is valid)
if echo "$ac_abs_confdir" | grep -q ' '; then
AC_MSG_ERROR([failed; path to source directory must not contain spaces])
else
AC_MSG_RESULT([ok])
fi

# Checks for programs.
AC_PROG_CC([clang cc gcc])
AC_PROG_INSTALL
Expand Down Expand Up @@ -422,7 +439,7 @@ AC_CONFIG_FILES([
src/Makefile
src/cregistry/Makefile
src/compat/Makefile
src/darwintracelib1.0/Makefile
src/darwintrace1.0/Makefile
src/machista1.0/Makefile
src/macports1.0/Makefile
src/macports1.0/macports_autoconf.tcl
Expand All @@ -445,6 +462,7 @@ AC_CONFIG_FILES([
vendor/Makefile
])

AC_CONFIG_FILES([port.sh], [chmod +x port.sh])
AC_CONFIG_FILES([vendor/tclsh], [chmod +x vendor/tclsh])
AC_CONFIG_FILES([src/cxx_stdlib_overridden.tcl], [chmod +x src/cxx_stdlib_overridden.tcl])
AC_CONFIG_FILES([src/dedup_portfiles.tcl], [chmod +x src/dedup_portfiles.tcl])
Expand Down
40 changes: 40 additions & 0 deletions port.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/sh
#
# Simple shell script to invoke MacPorts from the source directory
#

# force the locally built, vendored Tcl
export TCL_LIBRARY="@abs_srcdir@/@VENDOR_DESTROOT@@TCL_PACKAGE_PATH@/tcl@TCL_VERSION@"

# tell it about the location of the MacPorts source files
export TCLLIBPATH="@abs_srcdir@/src"

# this sandbox profile actively prevents MacPorts from loading the Tcl
# sources from @prefix@
sandbox_profile="
(version 1)

; allow everything
(allow default)

; ...but deny access to installed Tcl files
(deny file* (subpath \"@TCL_PREFIX@\"))

; ...and fix trace mode by allowing reexecution in another sandbox
(allow process-exec (with no-sandbox)
(literal \"@SANDBOX_EXEC@\")
(regex #\"^@DARWINTRACE_SIP_WORKAROUND_PATH@/[0-9]*@SANDBOX_EXEC@\$\"))
"

# give a nice error if the source isn't built
if ! [ -d "$TCL_LIBRARY" ] || ! [ -f "@abs_srcdir@/src/port/port" ]
then
echo "please build MacPorts before running this script!" 1>&2
exit 1
elif [ -z "@SANDBOX_EXEC@" ]
then
exec "@INTREE_TCLSH@" "@abs_srcdir@/src/port/port" "$@"
else
exec "@SANDBOX_EXEC@" -p "$sandbox_profile" \
"@INTREE_TCLSH@" "@abs_srcdir@/src/port/port" "$@"
fi
2 changes: 1 addition & 1 deletion src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ TCLPKG= cregistry \
SUBDIR= compat ${TCLPKG} port programs

ifeq (@TRACEMODE_SUPPORT@,1)
TCLPKG+= darwintracelib1.0
TCLPKG+= darwintrace1.0
endif

all::
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions src/macports1.0/macports.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,7 @@ match macports.conf.default."
USER GROUP LANG
http_proxy HTTPS_PROXY FTP_PROXY ALL_PROXY NO_PROXY
COLUMNS LINES
TCLLIBPATH TCL_LIBRARY
}
if {[info exists extra_env]} {
set keepenvkeys [concat $keepenvkeys $extra_env]
Expand Down
2 changes: 1 addition & 1 deletion src/pextlib1.0/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ INSTALLDIR= ${TCL_PACKAGE_PATH}/pextlib1.0
include $(srcdir)/../../Mk/macports.tea.mk

# tracelib.o has an additional dependency
tracelib.o: ../darwintracelib1.0/sandbox_actions.h
tracelib.o: ../darwintrace1.0/sandbox_actions.h

CFLAGS+= ${CURL_CFLAGS} ${MD5_CFLAGS} ${READLINE_CFLAGS}
LIBS+= ${CURL_LIBS} ${MD5_LIBS} ${READLINE_LIBS}
Expand Down
2 changes: 1 addition & 1 deletion src/pextlib1.0/tracelib.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
#include <cregistry/portgroup.h>
#include <cregistry/entry.h>
#include <registry2.0/registry.h>
#include <darwintracelib1.0/sandbox_actions.h>
#include <darwintrace1.0/sandbox_actions.h>

#if defined(LOCAL_PEERPID) && defined(HAVE_LIBPROC_H)
#include <libproc.h>
Expand Down
18 changes: 17 additions & 1 deletion src/port1.0/portsandbox.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ default portsandbox_profile {}
# sandbox-exec -p '(version 1) (allow default) (deny file-write*) (allow file-write* <filter>)' some-command
proc portsandbox::set_profile {target} {
global os.major portsandbox_profile workpath distpath \
package.destpath configure.ccache ccache_dir \
package.destpath configure.ccache ccache_dir env \
sandbox_network configure.distcc porttrace prefix_frozen

switch $target {
Expand Down Expand Up @@ -101,6 +101,22 @@ proc portsandbox::set_profile {target} {
lappend perms file-write-setugid
}

if {[info exists env(TCL_LIBRARY)]} {
ui_debug "adding ${env(TCL_LIBRARY)} to allowed Sandbox paths"
append portsandbox_profile "\
(allow file-read* (subpath \"${env(TCL_LIBRARY)}\"))
"
}


if {[info exists env(TCLLIBPATH)]} {
foreach libpath $env(TCLLIBPATH) {
ui_debug "adding ${libpath} to allowed Sandbox paths"
append portsandbox_profile "\
(allow file-read* (subpath \"${libpath}\"))
"
}
}
# If ${prefix} is on its own volume, grant access to its
# temporary items directory, used by Xcode tools
if {[catch {get_mountpoint ${prefix_frozen}} mountpoint]} {
Expand Down
3 changes: 2 additions & 1 deletion src/port1.0/porttrace.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ namespace eval porttrace {
create_slave $workpath $fifo

# Launch darwintrace.dylib.
set darwintracepath [file join ${portutil::autoconf::tcl_package_path} darwintrace1.0 darwintrace.dylib]
set pkgdir [file dirname [file dirname [dict get [info frame -1] file]]]
set darwintracepath [file join ${pkgdir} darwintrace1.0 darwintrace.dylib]

# Add darwintrace.dylib as last entry in DYLD_INSERT_LIBRARIES
if {[info exists env(DYLD_INSERT_LIBRARIES)] && [string length $env(DYLD_INSERT_LIBRARIES)] > 0} {
Expand Down