Tcl Source Code

Artifact [0840918be8]
Login

Artifact 0840918be8abfad945bbcb94779a1bf65705f8bc:

Attachment "1163496.patch" to ticket [1163406fff] added by dgp 2008-12-17 22:33:28.
Index: unix/Makefile.in
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/Makefile.in,v
retrieving revision 1.249
diff -u -r1.249 Makefile.in
--- unix/Makefile.in	11 Dec 2008 01:21:52 -0000	1.249
+++ unix/Makefile.in	17 Dec 2008 15:28:02 -0000
@@ -218,7 +218,7 @@
 RANLIB			= @RANLIB@
 DTRACE			= @DTRACE@
 SRC_DIR			= @srcdir@
-TOP_DIR			= $(SRC_DIR)/..
+TOP_DIR			= @TCL_SRC_DIR@
 BUILD_DIR		= @builddir@
 GENERIC_DIR		= $(TOP_DIR)/generic
 TOMMATH_DIR		= $(TOP_DIR)/libtommath
@@ -226,6 +226,7 @@
 TOOL_DIR		= $(TOP_DIR)/tools
 UNIX_DIR		= $(TOP_DIR)/unix
 MAC_OSX_DIR		= $(TOP_DIR)/macosx
+PKGS_DIR		= $(TOP_DIR)/pkgs
 # Must be absolute because of the cd dltest $(DLTEST_DIR)/configure below.
 DLTEST_DIR		= @TCL_SRC_DIR@/unix/dltest
 # Must be absolute to so the corresponding tcltest's tcl_library is absolute.
@@ -555,7 +556,7 @@
 SRCS = $(GENERIC_SRCS) $(TOMMATH_SRCS) $(UNIX_SRCS) $(NOTIFY_SRCS) \
 	$(STUB_SRCS) @PLAT_SRCS@
 
-all: binaries libraries doc
+all: binaries libraries doc packages
 
 binaries: ${LIB_FILE} $(STUB_LIB_FILE) $(TCL_BUILD_EXP_FILE) tclsh
 
@@ -592,6 +593,8 @@
 # tcltest executable gets the build directory burned into its ld search path.
 # This keeps tcltest from picking up an already installed version of the Tcl
 # library.
+SHELL_ENV =	@LD_LIBRARY_PATH_VAR@=`pwd`:${@LD_LIBRARY_PATH_VAR@} \
+		TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"
 
 tcltest: ${TCLTEST_OBJS} ${TCL_LIB_FILE} ${BUILD_DLTEST}
 	$(MAKE) tcltest-real LIB_RUNTIME_DIR="`pwd`"
@@ -608,10 +611,8 @@
 # tcltest, ie:
 #	% make test TESTFLAGS="-verbose bps -file fileName.test"
 
-test: tcltest
-	@LD_LIBRARY_PATH_VAR@="`pwd`:$${@LD_LIBRARY_PATH_VAR@}"; export @LD_LIBRARY_PATH_VAR@; \
-	TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
-	./tcltest $(TOP_DIR)/tests/all.tcl $(TESTFLAGS)
+test: tcltest test-packages
+	$(SHELL_ENV) ./tcltest $(TOP_DIR)/tests/all.tcl $(TESTFLAGS)
 
 gdb-test: tcltest
 	@echo "set env @LD_LIBRARY_PATH_VAR@=\"`pwd`:$${@LD_LIBRARY_PATH_VAR@}\"" > gdb.run
@@ -622,49 +623,33 @@
 
 # Useful target to launch a built tcltest with the proper path,...
 runtest: tcltest
-	@LD_LIBRARY_PATH_VAR@="`pwd`:$${@LD_LIBRARY_PATH_VAR@}"; export @LD_LIBRARY_PATH_VAR@; \
-	TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
-	./tcltest
+	$(SHELL_ENV) ./tcltest
 
 # Useful target for running the test suite with an unwritable current
 # directory...
 ro-test: tcltest
-	@LD_LIBRARY_PATH_VAR@="`pwd`:$${@LD_LIBRARY_PATH_VAR@}"; export @LD_LIBRARY_PATH_VAR@; \
-	TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
-	echo 'exec chmod -w .;package require tcltest;tcltest::temporaryDirectory /tmp;source ../tests/all.tcl;exec chmod +w .' | ./tcltest
+	echo 'exec chmod -w .;package require tcltest;tcltest::temporaryDirectory /tmp;source ../tests/all.tcl;exec chmod +w .' | $(SHELL_ENV) ./tcltest
 
 # This target can be used to run tclsh from the build directory
 # via `make shell SCRIPT=/tmp/foo.tcl`
 shell: tclsh
