source: trunk/base/Makefile.in @ 117621

Last change on this file since 117621 was 117621, checked in by cal@…, 6 years ago

macports: use a local copy of Tcl 8.5, mostly fix out-of-source build (#28001)

This change switches MacPorts to a private copy of Tcl 8.5 that will be extracted, configured, built
and installed along with MacPorts. This will allow us to drop Tcl 8.4-compatibility for older OS
releases that didn't ship Tcl 8.5 and is an important step towards Tcl 8.6 compatibility.

Most of the changes to make this happen were in aclocal.m4 (where I re-implemented a custom version
of AC_CONFIG_SUBDIRS similar to what was proposed upstream in
http://lists.gnu.org/archive/html/autoconf/2011-04/msg00000.html but never actually merged),
configure.ac and the vendor directory.

Since we want to build MacPorts against the headers of our custom Tcl, this change also required
adjusting Mk/macports.autoconf.mk.in to pass the correct path to the headers. However, we cannot use
the build directory containing the public headers, because this directory is also clobbered with
other headers such as regex.h, breaking the build later on when this file is included in pextlib1.0.
Fortunately, the Tcl autoconf macros take care of all the other details required to build against
a private Tcl.

Not having the blessed copy of Tcl around during configure lead to some other difficulties such as
the MP_TCL_PLATFORM macro, which uses $TCLSH to read the $tcl_platform variable. I have
re-implemented this as MP_PLATFORM using uname in the same way as the $tcl_platform variable is set
up in the Tcl source code.

Besides a standard Tcl distribution, this change also installs the Tcl Thread package (required for
trace mode) and Tcllib, a package containing various helpful modules for Tcl (such as an
8.6-compatible try implementation). It also drops support for the Tcl sqlite3 extension that is
present on OS X and was previously picked up by configure, but isn't used in the source.

While I was refactoring the build system I also mostly fixed out-of-source builds (see #28001,
caused all Makefile -> Makefile.in moves). The remaining issue is that the pkgIndex.tcl files
generated by pkg_mkIndex only list the files present in the build directory (i.e. all files that
have been re-inplaced or built from source), but not those from the source directory. That currently
causes the Tcl scripts in the install target to fail.

I also unified indentation in aclocal.m4.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.2 KB
Line 
1# $Id: Makefile.in 117621 2014-03-05 22:19:14Z cal@macports.org $
2
3srcdir      = @srcdir@
4VPATH       = @srcdir@
5
6PATH            = @PATH_CLEANED@
7SUBDIR          = vendor doc src tests
8DISTDIR         = dist
9DISTVER         =
10DISTTAG         = release_${subst .,_,${DISTVER}}
11DISTNAME        = MacPorts-${DISTVER}
12DISTARCTAG      = ${DISTTAG}-archive
13DISTARCNAME     = ${DISTNAME}-archive
14SVNURL          = https://svn.macports.org/repository/macports
15
16
17include Mk/macports.autoconf.mk
18
19
20all:: Mk/macports.autoconf.mk
21
22Mk/macports.autoconf.mk: Mk/macports.autoconf.mk.in src/config.h.in Makefile.in config.status
23        ./config.status
24        ${MAKE} clean
25
26config.status: configure
27        @if test -f ./config.status ; then      \
28                set -x ;                                                \
29                ./config.status --recheck ;             \
30        else                                                            \
31                set -x ;                                                \
32                echo "Source tree not configured. Use ./configure" ; \
33        fi
34
35include $(srcdir)/Mk/macports.subdir.mk
36
37install::
38        [ ! -f "$(DESTDIR)${sysconfdir}/macports/mp_version" ] || rm -vf "$(DESTDIR)${sysconfdir}/macports/mp_version"
39        $(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} "$(DESTDIR)${datadir}/macports/"
40        $(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 setupenv.bash  "$(DESTDIR)${datadir}/macports/"
41        $(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 $(srcdir)/macports-pubkey.pem  "$(DESTDIR)${datadir}/macports/"
42# Only run these scripts when not building in a destroot
43ifeq ($(DESTDIR),)
44# create run user if it doesn't exist
45        @if test -n "${DSCL}" -a -n "${DSEDITGROUP}" ; then \
46        if ! ${DSCL} -q . -read /Groups/${RUNUSR} > /dev/null 2>&1 ; then \
47            if test `id -u` -eq 0; then \
48                echo "Creating group \"${RUNUSR}\"" ; \
49                ${DSEDITGROUP} -q -o create ${RUNUSR} ; \
50            else \
51                echo "Not creating group \"${RUNUSR}\" (not root)" ; \
52            fi ; \
53        fi ; \
54        if ! ${DSCL} -q . -list /Users/${RUNUSR} > /dev/null 2>&1 ; then \
55            if test `id -u` -eq 0; then \
56                echo "Creating user \"${RUNUSR}\"" ; \
57                NEXTUID=501; \
58                while test -n "`${DSCL} -q /Search -search /Users UniqueID $$NEXTUID`"; do \
59                    let "NEXTUID=NEXTUID+1"; \
60                done; \
61                ${DSCL} -q . -create /Users/${RUNUSR} UniqueID $$NEXTUID ; \
62                \
63                ${DSCL} -q . -delete /Users/${RUNUSR} AuthenticationAuthority ; \
64                ${DSCL} -q . -delete /Users/${RUNUSR} PasswordPolicyOptions ; \
65                ${DSCL} -q . -delete /Users/${RUNUSR} dsAttrTypeNative:KerberosKeys ; \
66                ${DSCL} -q . -delete /Users/${RUNUSR} dsAttrTypeNative:ShadowHashData ; \
67                \
68                ${DSCL} -q . -create /Users/${RUNUSR} RealName MacPorts ; \
69                ${DSCL} -q . -create /Users/${RUNUSR} Password \* ; \
70                ${DSCL} -q . -create /Users/${RUNUSR} PrimaryGroupID $$(${DSCL} -q . -read /Groups/${RUNUSR} PrimaryGroupID | /usr/bin/awk '{print $$2}') ; \
71                ${DSCL} -q . -create /Users/${RUNUSR} NFSHomeDirectory "${localstatedir}/macports/home" ; \
72                ${DSCL} -q . -create /Users/${RUNUSR} UserShell /usr/bin/false ; \
73            else \
74                echo "Not creating user \"${RUNUSR}\" (not root)" ; \
75            fi ; \
76        fi ; \
77        if test "$$(${DSCL} -q . -read /Users/${RUNUSR} NFSHomeDirectory)" = "NFSHomeDirectory: /var/empty" ; then \
78            if test `id -u` -eq 0; then \
79                echo "Updating home directory location for user \"${RUNUSR}\"" ; \
80                ${DSCL} -q . -create /Users/${RUNUSR} NFSHomeDirectory "${localstatedir}/macports/home" ; \
81            else \
82                echo "Not updating home directory location for user \"${RUNUSR}\" (not root)" ; \
83            fi ; \
84        fi ; \
85        if test `sw_vers -productVersion | /usr/bin/awk -F . '{print $$2}'` -eq 4 -a `id -u` -eq 0; then \
86            GID=`${DSCL} -q . -read /Groups/${RUNUSR} PrimaryGroupID | /usr/bin/awk '{print $$2}'` ; \
87            if test "`${DSCL} -q . -read /Users/${RUNUSR} PrimaryGroupID 2>/dev/null | /usr/bin/awk '{print $$2}'`" != "$$GID"; then \
88                echo "Fixing PrimaryGroupID for user \"${RUNUSR}\"" ; \
89                ${DSCL} -q . -create /Users/${RUNUSR} PrimaryGroupID $$GID ; \
90                ${DSCL} -q . -create /Users/${RUNUSR} RealName MacPorts ; \
91            fi ; \
92        fi ; \
93    else \
94        echo "Can't find ${DSCL} / ${DSEDITGROUP}, not creating user \"${RUNUSR}\"" ; \
95    fi
96# Add [default] tag to the central MacPorts repository, if it isn't already
97        $(TCLSH) $(srcdir)/src/upgrade_sources_conf_default.tcl "${prefix}"
98# Convert image directories (and direct mode installs) to image archives
99        $(TCLSH) $(srcdir)/src/images_to_archives.tcl "${macports_tcl_dir}"
100        $(TCLSH) $(srcdir)/src/dedup_portfiles.tcl "${macports_tcl_dir}"
101endif
102ifndef SELFUPDATING
103        @echo ""; echo "Congratulations, you have successfully installed the MacPorts system. To get the Portfiles and update the system, add ${prefix}/bin to your PATH and run:"; echo ""
104        @echo "sudo port -v selfupdate"; echo ""
105        @echo "Please read \"man port\", the MacPorts guide at http://guide.macports.org/ and Wiki at https://trac.macports.org/ for full documentation."; echo ""
106else
107        @echo ""; echo "Congratulations, you have successfully upgraded the MacPorts system."; echo ""
108endif
109
110group::
111        @echo "creating a macports group..." && sudo dseditgroup -o create -n . macports && echo "done! use './configure --with-install-group=macports --with-shared-directory' if you haven't already"
112
113rmgroup::
114        @echo "deleting macports group..." && sudo dseditgroup -o delete -n . macports && echo "done! use 'make group' to re-create"
115
116
117clean::
118
119distclean::
120        rm -f config.log config.status configure.lineno
121        rm -rf autom4te.cache ${DISTDIR}
122        rm -f Makefile Mk/macports.autoconf.mk portmgr/freebsd/Makefile
123        rm -f Doxyfile
124        rm -f setupenv.bash
125
126_gettag:
127        cd ${DISTDIR}; svn co ${SVNURL}/tags/${SVNTAG} ${PKGNAME}-svn
128
129_pkgdist:
130        [ ! -d ${DISTDIR}/${PKGNAME} ] || rm -rf ${DISTDIR}/${PKGNAME}
131        cd ${DISTDIR}; svn export ${PKGNAME}-svn ${PKGNAME}
132        cd ${DISTDIR}; COPY_EXTENDED_ATTRIBUTES_DISABLE=true tar -c ${PKGNAME} | gzip > ${PKGNAME}.tar.gz
133        cd ${DISTDIR}; COPY_EXTENDED_ATTRIBUTES_DISABLE=true tar -c ${PKGNAME} | bzip2 > ${PKGNAME}.tar.bz2
134        cd ${DISTDIR}; for tarball in ${PKGNAME}.tar.*; do { \
135                for type in -md5 -sha1 -ripemd160 -sha256; do { \
136                        openssl dgst $$type $$tarball; \
137                }; done >> ${DISTNAME}.chk.txt; \
138        }; done
139
140_dopkg: _gettag _pkgdist
141
142# This target fetches a tagged distribution from svn, and generates tarballs and checksums for it
143distfromsvn:
144        @[ -n "${DISTVER}" ] || { echo Must specify DISTVER, like: make DISTVER=1.4.0 distfromsvn; exit 1; }
145        [ -d ${DISTDIR} ] || mkdir ${DISTDIR}
146        rm -f ${DISTDIR}/${DISTNAME}.chk.txt
147        ${MAKE} SVNTAG=${DISTTAG}/base/ PKGNAME=${DISTNAME} _dopkg
148ifeq ($(ARC),yes)
149        ${MAKE} SVNTAG=${DISTARCTAG} PKGNAME=${DISTARCNAME} _dopkg
150endif
151
152tcldoc:
153        @[ -e "${prefix}/bin/tcldoc" ] \
154                || { echo "Install tcldoc with MacPorts in ${prefix} first."; exit 1; }
155        find src -name '*.tcl' | xargs ${TCLDOC} --verbose --title "MacPorts Documentation" --force tcldoc
156
157tcldox:
158        @[ -e "${prefix}/bin/doxygen" -a -e "${prefix}/bin/tcl-dox" -a -e "${prefix}/bin/dot" ] \
159                || { echo "Install doxygen, tcl-dox and graphviz with MacPorts in ${prefix} first."; exit 1; }
160        ${prefix}/bin/doxygen
161
162test::
163
164.PHONY: dist _gettag _pkgdist _dopkg tcldoc tcldox
Note: See TracBrowser for help on using the repository browser.