| 1 | # $Id$ |
|---|
| 2 | |
|---|
| 3 | SUBDIR = config doc src |
|---|
| 4 | DISTDIR = dist |
|---|
| 5 | DISTVER = |
|---|
| 6 | DISTTAG = release_${subst .,_,${DISTVER}} |
|---|
| 7 | DISTNAME = MacPorts-${DISTVER} |
|---|
| 8 | DISTARCTAG = ${DISTTAG}-archive |
|---|
| 9 | DISTARCNAME = ${DISTNAME}-archive |
|---|
| 10 | SVNURL = http://svn.macports.org/repository/macports |
|---|
| 11 | |
|---|
| 12 | include Mk/macports.autoconf.mk |
|---|
| 13 | |
|---|
| 14 | all:: Mk/macports.autoconf.mk |
|---|
| 15 | |
|---|
| 16 | Mk/macports.autoconf.mk: Mk/macports.autoconf.mk.in src/config.h.in Makefile.in config.status |
|---|
| 17 | ./config.status |
|---|
| 18 | make clean |
|---|
| 19 | |
|---|
| 20 | config.status: configure |
|---|
| 21 | @if test -f ./config.status ; then \ |
|---|
| 22 | set -x ; \ |
|---|
| 23 | ./config.status --recheck ; \ |
|---|
| 24 | else \ |
|---|
| 25 | set -x ; \ |
|---|
| 26 | echo "Source tree not configured. Use ./configure" ; \ |
|---|
| 27 | fi |
|---|
| 28 | |
|---|
| 29 | upgrade: |
|---|
| 30 | @echo -e "\nUpgrading your existing MacPorts installation to the new layout:\n" |
|---|
| 31 | |
|---|
| 32 | # We can safely delete the ${TCL_PACKAGE_DIR}/darwinports1.0 dir as files in it are always overwritten and will now be installed onto |
|---|
| 33 | # ${TCL_PACKAGE_DIR}/macports1.0 with new names: |
|---|
| 34 | [ ! -d ${TCL_PACKAGE_DIR}/darwinports1.0 ] || rm -rf ${TCL_PACKAGE_DIR}/darwinports1.0 |
|---|
| 35 | |
|---|
| 36 | # MacPorts base files in ${datadir} are also safely removed as new ones are always installed, and onto a their new location in this case too: |
|---|
| 37 | [ ! -d ${datadir}/darwinports ] || rm -rf ${datadir}/darwinports |
|---|
| 38 | |
|---|
| 39 | # Old version file can be safely deleted, as it was already used to start this upgrade and a new one will be installed into the new location: |
|---|
| 40 | [ ! -f ${sysconfdir}/ports/dp_version ] || rm -vf ${sysconfdir}/ports/dp_version |
|---|
| 41 | |
|---|
| 42 | # Old ports.conf(5) man page is removed: |
|---|
| 43 | [ ! -f ${prefix}/share/man/man5/ports.conf.5 ] || rm -vf ${prefix}/share/man/man5/ports.conf.5 |
|---|
| 44 | |
|---|
| 45 | # Conf files directory is renamed: |
|---|
| 46 | [ ! -d ${sysconfdir}/ports ] || mv -v ${sysconfdir}/ports ${sysconfdir}/macports |
|---|
| 47 | |
|---|
| 48 | # Important directories inside ${localstatedir}/db/dports are moved to their new location, creating it first: |
|---|
| 49 | [ -d ${localstatedir}/macports ] || mkdir -vp ${localstatedir}/macports |
|---|
| 50 | for dir in distfiles packages receipts software; do \ |
|---|
| 51 | [ ! -d ${localstatedir}/db/dports/$${dir} ] || mv -v ${localstatedir}/db/dports/$${dir} ${localstatedir}/macports ; \ |
|---|
| 52 | done |
|---|
| 53 | |
|---|
| 54 | # Move the default ports tree to the new layout: |
|---|
| 55 | [ ! -d ${localstatedir}/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports ] || { mkdir -vp \ |
|---|
| 56 | ${localstatedir}/macports/sources/rsync.macports.org/release && mv -v \ |
|---|
| 57 | ${localstatedir}/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports ${localstatedir}/macports/sources/rsync.macports.org/release/ports ; } |
|---|
| 58 | |
|---|
| 59 | # Open up receipts and upgrade any paths in them containing old conventions to the new namespace: |
|---|
| 60 | for receipt in ${localstatedir}/macports/receipts/*/*/receipt.bz2 ; do [ ! \( -f $${receipt} -a ! -f $${receipt}.mpsaved \) ] || { \ |
|---|
| 61 | cp -v $${receipt} $${receipt}.mpsaved && { \ |
|---|
| 62 | $(BZIP2) -q -dc $${receipt} | sed 's/db\/dports/macports/g' | $(BZIP2) -q -zf > $${receipt}.new ; \ |
|---|
| 63 | } && mv -v $${receipt}.new $${receipt} ; \ |
|---|
| 64 | }; done |
|---|
| 65 | |
|---|
| 66 | # Check for existance of the main configuration file and perform a couple of replacements on it, backing it up first: |
|---|
| 67 | ## 1) new default path up to our configuration files (referenced through other variables); |
|---|
| 68 | ## 2) new default value for the portdbpath variable; |
|---|
| 69 | ## 3) new MacPorts rsync server; |
|---|
| 70 | ## 4) new default value for the base tree; |
|---|
| 71 | ## 5) new default value for trunk's base sources for users who have it (some do); |
|---|
| 72 | ## 6) stray quotes are removed from the value of the rsync_options key in old conf files; |
|---|
| 73 | ## 7) references to the old ports.conf(5) man page are updated to the new macports.conf(5) page; |
|---|
| 74 | ## 8) finally, move remaining instances of any form of our new name (which by this time should only remain in comments, if at all) to our new name. |
|---|
| 75 | [ ! \( -f ${sysconfdir}/macports/ports.conf -a ! -f ${sysconfdir}/macports/macports.conf.mpsaved \) ] || { \ |
|---|
| 76 | mv -v ${sysconfdir}/macports/ports.conf ${sysconfdir}/macports/macports.conf.mpsaved; \ |
|---|
| 77 | sed 's/etc\/ports/etc\/macports/g' ${sysconfdir}/macports/macports.conf.mpsaved > ${sysconfdir}/macports/macports.conf.tmp && \ |
|---|
| 78 | mv -v ${sysconfdir}/macports/macports.conf.tmp ${sysconfdir}/macports/macports.conf; \ |
|---|
| 79 | sed 's/db\/dports/macports/g' ${sysconfdir}/macports/macports.conf > ${sysconfdir}/macports/macports.conf.tmp && \ |
|---|
| 80 | mv -v ${sysconfdir}/macports/macports.conf.tmp ${sysconfdir}/macports/macports.conf; \ |
|---|
| 81 | sed 's/darwinports/macports/g' ${sysconfdir}/macports/macports.conf > ${sysconfdir}/macports/macports.conf.tmp && \ |
|---|
| 82 | mv -v ${sysconfdir}/macports/macports.conf.tmp ${sysconfdir}/macports/macports.conf; \ |
|---|
| 83 | sed 's/dpupdate1\/base/release\/base/g' ${sysconfdir}/macports/macports.conf > ${sysconfdir}/macports/macports.conf.tmp && \ |
|---|
| 84 | mv -v ${sysconfdir}/macports/macports.conf.tmp ${sysconfdir}/macports/macports.conf; \ |
|---|
| 85 | sed 's/dpupdate\/base\/\{0,1\}/trunk\/base\//g' ${sysconfdir}/macports/macports.conf > ${sysconfdir}/macports/macports.conf.tmp && \ |
|---|
| 86 | mv -v ${sysconfdir}/macports/macports.conf.tmp ${sysconfdir}/macports/macports.conf; \ |
|---|
| 87 | sed '/^rsync_options/s/"\(.*\)"/\1/' ${sysconfdir}/macports/macports.conf > ${sysconfdir}/macports/macports.conf.tmp && \ |
|---|
| 88 | mv -v ${sysconfdir}/macports/macports.conf.tmp ${sysconfdir}/macports/macports.conf; \ |
|---|
| 89 | sed 's/ ports.conf(5)/ macports.conf(5)/g' ${sysconfdir}/macports/macports.conf > ${sysconfdir}/macports/macports.conf.tmp && \ |
|---|
| 90 | mv -v ${sysconfdir}/macports/macports.conf.tmp ${sysconfdir}/macports/macports.conf; \ |
|---|
| 91 | sed 's/[Dd]\(arwin\)\{0,1\}[Pp]\(orts\)\{0,1\}/MacPorts/g' ${sysconfdir}/macports/macports.conf > ${sysconfdir}/macports/macports.conf.tmp && \ |
|---|
| 92 | mv -v ${sysconfdir}/macports/macports.conf.tmp ${sysconfdir}/macports/macports.conf; \ |
|---|
| 93 | } |
|---|
| 94 | |
|---|
| 95 | # Check for existance of the main sources file and perform a couple of replacements on it, backing it up first: |
|---|
| 96 | ## 1) new MacPorts rsync server; |
|---|
| 97 | ## 2) new default value for the ports tree. |
|---|
| 98 | [ ! \( -f ${sysconfdir}/macports/sources.conf -a ! -f ${sysconfdir}/macports/sources.conf.mpsaved \) ] || { \ |
|---|
| 99 | cp -v ${sysconfdir}/macports/sources.conf ${sysconfdir}/macports/sources.conf.mpsaved; \ |
|---|
| 100 | sed 's/darwinports/macports/g' ${sysconfdir}/macports/sources.conf > ${sysconfdir}/macports/sources.conf.tmp && \ |
|---|
| 101 | mv -v ${sysconfdir}/macports/sources.conf.tmp ${sysconfdir}/macports/sources.conf; \ |
|---|
| 102 | sed 's/dpupdate\/dports/release\/ports\//g' ${sysconfdir}/macports/sources.conf > ${sysconfdir}/macports/sources.conf.tmp && \ |
|---|
| 103 | mv -v ${sysconfdir}/macports/sources.conf.tmp ${sysconfdir}/macports/sources.conf; \ |
|---|
| 104 | } |
|---|
| 105 | |
|---|
| 106 | # Check for existance of a personal configuration file and perform a couple of replacements on it, backing it up first: |
|---|
| 107 | ## 1) new default path up to our configuration files (referenced through other variables); |
|---|
| 108 | ## 2) new default value for the portdbpath variable; |
|---|
| 109 | ## 3) new MacPorts rsync server; |
|---|
| 110 | ## 4) new default value for the base tree; |
|---|
| 111 | ## 5) new default value for trunk's base sources for users who have it (some do); |
|---|
| 112 | ## 6) stray quotes are removed from the value of the rsync_options key in old conf files; |
|---|
| 113 | ## 7) references to the old ports.conf(5) man page are updated to the new macports.conf(5) page; |
|---|
| 114 | ## 8) finally, move remaining instances of any form of our new name (which by this time should only remain in comments, if at all) to our new name. |
|---|
| 115 | [ ! \( -f $${HOME}/.macports/ports.conf -a ! -f $${HOME}/.macports/macports.conf.mpsaved \) ] || { \ |
|---|
| 116 | mv -v $${HOME}/.macports/ports.conf $${HOME}/.macports/macports.conf.mpsaved; \ |
|---|
| 117 | sed 's/etc\/ports/etc\/macports/g' $${HOME}/.macports/macports.conf.mpsaved > $${HOME}/.macports/macports.conf.tmp && \ |
|---|
| 118 | mv -v $${HOME}/.macports/macports.conf.tmp $${HOME}/.macports/macports.conf; \ |
|---|
| 119 | sed 's/db\/dports/macports/g' $${HOME}/.macports/macports.conf > $${HOME}/.macports/macports.conf.tmp && \ |
|---|
| 120 | mv -v $${HOME}/.macports/macports.conf.tmp $${HOME}/.macports/macports.conf; \ |
|---|
| 121 | sed 's/darwinports/macports/g' $${HOME}/.macports/macports.conf > $${HOME}/.macports/macports.conf.tmp && \ |
|---|
| 122 | mv -v $${HOME}/.macports/macports.conf.tmp $${HOME}/.macports/macports.conf; \ |
|---|
| 123 | sed 's/dpupdate1\/base/release\/base/g' $${HOME}/.macports/macports.conf > $${HOME}/.macports/macports.conf.tmp && \ |
|---|
| 124 | mv -v $${HOME}/.macports/macports.conf.tmp $${HOME}/.macports/macports.conf; \ |
|---|
| 125 | sed 's/dpupdate\/base\/\{0,1\}/trunk\/base\//g' $${HOME}/.macports/macports.conf > $${HOME}/.macports/macports.conf.tmp && \ |
|---|
| 126 | mv -v $${HOME}/.macports/macports.conf.tmp $${HOME}/.macports/macports.conf; \ |
|---|
| 127 | sed '/^rsync_options/s/"\(.*\)"/\1/' $${HOME}/.macports/macports.conf > $${HOME}/.macports/macports.conf.tmp && \ |
|---|
| 128 | mv -v $${HOME}/.macports/macports.conf.tmp $${HOME}/.macports/macports.conf; \ |
|---|
| 129 | sed 's/ ports.conf(5)/ macports.conf(5)/g' $${HOME}/.macports/macports.conf > $${HOME}/.macports/macports.conf.tmp && \ |
|---|
| 130 | mv -v $${HOME}/.macports/macports.conf.tmp $${HOME}/.macports/macports.conf; \ |
|---|
| 131 | sed 's/[Dd]\(arwin\)\{0,1\}[Pp]\(orts\)\{0,1\}/MacPorts/g' $${HOME}/.macports/macports.conf > $${HOME}/.macports/macports.conf.tmp && \ |
|---|
| 132 | mv -v $${HOME}/.macports/macports.conf.tmp $${HOME}/.macports/macports.conf; \ |
|---|
| 133 | } |
|---|
| 134 | |
|---|
| 135 | |
|---|
| 136 | #something more? |
|---|
| 137 | |
|---|
| 138 | # Upgrade success announcement (meaning we're done ;): |
|---|
| 139 | @echo -e "\nMacPorts installation successfully upgraded from the old DarwinPorts namespace!\n" |
|---|
| 140 | |
|---|
| 141 | #### |
|---|
| 142 | # NOTES: |
|---|
| 143 | # -) should we use the ${DESTDIR} sandbox? |
|---|
| 144 | # -) should we force moves? |
|---|
| 145 | # -) maybe I can regroup at least some of the sed calls? |
|---|
| 146 | # -) |
|---|
| 147 | #### |
|---|
| 148 | |
|---|
| 149 | install:: upgrade |
|---|
| 150 | |
|---|
| 151 | include Mk/macports.subdir.mk |
|---|
| 152 | |
|---|
| 153 | install:: |
|---|
| 154 | @echo -e "\nCongratulations, you have successfully installed the MacPorts system. To get the Portfiles and update the system, run:\n" |
|---|
| 155 | @echo -e "sudo port selfupdate\n" |
|---|
| 156 | @echo -e "Please read port(1) and the MacPorts Wiki at http://trac.macports.org/ for full documentation.\n" |
|---|
| 157 | @echo -e "Stray sources might have been left in the legacy ${localstatedir}/db/dports directory after this upgrade," |
|---|
| 158 | @echo -e "which moved most of what it could to ${localstatedir}/macports, so you might want to look in the former and cleanup manually.\n" |
|---|
| 159 | |
|---|
| 160 | clean:: |
|---|
| 161 | |
|---|
| 162 | distclean:: |
|---|
| 163 | rm -f config.log config.status configure.lineno |
|---|
| 164 | rm -rf autom4te.cache ${DISTDIR} |
|---|
| 165 | rm -f Makefile Mk/macports.autoconf.mk |
|---|
| 166 | |
|---|
| 167 | _gettag: |
|---|
| 168 | cd ${DISTDIR}; svn co ${SVNURL}/tags/${SVNTAG} ${PKGNAME}-svn |
|---|
| 169 | |
|---|
| 170 | _pkgdist: |
|---|
| 171 | [ ! -d ${DISTDIR}/${PKGNAME} ] || rm -rf ${DISTDIR}/${PKGNAME} |
|---|
| 172 | cd ${DISTDIR}; svn export ${PKGNAME}-svn ${PKGNAME} |
|---|
| 173 | cd ${DISTDIR}; COPY_EXTENDED_ATTRIBUTES_DISABLE=true tar -c ${PKGNAME} | gzip > ${PKGNAME}.tar.gz |
|---|
| 174 | cd ${DISTDIR}; COPY_EXTENDED_ATTRIBUTES_DISABLE=true tar -c ${PKGNAME} | bzip2 > ${PKGNAME}.tar.bz2 |
|---|
| 175 | cd ${DISTDIR}; for type in -md5 -sha1 -ripemd160; do openssl dgst $$type ${PKGNAME}.tar.gz ${PKGNAME}.tar.bz2; done >> ${DISTNAME}.chk.txt |
|---|
| 176 | |
|---|
| 177 | _dopkg: _gettag _pkgdist |
|---|
| 178 | |
|---|
| 179 | # This target fetches a tagged distribution from svn, and generates tarballs and checksums for it |
|---|
| 180 | distfromsvn: |
|---|
| 181 | @[ -n "${DISTVER}" ] || ( echo Must specify DISTVER, like: make DISTVER=1.4.0 dist; exit 1 ) |
|---|
| 182 | [ -d ${DISTDIR} ] || mkdir ${DISTDIR} |
|---|
| 183 | rm -f ${DISTDIR}/${DISTNAME}.chk.txt |
|---|
| 184 | ${MAKE} SVNTAG=${DISTTAG}/base/ PKGNAME=${DISTNAME} _dopkg |
|---|
| 185 | ifeq ($(ARC),yes) |
|---|
| 186 | ${MAKE} SVNTAG=${DISTARCTAG} PKGNAME=${DISTARCNAME} _dopkg |
|---|
| 187 | endif |
|---|
| 188 | |
|---|
| 189 | test:: |
|---|
| 190 | |
|---|
| 191 | .PHONY: dist _gettag _pkgdist _dopkg |
|---|