-	@LD_LIBRARY_PATH_VAR@="`pwd`:$${@LD_LIBRARY_PATH_VAR@}"; export @LD_LIBRARY_PATH_VAR@; \
-	TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
-	./tclsh $(SCRIPT)
+	$(SHELL_ENV) ./tclsh $(SCRIPT)
 
 # This target can be used to run tclsh inside either gdb or insight
 gdb: tclsh
-	@echo "set env @LD_LIBRARY_PATH_VAR@=\"`pwd`:$${@LD_LIBRARY_PATH_VAR@}\"" > gdb.run
-	@echo "set env TCL_LIBRARY=${TCL_BUILDTIME_LIBRARY}" >> gdb.run
-	$(GDB) ./tclsh --command=gdb.run
-	rm gdb.run
+	$(SHELL_ENV) $(GDB) ./tclsh
 
 # This target can be used to run tclsh inside ddd
 ddd: tclsh
-	@echo "set env @LD_LIBRARY_PATH_VAR@=\"`pwd`:$${@LD_LIBRARY_PATH_VAR@}\"" > gdb.run
-	@echo "set env TCL_LIBRARY=${TCL_BUILDTIME_LIBRARY}" >> gdb.run
-	$(DDD) -command=gdb.run ./tclsh
-	rm gdb.run
+	$(SHELL_ENV) $(DDD) ./tclsh
 
 VALGRINDARGS=--tool=memcheck --num-callers=8 --leak-resolution=high --leak-check=yes --show-reachable=yes -v
 
 valgrind: tclsh tcltest
-	@LD_LIBRARY_PATH_VAR@="`pwd`:$${@LD_LIBRARY_PATH_VAR@}"; export @LD_LIBRARY_PATH_VAR@; \
-	TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
-	valgrind $(VALGRINDARGS) ./tcltest $(TOP_DIR)/tests/all.tcl -singleproc 1 $(TESTFLAGS)
+	$(SHELL_ENV) valgrind $(VALGRINDARGS) ./tcltest $(TOP_DIR)/tests/all.tcl -singleproc 1 $(TESTFLAGS)
 
 valgrindshell: tclsh
-	@LD_LIBRARY_PATH_VAR@="`pwd`:$${@LD_LIBRARY_PATH_VAR@}"; export @LD_LIBRARY_PATH_VAR@; \
-	TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
-	valgrind $(VALGRINDARGS) ./tclsh $(SCRIPT)
+	$(SHELL_ENV) valgrind $(VALGRINDARGS) ./tclsh $(SCRIPT)
 
 # The following target outputs the name of the top-level source directory for
 # Tcl (it is used by Tk's configure script, for example). The .NO_PARALLEL
@@ -716,7 +701,7 @@
 dltest.marker: ${STUB_LIB_FILE}
 	cd dltest ; $(MAKE)
 
-INSTALL_TARGETS = install-binaries install-libraries install-doc @EXTRA_INSTALL@
+INSTALL_TARGETS = install-binaries install-libraries install-doc install-packages @EXTRA_INSTALL@
 
 install: $(INSTALL_TARGETS)
 
@@ -902,12 +887,12 @@
 #tclConfig.h: $(UNIX_DIR)/tclConfig.h.in
 #	$(SHELL) config.status
 
-clean:
+clean: clean-packages
 	rm -f *.a *.o libtcl* core errs *~ \#* TAGS *.E a.out \
 		errors tclsh tcltest lib.exp Tcl @DTRACE_HDR@
 	cd dltest ; $(MAKE) clean
 
-distclean: clean
+distclean: distclean-packages clean
 	rm -rf Makefile config.status config.cache config.log tclConfig.sh \
 		$(PACKAGE).* prototype tclConfig.h *.plist Tcl.framework
 	cd dltest ; $(MAKE) distclean
@@ -1568,6 +1553,83 @@
 .c.o:
 	$(CC) -c $(CC_SWITCHES) $<
 
