source: trunk/base/Makefile.in @ 92404

Last change on this file since 92404 was 90002, checked in by jmr@…, 9 years ago

update home dir for $RUNUSR in postflight script, use localstatedir variable

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