| Commit | Line | Data |
|---|---|---|
| bfe20b28 | 1 | # $DragonFly: src/nrelease/Makefile,v 1.90 2008/09/01 21:20:30 swildner Exp $ |
| 6ca9a59c | 2 | # |
| 5b22b655 | 3 | |
| 9b29c40a MD |
4 | ######################################################################### |
| 5 | # ENHANCEMENTS # | |
| 6 | ######################################################################### | |
| 7 | ||
| f4ec1279 | 8 | # New method e.g. 'make gui release'. A series of enhancement |
| 9b29c40a MD |
9 | # targes may be specified which set make variables which enhance |
| 10 | # the build in various ways. | |
| 11 | # | |
| b9c3e754 | 12 | gui installer img: |
| 9b29c40a | 13 | |
| 9b29c40a MD |
14 | ######################################################################### |
| 15 | # SETUP # | |
| 16 | ######################################################################### | |
| 17 | ||
| 3fff415b SW |
18 | ISODIR?= /usr/release |
| 19 | ISOROOT?= ${ISODIR}/root | |
| 20 | OBJSYS= ${.OBJDIR}/../sys | |
| 21 | ||
| 5cb6cda9 | 22 | MAKE_JOBS?= $$(sysctl -n hw.ncpu) |
| bfe20b28 SW |
23 | |
| 24 | .if make(gui) | |
| 25 | KERNCONF ?= DFLYLIVE VKERNEL DFLYLIVE-SMP DFLYLIVE-SMP-NOAPIC | |
| 26 | .else | |
| 702a95cc SS |
27 | # XXX makeshift fix to build the right kernel for the (target) architecture |
| 28 | # We should configure this in the platform files somehow | |
| 29 | .if ${MACHINE_ARCH} == "i386" | |
| 1d3eb8c5 | 30 | KERNCONF ?= GENERIC VKERNEL |
| 702a95cc SS |
31 | .else |
| 32 | KERNCONF ?= AMD64_GENERIC | |
| 33 | .endif | |
| bfe20b28 | 34 | .endif |
| 6ca9a59c | 35 | |
| cc224c64 | 36 | PKGSRC_PREFIX?= /usr/pkg |
| bce110a5 | 37 | PKGBIN_PKG_ADD?= ${PKGSRC_PREFIX}/sbin/pkg_add |
| 95b64753 | 38 | PKGBIN_PKG_DELETE?= ${PKGSRC_PREFIX}/sbin/pkg_delete |
| c791834f | 39 | PKGBIN_PKG_ADMIN?= ${PKGSRC_PREFIX}/sbin/pkg_admin |
| bce110a5 MD |
40 | PKGBIN_MKISOFS?= ${PKGSRC_PREFIX}/bin/mkisofs |
| 41 | PKGSRC_PKG_PATH?= ${ISODIR}/packages | |
| af88d908 | 42 | PKGSRC_BOOTSTRAP_URL?= http://avalon.dragonflybsd.org/DragonFly-pkgsrc-packages/i386/1.12.0-RELEASE-BUILD |
| 4b08f3df | 43 | CVSUP_BOOTSTRAP_KIT?= cvsup-bootstrap-20070716 |
| bce110a5 | 44 | |
| cc55a235 SS |
45 | # We use env -i in the chroot, so that environment variables won't |
| 46 | # disturb any (pkgsrc) build. This has happened for TARGET_ARCH, | |
| 47 | # which is used by gmake in completely different context. | |
| e2dbfa0b | 48 | # |
| cc55a235 SS |
49 | CHROOT_CMD?= env -i CCVER=${CCVER:Q} /usr/sbin/chroot ${ISOROOT} sh -c |
| 50 | ||
| 8abe78a1 | 51 | # User may specify extra packages in addition to the defaults |
| 95b64753 | 52 | # |
| 8abe78a1 MD |
53 | PKGSRC_EXTRA_PACKAGES?= |
| 54 | ||
| 55 | # Pkgsrc packages to be built and installed on the release ISO | |
| 56 | # | |
| 57 | PKGSRC_PACKAGES?= pkgtools/pkg_leaves \ | |
| 58 | pkgtools/pkg_tarup \ | |
| 59 | devel/scmgit \ | |
| fbc26094 SW |
60 | net/isc-dhcp4 \ |
| 61 | net/isc-dhcpd4 \ | |
| 8abe78a1 MD |
62 | sysutils/cdrtools \ |
| 63 | ${PKGSRC_EXTRA_PACKAGES} | |
| fbc26094 SW |
64 | |
| 65 | # pkgsrc options to use when building packages | |
| 66 | # | |
| 3fff415b SW |
67 | PKGSRC_OPTIONS+= MAKE_JOBS=${MAKE_JOBS} |
| 68 | PKGSRC_OPTIONS+= WRKOBJDIR=/usr/pkgobj | |
| 9ecb41e5 | 69 | PKGSRC_OPTIONS+= PKG_DEFAULT_OPTIONS='dri inet6' |
| fbc26094 | 70 | .if !make(gui) |
| 9ecb41e5 | 71 | PKGSRC_OPTIONS+= PKG_OPTIONS.scmgit=-scmgit-gui |
| fbc26094 | 72 | .endif |
| 8188de86 | 73 | |
| 95b64753 MD |
74 | # Even though buildiso wipes the packages, our check target has to run |
| 75 | # first and old packages (listed as they appear in pkg_info) must be | |
| 76 | # cleaned out in order for the pkg_add -n test we use in the check target | |
| 77 | # to operate properly. | |
| 78 | # | |
| fbc26094 SW |
79 | OLD_PKGSRC_PACKAGES?= cdrtools-2.01.01.27nb1 \ |
| 80 | cdrecord-2.00.3nb2 \ | |
| 81 | bootstrap-kit-20070205 \ | |
| 82 | dfuibe_installer-1.1.6 \ | |
| 83 | gettext-lib-0.14.5 \ | |
| 84 | dfuibe_installer-1.1.7nb1 \ | |
| 85 | dfuife_curses-1.5 \ | |
| 86 | gettext-lib-0.14.6 \ | |
| 87 | gettext-tools-0.14.6nb1 \ | |
| 88 | libaura-3.1 \ | |
| 89 | libdfui-4.2 \ | |
| 90 | libinstaller-5.1 \ | |
| 91 | bootstrap-kit-20080211 \ | |
| 92 | cdrtools-ossdvd-2.01.1.36nb2 \ | |
| 93 | isc-dhcp-base-4.0.0 \ | |
| 94 | isc-dhcp-server-4.0.0 | |
| 95b64753 | 95 | |
| 8188de86 | 96 | # Specify which root skeletons are required, and let the user include |
| e2dbfa0b | 97 | # their own. They are copied into ISODIR during the `customizeiso' |
| 8188de86 MD |
98 | # target; each overwrites the last. |
| 99 | # | |
| fbc26094 SW |
100 | REQ_ROOTSKELS= ${.CURDIR}/root \ |
| 101 | ${.CURDIR}/installer | |
| cc224c64 JS |
102 | ROOTSKELS?= ${REQ_ROOTSKELS} |
| 103 | ||
| fbc26094 | 104 | .if make(gui) |
| 3f279b9e | 105 | ISOFILE?= ${ISODIR}/dfly-gui.iso |
| b9c3e754 | 106 | IMGFILE?= ${ISODIR}/dfly-gui.img |
| 0936984e MD |
107 | PKGSRC_PACKAGES+= meta-pkgs/modular-xorg-apps \ |
| 108 | meta-pkgs/modular-xorg-drivers \ | |
| 109 | meta-pkgs/modular-xorg-fonts \ | |
| 110 | meta-pkgs/modular-xorg-libs \ | |
| fbc26094 | 111 | wm/fluxbox \ |
| 0936984e | 112 | wm/fvwm \ |
| ad35babc | 113 | www/firefox \ |
| fbc26094 SW |
114 | print/xpdf \ |
| 115 | shells/zsh \ | |
| 116 | editors/emacs \ | |
| 117 | editors/vim \ | |
| 118 | chat/pidgin \ | |
| 119 | chat/irssi \ | |
| 120 | chat/xchat \ | |
| 0936984e | 121 | x11/modular-xorg-server \ |
| fbc26094 SW |
122 | x11/rxvt-unicode \ |
| 123 | x11/eterm \ | |
| 124 | lang/perl5 \ | |
| 125 | editors/nano \ | |
| 126 | shells/bash \ | |
| 127 | devel/exctags \ | |
| 128 | archivers/zip \ | |
| 129 | security/sudo \ | |
| 130 | www/links-gui \ | |
| 131 | net/nmap \ | |
| 132 | net/wget \ | |
| 133 | fonts/terminus-font \ | |
| 134 | net/rsync \ | |
| 135 | sysutils/idesk \ | |
| 0936984e | 136 | time/asclock \ |
| fbc26094 | 137 | misc/screen |
| 3f279b9e SW |
138 | ROOTSKELS+= ${.CURDIR}/gui |
| 139 | .endif | |
| 140 | ||
| 3f279b9e | 141 | ISOFILE ?= ${ISODIR}/dfly.iso |
| b9c3e754 MN |
142 | IMGFILE ?= ${ISODIR}/dfly.img |
| 143 | ||
| 60b68cbb | 144 | IMGMNT ?= ${ISODIR}/mnt |
| a2f841ed MD |
145 | |
| 146 | # USB umass now probes starting at da8, so the usb stick is | |
| 147 | # probably sitting on da8. | |
| 148 | # | |
| 9a122c9a | 149 | IMGUSBDEV ?= da8 |
| 3f279b9e | 150 | |
| 5b22b655 MD |
151 | # note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add |
| 152 | # the additional '/nrelease' manually, as a safety measure. | |
| 153 | # | |
| 154 | NRLOBJDIR?= /usr/obj | |
| 155 | ||
| 8188de86 MD |
156 | ######################################################################### |
| 157 | # BASE ISO TARGETS # | |
| 158 | ######################################################################### | |
| 159 | ||
| 7ebbae99 | 160 | release: check clean buildworld1 buildkernel1 \ |
| 03e2a3c5 | 161 | buildiso srcs customizeiso mklocatedb \ |
| 0936984e | 162 | mkiso mkimg |
| 8188de86 | 163 | |
| 7ebbae99 | 164 | quickrel: check clean buildworld2 buildkernel2 \ |
| 03e2a3c5 | 165 | buildiso srcs customizeiso mklocatedb \ |
| 0936984e | 166 | mkiso mkimg |
| 2e3f8f38 | 167 | |
| 03e2a3c5 SW |
168 | realquickrel: check clean \ |
| 169 | buildiso srcs customizeiso mklocatedb \ | |
| 0936984e | 170 | mkiso mkimg |
| 6ca9a59c | 171 | |
| 03e2a3c5 | 172 | restartpkgs: check customizeiso mklocatedb mkiso mkimg |
| 5af45f85 | 173 | |
| 9b29c40a MD |
174 | quick: quickrel |
| 175 | ||
| 176 | realquick: realquickrel | |
| 177 | ||
| 5af45f85 | 178 | |
| 9b29c40a MD |
179 | ######################################################################### |
| 180 | # CORE SUPPORT TARGETS # | |
| 181 | ######################################################################### | |
| 182 | ||
| d2582113 | 183 | check: |
| 0936984e MD |
184 | .if !exists(${PKGBIN_PKG_ADMIN}) |
| 185 | @echo "You never bootstrapped pkgsrc on your machine. You can install it with:" | |
| 186 | @echo " make pkgsrc_bootstrap" | |
| 187 | .endif | |
| 0a1628e7 MD |
188 | .if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz) |
| 189 | @echo "The cvsup bootstrap kit is not installed. You can install it with:" | |
| f4ec1279 | 190 | @echo " make fetch" |
| 0936984e MD |
191 | .endif |
| 192 | .if !exists (${PKGBIN_MKISOFS}) | |
| 193 | @echo | |
| 194 | @echo "Your machine does not have cdrtools installed. You can install it with:" | |
| 195 | @echo " make pkgsrc_cdrecord" | |
| 0a1628e7 | 196 | .endif |
| fbc26094 SW |
197 | .if !defined(PKGSRC_PATH) |
| 198 | @echo "Please set PKGSRC_PATH to the pkgsrc tree that shall be used for" | |
| 5af45f85 MD |
199 | @echo "package building. For example /usr/pkgsrc. See the Makefile" |
| 200 | @echo "in /usr if you are unfamiliar with pkgsrc." | |
| 0936984e MD |
201 | .endif |
| 202 | .if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz) | |
| 203 | @exit 1 | |
| 204 | .endif | |
| 205 | .if !exists (${PKGBIN_MKISOFS}) | |
| 206 | @exit 1 | |
| 207 | .endif | |
| 208 | .if !defined(PKGSRC_PATH) | |
| fbc26094 SW |
209 | @exit 1 |
| 210 | .endif | |
| 2e3f8f38 | 211 | |
| 588a679c | 212 | buildworld1 buildworld2: |
| 3fff415b SW |
213 | cd ${.CURDIR}/..; \ |
| 214 | ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \ | |
| 215 | make -j ${MAKE_JOBS} -DWANT_INSTALLER ${.TARGET:C/build(.*)2/quick\1/:C/1//} | |
| 6ca9a59c | 216 | |
| 588a679c | 217 | buildkernel1 buildkernel2: |
| bfe20b28 SW |
218 | .if make(gui) |
| 219 | cd ${.CURDIR}/..; \ | |
| 220 | for kernconf in ${KERNCONF}; do \ | |
| 448b21e7 | 221 | ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \ |
| 3fff415b | 222 | make -j ${MAKE_JOBS} ${.TARGET:C/build(.*)2/quick\1/:C/1//} \ |
| bfe20b28 SW |
223 | KERNCONF=$${kernconf} KERNCONFDIR=${.CURDIR}/gui/root; \ |
| 224 | done | |
| 225 | .else | |
| 588a679c SS |
226 | cd ${.CURDIR}/..; \ |
| 227 | first=; \ | |
| 228 | for kernconf in ${KERNCONF}; do \ | |
| 448b21e7 | 229 | ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \ |
| 3fff415b | 230 | make -j ${MAKE_JOBS} ${.TARGET:C/build(.*)2/quick\1/:C/1//} \ |
| 588a679c SS |
231 | KERNCONF=$${kernconf} \ |
| 232 | $${first:+-DNO_MODULES}; \ | |
| 233 | first=done; \ | |
| 234 | done | |
| bfe20b28 | 235 | .endif |
| 6ca9a59c | 236 | |
| 5b22b655 MD |
237 | # note that we do not want to mess with any /usr/obj directories not related |
| 238 | # to buildworld, buildkernel, or nrelease, so we must supply the proper | |
| 239 | # MAKEOBJDIRPREFIX for targets that are not run through the buildworld and | |
| 240 | # buildkernel mechanism. | |
| 241 | # | |
| 6ca9a59c MD |
242 | buildiso: |
| 243 | if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi | |
| 5b22b655 | 244 | if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi |
| f4ec1279 | 245 | ( cd ${.CURDIR}/..; make -DWANT_INSTALLER DESTDIR=${ISOROOT} installworld ) |
| ab64cf06 SS |
246 | ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \ |
| 247 | make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution ) | |
| 21aa02d0 | 248 | cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd |
| bfe20b28 | 249 | .if make(gui) |
| fbc26094 | 250 | if [ ! -d ${ISOROOT}/kernel.smp/boot ]; then mkdir -p ${ISOROOT}/kernel.smp/boot; fi |
| bfe20b28 SW |
251 | cd ${.CURDIR}/..; \ |
| 252 | make installkernel DESTDIR=${ISOROOT} \ | |
| 253 | KERNCONF=DFLYLIVE DESTKERNNAME=kernel KERNCONFDIR=${.CURDIR}/gui/root; \ | |
| 254 | cd ${.CURDIR}/..; \ | |
| 255 | make installkernel DESTDIR=${ISOROOT} \ | |
| 256 | KERNCONF=VKERNEL DESTKERNNAME=kernel.VKERNEL -DNO_MODULES KERNCONFDIR=${.CURDIR}/gui/root; \ | |
| 257 | cd ${.CURDIR}/..; \ | |
| 258 | make installkernel DESTDIR=${ISOROOT}/kernel.smp \ | |
| 259 | KERNCONF=DFLYLIVE-SMP DESTKERNNAME=kernel KERNCONFDIR=${.CURDIR}/gui/root; \ | |
| 260 | cd ${.CURDIR}/..; \ | |
| 261 | make installkernel DESTDIR=${ISOROOT}/kernel.smp \ | |
| 262 | KERNCONF=DFLYLIVE-SMP-NOAPIC DESTKERNNAME=kernel.noapic \ | |
| 263 | KERNCONFDIR=${.CURDIR}/gui/root -DNO_MODULES; | |
| 264 | .else | |
| 588a679c SS |
265 | cd ${.CURDIR}/..; \ |
| 266 | first=; \ | |
| 267 | for kernconf in ${KERNCONF}; do \ | |
| 268 | make DESTDIR=${ISOROOT} \ | |
| 269 | installkernel KERNCONF=$${kernconf} \ | |
| 270 | $${first:+DESTKERNNAME=kernel.$${kernconf}} \ | |
| 271 | $${first:+-DNO_MODULES}; \ | |
| 272 | first=done; \ | |
| 273 | done | |
| bfe20b28 | 274 | .endif |
| 3f6dbfa9 | 275 | ln -s kernel ${ISOROOT}/boot/kernel.BOOTP |
| 6ca9a59c MD |
276 | mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/ |
| 277 | mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var | |
| 278 | dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev | |
| 8188de86 | 279 | |
| e2dbfa0b TN |
280 | # Release CD: Kernel sources (~16M) and the full pkgsrc tree (~27M) |
| 281 | # Release DVD: Full sources (~90M) and the full pkgsrc tree (~27M) | |
| 19d86faa | 282 | # |
| e2dbfa0b TN |
283 | srcs: |
| 284 | .if !defined(WITHOUT_SRCS) | |
| 1eeae16f MD |
285 | rm -f ${ISOROOT}/usr/pkgsrc-git.tgz |
| 286 | rm -f ${ISOROOT}/usr/pkgsrc | |
| 287 | mkdir -p ${ISOROOT}/usr/pkgsrc | |
| 288 | cd ${ISOROOT}/usr/pkgsrc && git init | |
| 289 | cd ${ISOROOT}/usr/pkgsrc && \ | |
| 290 | git remote add origin git://git.dragonflybsd.org/pkgsrc.git | |
| 291 | cd ${ISOROOT}/usr/pkgsrc && git fetch origin | |
| 292 | cd ${ISOROOT}/usr/pkgsrc && git branch vendor origin/vendor | |
| 293 | cd ${ISOROOT}/usr/pkgsrc && git gc | |
| c19c746b | 294 | .if make(gui) |
| 1eeae16f MD |
295 | rm -f ${ISOROOT}/usr/src-git.tgz |
| 296 | rm -rf ${ISOROOT}/usr/src | |
| 297 | mkdir -p ${ISOROOT}/usr/src | |
| 298 | cd ${ISOROOT}/usr/src && git init | |
| 299 | cd ${ISOROOT}/usr/src && \ | |
| 300 | git remote add origin git://git.dragonflybsd.org/dragonfly.git | |
| 301 | cd ${ISOROOT}/usr/src && git fetch origin | |
| 302 | cd ${ISOROOT}/usr/src && git branch master origin/master | |
| 303 | cd ${ISOROOT}/usr/src && git gc | |
| c19c746b | 304 | .else |
| e2dbfa0b | 305 | rm -f ${ISOROOT}/usr/src-sys.tgz |
| 3617b2c9 SW |
306 | cd ${.CURDIR}/.. && tar --exclude .git --exclude CVS -s '/^\./src/' \ |
| 307 | -czf ${ISOROOT}/usr/src-sys.tgz ./Makefile ./Makefile.inc1 ./sys | |
| c19c746b | 308 | .endif |
| 66b79064 | 309 | .endif |
| 19d86faa | 310 | |
| 5af45f85 MD |
311 | # Customize the ISO by copying rootskels in reverse priority order, |
| 312 | # building packages, and doing other post-install tasks. | |
| 313 | # | |
| 8188de86 | 314 | customizeiso: |
| 5af45f85 MD |
315 | # Copy the rootskels. Allow sources to be owned by someone other |
| 316 | # then root (as is common when checked out via git). | |
| 317 | # | |
| 8188de86 MD |
318 | .for ROOTSKEL in ${ROOTSKELS} |
| 319 | cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT} | |
| 5af45f85 MD |
320 | @test -O ${.CURDIR} || echo "chowning copied files to root:wheel" |
| 321 | @test -O ${.CURDIR} || ((cd ${ROOTSKEL} && find .) | fgrep -v cpignore | (cd ${ISOROOT} && xargs chown root:wheel)) | |
| 8188de86 | 322 | .endfor |
| fbc26094 | 323 | (cd ${PKGSRC_PKG_PATH}; tar xzpf ${CVSUP_BOOTSTRAP_KIT}.tgz) |
| 0a1628e7 | 324 | cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/bin/cvsup ${ISOROOT}/usr/local/bin/cvsup |
| c751e497 | 325 | cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/man/man1/cvsup.1 ${ISOROOT}/usr/local/man/man1/cvsup.1 |
| 7249926b | 326 | pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd |
| 4fba3387 CP |
327 | .for UPGRADE_ITEM in Makefile \ |
| 328 | etc.${MACHINE_ARCH} \ | |
| 329 | isdn/Makefile \ | |
| 330 | rc.d/Makefile \ | |
| 331 | periodic/Makefile \ | |
| 332 | periodic/daily/Makefile \ | |
| 333 | periodic/security/Makefile \ | |
| 334 | periodic/weekly/Makefile \ | |
| 335 | periodic/monthly/Makefile | |
| 336 | cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM} | |
| 337 | .endfor | |
| 8abe78a1 MD |
338 | # |
| 339 | # Setup some things & mount pkgsrc tree. Use defensive umounts and | |
| 340 | # rm -rf's to allow restarts. Allow /usr/pkgsrc to be read-only. | |
| 341 | # | |
| 342 | # If we did not get past the bootstrap we clean out the entire | |
| 343 | # /usr/pkg infrastructure. Otherwise we attempt to pick up where | |
| 344 | # we left off. | |
| 345 | # | |
| fbc26094 | 346 | cp -p /etc/resolv.conf ${ISOROOT}/etc |
| cc55a235 | 347 | ${CHROOT_CMD} "ldconfig -elf /usr/lib /usr/lib/gcc* /usr/lib/compat" |
| 8abe78a1 MD |
348 | -@umount ${ISOROOT}/usr/pkgsrc/distfiles |
| 349 | -@umount ${ISOROOT}/usr/pkgsrc | |
| 45e80934 | 350 | -@umount ${ISOROOT}/dev |
| 8abe78a1 MD |
351 | mkdir -p ${ISODIR}/distfiles |
| 352 | rm -rf ${ISOROOT}/usr/pkgobj | |
| 8abe78a1 | 353 | # |
| 1eeae16f MD |
354 | # Mount /usr/pkgsrc, make sure /usr/pkgsrc/distfiles is writable. |
| 355 | # Make /usr/pkgsrc read-only for safety, else a failed umount and | |
| 356 | # our rm -rf will do bad things. | |
| 8abe78a1 MD |
357 | # |
| 358 | mkdir -p ${ISOROOT}/usr/pkgobj | |
| 3aa2328e | 359 | mkdir -p ${ISOROOT}/usr/pkgobj/bootstrap |
| 8abe78a1 | 360 | mkdir -p ${ISOROOT}/usr/pkgsrc |
| 1eeae16f | 361 | mount_null -o ro ${PKGSRC_PATH} ${ISOROOT}/usr/pkgsrc |
| 0c5de895 | 362 | mount_null /dev ${ISOROOT}/dev |
| 5af45f85 MD |
363 | cp /etc/shells ${ISOROOT}/usr/pkgsrc/distfiles/.test > /dev/null 2>&1 \ |
| 364 | || mount_null ${ISODIR}/distfiles ${ISOROOT}/usr/pkgsrc/distfiles | |
| 8abe78a1 | 365 | # |
| 5af45f85 | 366 | # Bootstrap, if not already installed, and add licenses needed |
| ee3561ee | 367 | # for the gui release |
| 8abe78a1 | 368 | # |
| c19c746b MD |
369 | test -e ${ISODIR}/.didbootstrap || \ |
| 370 | rm -rf ${ISOROOT}/usr/pkg ${ISOROOT}/var/db/pkg \ | |
| 371 | ${ISOROOT}/var/db/pkg.refcount | |
| 372 | test -e ${ISODIR}/.didbootstrap || \ | |
| 373 | ${CHROOT_CMD} "cd /usr/pkgsrc/bootstrap; \ | |
| 8abe78a1 | 374 | ./bootstrap --workdir /usr/pkgobj/bootstrap/work" |
| 3fff415b | 375 | .if make(gui) |
| c19c746b MD |
376 | test -e ${ISODIR}/.didbootstrap || \ |
| 377 | echo ".ifdef BSD_PKG_MK # added by nrelease" \ | |
| ee3561ee | 378 | >> ${ISOROOT}/usr/pkg/etc/mk.conf |
| c19c746b MD |
379 | test -e ${ISODIR}/.didbootstrap || \ |
| 380 | echo "ACCEPTABLE_LICENSES+=openmotif-license" \ | |
| ee3561ee | 381 | >> ${ISOROOT}/usr/pkg/etc/mk.conf |
| c19c746b MD |
382 | test -e ${ISODIR}/.didbootstrap || \ |
| 383 | echo "ACCEPTABLE_LICENSES+=vim-license" \ | |
| ee3561ee | 384 | >> ${ISOROOT}/usr/pkg/etc/mk.conf |
| c19c746b MD |
385 | test -e ${ISODIR}/.didbootstrap || \ |
| 386 | echo ".endif # added by nrelease" \ | |
| ee3561ee | 387 | >> ${ISOROOT}/usr/pkg/etc/mk.conf |
| 3fff415b | 388 | .endif |
| c19c746b MD |
389 | test -e ${ISODIR}/.didbootstrap || sync |
| 390 | test -e ${ISODIR}/.didbootstrap || touch ${ISODIR}/.didbootstrap | |
| 8abe78a1 MD |
391 | # |
| 392 | # Build and install packages, skip packages already installed | |
| 393 | # | |
| bce110a5 | 394 | .for PKG in ${PKGSRC_PACKAGES} |
| 8abe78a1 | 395 | ${CHROOT_CMD} "cd /usr/pkgsrc/${PKG} && \ |
| 3fff415b SW |
396 | (bmake check > /dev/null 2>&1 || \ |
| 397 | bmake ${PKGSRC_OPTIONS} clean build install)" | |
| 8188de86 | 398 | .endfor |
| 8abe78a1 MD |
399 | # |
| 400 | # Remove packages which nothing depends on and clean up | |
| 401 | # | |
| cc55a235 | 402 | ${CHROOT_CMD} "pkg_leaves | xargs pkg_delete -R" |
| 8abe78a1 | 403 | -umount ${ISOROOT}/usr/pkgsrc/distfiles |
| 45e80934 | 404 | umount ${ISOROOT}/dev |
| fbc26094 | 405 | umount ${ISOROOT}/usr/pkgsrc |
| 589a5738 | 406 | rm -rf ${ISOROOT}/usr/pkgobj |
| fbc26094 | 407 | rm -f ${ISOROOT}/etc/resolv.conf |
| 3652f053 SW |
408 | makewhatis ${ISOROOT}/usr/local/man |
| 409 | makewhatis ${ISOROOT}/usr/pkg/man | |
| 6ca9a59c | 410 | |
| 0936984e MD |
411 | # So locate works |
| 412 | # | |
| 8398ca17 SW |
413 | mklocatedb: |
| 414 | ( find -s ${ISOROOT} -path ${ISOROOT}/tmp -or \ | |
| 415 | -path ${ISOROOT}/usr/tmp -or -path ${ISOROOT}/var/tmp \ | |
| 416 | -prune -o -print | sed -e 's#^${ISOROOT}##g' | \ | |
| 417 | /usr/libexec/locate.mklocatedb \ | |
| 418 | -presort >${ISOROOT}/var/db/locate.database ) | |
| 419 | ||
| 6ca9a59c | 420 | mkiso: |
| bce110a5 | 421 | ( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \ |
| 74ec6a9d | 422 | -R -J -o ${ISOFILE} \ |
| 64bba8c7 | 423 | -V "DragonFly `${.CURDIR}/../tools/gitrev.sh | cut -c -22`" . ) |
| 6ca9a59c | 424 | |
| b9c3e754 MN |
425 | |
| 426 | mkimg: | |
| fbc26094 | 427 | .if make(img) |
| 60b68cbb | 428 | if [ ! -d ${IMGMNT} ]; then mkdir -p ${IMGMNT}; fi |
| 9a122c9a MD |
429 | -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \ |
| 430 | vnconfig -u `cat ${ISODIR}/vn.which`; fi | |
| 431 | @echo "STEP: determine required image size" | |
| 60b68cbb | 432 | sz=`du -ck ${ISOROOT} | tail -n 1 | cut -f 1`; \ |
| 9a122c9a MD |
433 | sz=`bc -e "(($${sz}) / 1024) * 1.15" -equit | cut -f1 -d.`; \ |
| 434 | dd if=/dev/zero of=${IMGFILE} bs=1m count=$${sz}; | |
| 435 | fdisk -IB -p ${IMGFILE} | |
| 436 | @echo "STEP: determine free vn device" | |
| 437 | vnconfig -l | grep "not in use" | head -n 1 | \ | |
| 438 | cut -f 1 -d: > ${ISODIR}/vn.which | |
| 439 | vnconfig -e -s labels `cat ${ISODIR}/vn.which` ${IMGFILE} | |
| 440 | @echo "STEP: write standard disklabel" | |
| 441 | disklabel -w -r `cat ${ISODIR}/vn.which`s1 auto | |
| 442 | @echo "STEP: read disklabel back" | |
| 443 | disklabel -r `cat ${ISODIR}/vn.which`s1 > ${IMGFILE}.label | |
| 444 | @echo "STEP: determine number of sectors of whole disk" | |
| 60b68cbb | 445 | secs=`tail -n 1 ${IMGFILE}.label | cut -f 3 -w`; \ |
| 9a122c9a MD |
446 | echo " a: $${secs} 0 4.2BSD" >> ${IMGFILE}.label; |
| 447 | @echo "STEP: write modified disklabel back" | |
| 448 | disklabel -R -r `cat ${ISODIR}/vn.which`s1 ${IMGFILE}.label | |
| 449 | rm ${IMGFILE}.label | |
| 450 | @echo "STEP: write bootsector" | |
| 451 | disklabel -B `cat ${ISODIR}/vn.which`s1 | |
| 452 | boot0cfg -B -o noupdate `cat ${ISODIR}/vn.which` | |
| 453 | newfs /dev/`cat ${ISODIR}/vn.which`s1a | |
| 454 | mount /dev/`cat ${ISODIR}/vn.which`s1a ${IMGMNT} | |
| 455 | cpdup ${ISOROOT} ${IMGMNT} | |
| 456 | @echo "STEP: fixup ${IMGMNT}/etc/fstab" | |
| b589b7a6 | 457 | echo "/dev/${IMGUSBDEV}s1a / ufs rw,noatime 0 1" > ${IMGMNT}/etc/fstab |
| 9a122c9a MD |
458 | echo "proc /proc procfs rw 0 0" >> ${IMGMNT}/etc/fstab |
| 459 | @echo "STEP: fixup ${IMGMNT}/boot/loader.conf" | |
| 460 | -fgrep -v kernel_options ${IMGMNT}/boot/loader.conf > ${IMGMNT}/boot/loader.conf.new | |
| 461 | echo 'vfs.root.mountfrom="ufs:${IMGUSBDEV}s1a"' >> ${IMGMNT}/boot/loader.conf.new | |
| 462 | mv ${IMGMNT}/boot/loader.conf.new ${IMGMNT}/boot/loader.conf | |
| 463 | @echo "STEP: cleanup" | |
| 464 | df ${IMGMNT} | |
| 465 | umount ${IMGMNT} | |
| 466 | vnconfig -u `cat ${ISODIR}/vn.which` | |
| 467 | rm -f ${ISODIR}/vn.which | |
| 60b68cbb | 468 | rmdir ${IMGMNT} |
| 9a122c9a | 469 | @echo "STEP: done" |
| b9c3e754 MN |
470 | .endif |
| 471 | ||
| 6ca9a59c | 472 | clean: |
| c19c746b MD |
473 | -umount ${ISOROOT}/usr/pkgsrc/distfiles > /dev/null 2>&1 |
| 474 | -umount ${ISOROOT}/usr/pkgsrc > /dev/null 2>&1 | |
| 9a122c9a MD |
475 | -umount ${ISOROOT}/dev > /dev/null 2>&1 |
| 476 | -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \ | |
| 477 | vnconfig -u `cat ${ISODIR}/vn.which`; fi | |
| 6ca9a59c | 478 | if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi |
| c19c746b MD |
479 | rm -rf ${ISOROOT} |
| 480 | rm -rf ${NRLOBJDIR}/nrelease | |
| 9a122c9a | 481 | rm -f ${ISODIR}/.didbootstrap ${ISODIR}/vn.which |
| 6ca9a59c MD |
482 | |
| 483 | realclean: clean | |
| 3ebedc5e | 484 | rm -rf ${OBJSYS}/${KERNCONF} |
| 8abe78a1 | 485 | # |
| bce110a5 MD |
486 | # do not use PKGSRC_PKG_PATH here, we do not want to destroy an |
| 487 | # override location. | |
| 8abe78a1 | 488 | # |
| c19c746b MD |
489 | rm -rf ${ISODIR}/packages |
| 490 | rm -rf ${ISODIR}/distfiles | |
| 6ca9a59c | 491 | |
| cc224c64 | 492 | fetch: |
| 9b29c40a | 493 | @if [ ! -d ${PKGSRC_PKG_PATH} ]; then mkdir -p ${PKGSRC_PKG_PATH}; fi |
| 0a1628e7 MD |
494 | .if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz) |
| 495 | (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${CVSUP_BOOTSTRAP_KIT}.tgz) | |
| 496 | .endif | |
| bce110a5 MD |
497 | |
| 498 | pkgsrc_bootstrap: | |
| bce110a5 | 499 | .if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz) |
| 0936984e MD |
500 | mkdir -p /usr/release/bootstrap |
| 501 | (cd ${PKGSRC_PATH}/bootstrap; ./bootstrap --workdir /usr/release/bootstrap) | |
| bce110a5 | 502 | .endif |
| bce110a5 | 503 | |
| bce110a5 MD |
504 | pkgsrc_cdrecord: |
| 505 | .if !exists (${PKGBIN_MKISOFS}) | |
| 0936984e | 506 | (cd ${PKGSRC_PATH}/sysutils/cdrtools; bmake clean build install) |
| bce110a5 | 507 | .endif |
| cc224c64 | 508 | |
| e2dbfa0b | 509 | help all: |
| 5af45f85 MD |
510 | @echo "make [gui] release - complete build from scratch" |
| 511 | @echo "make [gui] quick - attempt to do an incremental rebuild" | |
| 512 | @echo "make [gui] realquick - attempt to restart after world & kernel" | |
| 513 | @echo "make [gui] restartpkgs - attempt to restart at the pkg building stage" | |
| 8abe78a1 MD |
514 | @echo "" |
| 515 | @echo "Extra packages may be specified with PKGSRC_EXTRA_PACKAGES" | |
| 588a679c | 516 | |
| e2dbfa0b TN |
517 | .PHONY: release quickrel realquickrel |
| 518 | .PHONY: installer | |
| 9b29c40a | 519 | .PHONY: quick realquick |
| e2dbfa0b | 520 | .PHONY: check buildworld1 buildworld2 |
| b9c3e754 | 521 | .PHONY: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso mkimg |
| 03e2a3c5 | 522 | .PHONY: clean realclean fetch help all srcs |
| cc224c64 | 523 | |
| 6ca9a59c | 524 | .include <bsd.prog.mk> |