+
+#
+# Bundled Package targets
+#
+
+# somehow we need to propagate configure args like --enable-64bit
+PKG_CFG_ARGS   =	@PKG_CFG_ARGS@
+PKG_DIR                = ./pkgs
+
+packages:
+	@builddir=`pwd`; \
+	for i in $(PKGS_DIR)/*; do \
+	  if [ -d $$i ]; then \
+	    if [ -x $$i/configure ]; then \
+	        pkg=`basename $$i`; \
+	        echo "Building package '$$pkg'"; \
+	        mkdir -p $(PKG_DIR)/$$pkg; \
+	        if [ ! -f $(PKG_DIR)/$$pkg/Makefile ]; then \
+	            ( cd $(PKG_DIR)/$$pkg; \
+	              $$i/configure --with-tcl=$(PWD) --with-tclinclude=$(GENERIC_DIR) $(PKG_CFG_ARGS) --enable-shared --enable-threads; ) \
+	        fi; \
+	        ( cd $(PKG_DIR)/$$pkg; $(MAKE); ) \
+	    fi; \
+	  fi; \
+	done; \
+	cd $$builddir
+
+install-packages: packages
+	@builddir=`pwd`; \
+	for i in $(PKGS_DIR)/*; do \
+	  if [ -d $$i ]; then \
+	    pkg=`basename $$i`; \
+	    if [ -f $(PKG_DIR)/$$pkg/Makefile ]; then \
+	        echo "Installing package '$$pkg'"; \
+	        ( cd $(PKG_DIR)/$$pkg; $(MAKE) install "DESTDIR=$(INSTALL_ROOT)"; ) \
+	    fi; \
+	  fi; \
+	done; \
+	cd $$builddir
+
+test-packages: tcltest packages
+	@builddir=`pwd`; \
+	for i in $(PKGS_DIR)/*; do \
+	  if [ -d $$i ]; then \
+	    pkg=`basename $$i`; \
+	    if [ -f $(PKG_DIR)/$$pkg/Makefile ]; then \
+	        echo "Testing package '$$pkg'"; \
+	        ( cd $(PKG_DIR)/$$pkg; $(MAKE) "LD_LIBRARY_PATH=$$builddir:${LD_LIBRARY_PATH}" "TCL_LIBRARY=${TCL_BUILDTIME_LIBRARY}" "TCLLIBPATH=$$builddir/pkgs" test "TCLSH_PROG=$$builddir/tcltest"; ) \
+	    fi; \
+	  fi; \
+	done; \
+	cd $$builddir
+
+clean-packages:
+	@builddir=`pwd`; \
+	for i in $(PKGS_DIR)/*; do \
+	  if [ -d $$i ]; then \
+	    pkg=`basename $$i`; \
+	    if [ -f $(PKG_DIR)/$$pkg/Makefile ]; then \
+	        ( cd $(PKG_DIR)/$$pkg; $(MAKE) clean; ) \
+	    fi; \
+	  fi; \
+	done; \
+	cd $$builddir
+
+distclean-packages:
+	@builddir=`pwd`; \
+	for i in $(PKGS_DIR)/*; do \
+	  if [ -d $$i ]; then \
+	    pkg=`basename $$i`; \
+	    if [ -f $(PKG_DIR)/$$pkg/Makefile ]; then \
+	        ( cd $(PKG_DIR)/$$pkg; $(MAKE) distclean; ) \
+	    fi; \
+	  fi; \
+	done; \
+	cd $$builddir
+
 #
 # Target to regenerate header files and stub files from the *.decls tables.
 #
Index: unix/configure.in
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/configure.in,v
retrieving revision 1.195
diff -u -r1.195 configure.in
--- unix/configure.in	14 Dec 2008 13:32:11 -0000	1.195
+++ unix/configure.in	17 Dec 2008 15:28:02 -0000
@@ -30,6 +30,8 @@
 TCL_PATCH_LEVEL="a4"
 VERSION=${TCL_VERSION}
 
+PKG_CFG_ARGS=$@
+
 #------------------------------------------------------------------------
 # Handle the --prefix=... option
 #------------------------------------------------------------------------
@@ -854,6 +856,7 @@
 AC_SUBST(TCL_MINOR_VERSION)
 AC_SUBST(TCL_PATCH_LEVEL)
 AC_SUBST(TCL_YEAR)
+AC_SUBST(PKG_CFG_ARGS)
 
 AC_SUBST(TCL_LIB_FILE)
 AC_SUBST(TCL_LIB_FLAG)