19b29c40aSMatthew Dillon######################################################################### 29b29c40aSMatthew Dillon# ENHANCEMENTS # 39b29c40aSMatthew Dillon######################################################################### 49b29c40aSMatthew Dillon 5f4ec1279SSascha Wildner# New method e.g. 'make gui release'. A series of enhancement 69b29c40aSMatthew Dillon# targes may be specified which set make variables which enhance 79b29c40aSMatthew Dillon# the build in various ways. 89b29c40aSMatthew Dillon# 91a8bb5ebSMatthew Dillon# img is now the default (produces both the .iso and .img) 101a8bb5ebSMatthew Dillon# 1188821fa4SMatthew Dillongui installer img nopkgs: 129b29c40aSMatthew Dillon 139b29c40aSMatthew Dillon######################################################################### 149b29c40aSMatthew Dillon# SETUP # 159b29c40aSMatthew Dillon######################################################################### 169b29c40aSMatthew Dillon 176ca9a59cSMatthew DillonISODIR?= /usr/release 185ec00f8aSSascha WildnerISOROOT?= ${ISODIR}/root 196ca9a59cSMatthew DillonOBJSYS= ${.OBJDIR}/../sys 20fe70af21SMatthew DillonGITHOST?= git.dragonflybsd.org 21bfe20b28SSascha Wildner 225cb6cda9SSascha WildnerMAKE_JOBS?= $$(sysctl -n hw.ncpu) 233fff415bSSascha Wildner 24b2b3ffcdSSimon Schubert# temporary until everybody has converted to x86_64 25b2b3ffcdSSimon Schubert.if ${MACHINE_ARCH} == "amd64" 26b2b3ffcdSSimon SchubertMACHINE_ARCH= x86_64 273da8e88fSJohn Marino.if defined(.PARSEDIR) 283da8e88fSJohn Marino.export MACHINE_ARCH 293da8e88fSJohn Marino.else 303da8e88fSJohn Marino# LEGACY MAKE - REMOVE FOR DFLY 3.6 31b2b3ffcdSSimon Schubert.makeenv MACHINE_ARCH 32b2b3ffcdSSimon Schubert.endif 333da8e88fSJohn Marino.endif 34b2b3ffcdSSimon Schubert 35702a95ccSSimon Schubert# XXX makeshift fix to build the right kernel for the (target) architecture 36702a95ccSSimon Schubert# We should configure this in the platform files somehow 37702a95ccSSimon Schubert.if ${MACHINE_ARCH} == "i386" 3891856cf5SSascha WildnerKERNCONF ?= GENERIC 39702a95ccSSimon Schubert.else 4091856cf5SSascha WildnerKERNCONF ?= X86_64_GENERIC 41702a95ccSSimon Schubert.endif 426ca9a59cSMatthew Dillon 43cc224c64SJoerg SonnenbergerPKGSRC_PREFIX?= /usr/pkg 44bce110a5SMatthew DillonPKGBIN_PKG_ADD?= ${PKGSRC_PREFIX}/sbin/pkg_add 4595b64753SMatthew DillonPKGBIN_PKG_DELETE?= ${PKGSRC_PREFIX}/sbin/pkg_delete 46c791834fSJoerg SonnenbergerPKGBIN_PKG_ADMIN?= ${PKGSRC_PREFIX}/sbin/pkg_admin 47bce110a5SMatthew DillonPKGBIN_MKISOFS?= ${PKGSRC_PREFIX}/bin/mkisofs 48bce110a5SMatthew DillonPKGSRC_PKG_PATH?= ${ISODIR}/packages 49bce110a5SMatthew Dillon 50cc55a235SSimon Schubert# We use env -i in the chroot, so that environment variables won't 51cc55a235SSimon Schubert# disturb any (pkgsrc) build. This has happened for TARGET_ARCH, 52cc55a235SSimon Schubert# which is used by gmake in completely different context. 53e2dbfa0bSThomas Nikolajsen# 54cc55a235SSimon SchubertCHROOT_CMD?= env -i CCVER=${CCVER:Q} /usr/sbin/chroot ${ISOROOT} sh -c 55cc55a235SSimon Schubert 568abe78a1SMatthew Dillon# User may specify extra packages in addition to the defaults 5795b64753SMatthew Dillon# 588abe78a1SMatthew DillonPKGSRC_EXTRA_PACKAGES?= 598abe78a1SMatthew Dillon 608abe78a1SMatthew Dillon# Pkgsrc packages to be built and installed on the release ISO 618abe78a1SMatthew Dillon# 628abe78a1SMatthew DillonPKGSRC_PACKAGES?= pkgtools/pkg_leaves \ 638abe78a1SMatthew Dillon pkgtools/pkg_tarup \ 64b2c6ab6cSSascha Wildner pkgtools/pkgin \ 658abe78a1SMatthew Dillon devel/scmgit \ 6657b52550SJan Lentfer net/bind96 \ 67fbc26094SSascha Wildner net/isc-dhcp4 \ 68fbc26094SSascha Wildner net/isc-dhcpd4 \ 698abe78a1SMatthew Dillon sysutils/cdrtools \ 70796fd273SYONETANI Tomokazu net/csup \ 718abe78a1SMatthew Dillon ${PKGSRC_EXTRA_PACKAGES} 72fbc26094SSascha Wildner 73fbc26094SSascha Wildner# pkgsrc options to use when building packages 74fbc26094SSascha Wildner# 753fff415bSSascha WildnerPKGSRC_OPTIONS+= MAKE_JOBS=${MAKE_JOBS} 763fff415bSSascha WildnerPKGSRC_OPTIONS+= WRKOBJDIR=/usr/pkgobj 779ecb41e5SSascha WildnerPKGSRC_OPTIONS+= PKG_DEFAULT_OPTIONS='dri inet6' 78fbc26094SSascha Wildner.if !make(gui) 791f8639a7SSascha WildnerPKGSRC_OPTIONS+= PKG_OPTIONS.scmgit='-python' 80fbc26094SSascha Wildner.endif 818188de86SMatthew Dillon 8295b64753SMatthew Dillon# Even though buildiso wipes the packages, our check target has to run 8395b64753SMatthew Dillon# first and old packages (listed as they appear in pkg_info) must be 8495b64753SMatthew Dillon# cleaned out in order for the pkg_add -n test we use in the check target 8595b64753SMatthew Dillon# to operate properly. 8695b64753SMatthew Dillon# 87fbc26094SSascha WildnerOLD_PKGSRC_PACKAGES?= cdrtools-2.01.01.27nb1 \ 88fbc26094SSascha Wildner cdrecord-2.00.3nb2 \ 89fbc26094SSascha Wildner bootstrap-kit-20070205 \ 90fbc26094SSascha Wildner dfuibe_installer-1.1.6 \ 91fbc26094SSascha Wildner gettext-lib-0.14.5 \ 92fbc26094SSascha Wildner dfuibe_installer-1.1.7nb1 \ 93fbc26094SSascha Wildner dfuife_curses-1.5 \ 94fbc26094SSascha Wildner gettext-lib-0.14.6 \ 95fbc26094SSascha Wildner gettext-tools-0.14.6nb1 \ 96fbc26094SSascha Wildner libaura-3.1 \ 97fbc26094SSascha Wildner libdfui-4.2 \ 98fbc26094SSascha Wildner libinstaller-5.1 \ 99fbc26094SSascha Wildner bootstrap-kit-20080211 \ 100fbc26094SSascha Wildner cdrtools-ossdvd-2.01.1.36nb2 \ 101fbc26094SSascha Wildner isc-dhcp-base-4.0.0 \ 102fbc26094SSascha Wildner isc-dhcp-server-4.0.0 10395b64753SMatthew Dillon 1048188de86SMatthew Dillon# Specify which root skeletons are required, and let the user include 105e2dbfa0bSThomas Nikolajsen# their own. They are copied into ISODIR during the `customizeiso' 1068188de86SMatthew Dillon# target; each overwrites the last. 1078188de86SMatthew Dillon# 1088f51ac0bSSascha WildnerREQ_ROOTSKELS= ${.CURDIR}/root 109cc224c64SJoerg SonnenbergerROOTSKELS?= ${REQ_ROOTSKELS} 110cc224c64SJoerg Sonnenberger 111c843f8b0SMatthew Dillon# LIST OF PACKAGES NOT INCLUDED DUE TO BUILD ISSUES: 112c843f8b0SMatthew Dillon# chat/pidgin textproc/enchant dependency is broken 113c843f8b0SMatthew Dillon# x11/rxvt-unicode broken configure 114c843f8b0SMatthew Dillon# net/nmap tries to access openssl/md2.h which does not 115c843f8b0SMatthew Dillon# exist. 116c843f8b0SMatthew Dillon# sysutils/idesk dying on link __sync_fetch_and_add_4 117c843f8b0SMatthew Dillon# 118fbc26094SSascha Wildner.if make(gui) 119bfe20b28SSascha WildnerISOFILE?= ${ISODIR}/dfly-gui.iso 120b9c3e754SMichael NeumannIMGFILE?= ${ISODIR}/dfly-gui.img 12188821fa4SMatthew Dillon 1220e176309SMatthew Dillon# NOTE: order important, do not sort package list 1230e176309SMatthew Dillon# 1240e176309SMatthew Dillon# Apps we want in the gui build but which have problems building: 1250e176309SMatthew Dillon# chat/xchat link error on x86-64, something about ___progname 1260e176309SMatthew Dillon# 1270e176309SMatthew Dillon# 12888821fa4SMatthew Dillon.if !make(nopkgs) 1290e176309SMatthew DillonPKGSRC_PACKAGES+= meta-pkgs/modular-xorg-libs \ 1300936984eSMatthew Dillon meta-pkgs/modular-xorg-fonts \ 1310e176309SMatthew Dillon meta-pkgs/modular-xorg-apps \ 1320e176309SMatthew Dillon meta-pkgs/modular-xorg-drivers \ 1330e176309SMatthew Dillon x11/libXinerama \ 134fbc26094SSascha Wildner wm/fluxbox \ 1350936984eSMatthew Dillon wm/fvwm \ 13630e27f66SMatthew Dillon www/firefox \ 137fbc26094SSascha Wildner print/xpdf \ 138fbc26094SSascha Wildner shells/zsh \ 139fbc26094SSascha Wildner editors/emacs \ 140fbc26094SSascha Wildner editors/vim \ 141fbc26094SSascha Wildner chat/irssi \ 1420936984eSMatthew Dillon x11/modular-xorg-server \ 143fbc26094SSascha Wildner x11/eterm \ 144fbc26094SSascha Wildner lang/perl5 \ 145fbc26094SSascha Wildner editors/nano \ 146fbc26094SSascha Wildner shells/bash \ 147fbc26094SSascha Wildner devel/exctags \ 148fbc26094SSascha Wildner archivers/zip \ 149fbc26094SSascha Wildner security/sudo \ 150fbc26094SSascha Wildner www/links-gui \ 151fbc26094SSascha Wildner net/wget \ 152fbc26094SSascha Wildner fonts/terminus-font \ 153fbc26094SSascha Wildner net/rsync \ 1540936984eSMatthew Dillon time/asclock \ 1551f8639a7SSascha Wildner misc/screen \ 1561f8639a7SSascha Wildner devel/scmgit-gitk 15788821fa4SMatthew Dillon.endif 15888821fa4SMatthew Dillon 159bfe20b28SSascha WildnerROOTSKELS+= ${.CURDIR}/gui 160bfe20b28SSascha Wildner.endif 161bfe20b28SSascha Wildner 1623f279b9eSSascha WildnerISOFILE ?= ${ISODIR}/dfly.iso 163b9c3e754SMichael NeumannIMGFILE ?= ${ISODIR}/dfly.img 164b9c3e754SMichael Neumann 16560b68cbbSMichael NeumannIMGMNT ?= ${ISODIR}/mnt 166a2f841edSMatthew Dillon 167a2f841edSMatthew Dillon# USB umass now probes starting at da8, so the usb stick is 168a2f841edSMatthew Dillon# probably sitting on da8. 169a2f841edSMatthew Dillon# 1709a122c9aSMatthew DillonIMGUSBDEV ?= da8 1713f279b9eSSascha Wildner 1725b22b655SMatthew Dillon# note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add 1735b22b655SMatthew Dillon# the additional '/nrelease' manually, as a safety measure. 1745b22b655SMatthew Dillon# 1755b22b655SMatthew DillonNRLOBJDIR?= /usr/obj 1765b22b655SMatthew Dillon 1778188de86SMatthew Dillon######################################################################### 1788188de86SMatthew Dillon# BASE ISO TARGETS # 1798188de86SMatthew Dillon######################################################################### 1806ca9a59cSMatthew Dillon 1817ebbae99SSascha Wildnerrelease: check clean buildworld1 buildkernel1 \ 18231d5c88cSSascha Wildner buildiso srcs customizeiso mkiso mkimg 1836ca9a59cSMatthew Dillon 1847ebbae99SSascha Wildnerquickrel: check clean buildworld2 buildkernel2 \ 18531d5c88cSSascha Wildner buildiso srcs customizeiso mkiso mkimg 1868188de86SMatthew Dillon 18703e2a3c5SSascha Wildnerrealquickrel: check clean \ 18831d5c88cSSascha Wildner buildiso srcs customizeiso mkiso mkimg 1896ca9a59cSMatthew Dillon 19031d5c88cSSascha Wildnerrestartpkgs: check customizeiso mkiso mkimg 1915af45f85SMatthew Dillon 1929b29c40aSMatthew Dillonquick: quickrel 1939b29c40aSMatthew Dillon 1949b29c40aSMatthew Dillonrealquick: realquickrel 1959b29c40aSMatthew Dillon 1965af45f85SMatthew Dillon 1979b29c40aSMatthew Dillon######################################################################### 1989b29c40aSMatthew Dillon# CORE SUPPORT TARGETS # 1999b29c40aSMatthew Dillon######################################################################### 2009b29c40aSMatthew Dillon 201d2582113SChris Presseycheck: 2020936984eSMatthew Dillon.if !exists(${PKGBIN_PKG_ADMIN}) 2030936984eSMatthew Dillon @echo "You never bootstrapped pkgsrc on your machine. You can install it with:" 2040936984eSMatthew Dillon @echo " make pkgsrc_bootstrap" 2050936984eSMatthew Dillon.endif 2060936984eSMatthew Dillon.if !exists (${PKGBIN_MKISOFS}) 2070936984eSMatthew Dillon @echo 2080936984eSMatthew Dillon @echo "Your machine does not have cdrtools installed. You can install it with:" 2090936984eSMatthew Dillon @echo " make pkgsrc_cdrecord" 2100a1628e7SMatthew Dillon.endif 211fbc26094SSascha Wildner.if !defined(PKGSRC_PATH) 212fbc26094SSascha Wildner @echo "Please set PKGSRC_PATH to the pkgsrc tree that shall be used for" 2135af45f85SMatthew Dillon @echo "package building. For example /usr/pkgsrc. See the Makefile" 2145af45f85SMatthew Dillon @echo "in /usr if you are unfamiliar with pkgsrc." 2150936984eSMatthew Dillon.endif 2160936984eSMatthew Dillon.if !exists (${PKGBIN_MKISOFS}) 2173da8e88fSJohn Marino @/usr/bin/false 2180936984eSMatthew Dillon.endif 2190936984eSMatthew Dillon.if !defined(PKGSRC_PATH) 2203da8e88fSJohn Marino @/usr/bin/false 221fbc26094SSascha Wildner.endif 2222e3f8f38SMatthew Dillon 223588a679cSSimon Schubertbuildworld1 buildworld2: 2243fff415bSSascha Wildner cd ${.CURDIR}/..; \ 2253fff415bSSascha Wildner ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \ 2263fff415bSSascha Wildner make -j ${MAKE_JOBS} -DWANT_INSTALLER ${.TARGET:C/build(.*)2/quick\1/:C/1//} 2276ca9a59cSMatthew Dillon 228588a679cSSimon Schubertbuildkernel1 buildkernel2: 229588a679cSSimon Schubert cd ${.CURDIR}/..; \ 230588a679cSSimon Schubert for kernconf in ${KERNCONF}; do \ 231448b21e7SSimon Schubert ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \ 2323fff415bSSascha Wildner make -j ${MAKE_JOBS} ${.TARGET:C/build(.*)2/quick\1/:C/1//} \ 233ee7f6ff2SSascha Wildner KERNCONF=$${kernconf}; \ 234588a679cSSimon Schubert done 2356ca9a59cSMatthew Dillon 2365b22b655SMatthew Dillon# note that we do not want to mess with any /usr/obj directories not related 2375b22b655SMatthew Dillon# to buildworld, buildkernel, or nrelease, so we must supply the proper 2385b22b655SMatthew Dillon# MAKEOBJDIRPREFIX for targets that are not run through the buildworld and 2395b22b655SMatthew Dillon# buildkernel mechanism. 2405b22b655SMatthew Dillon# 24192b0ebb9SMatthew Dillon# Unconditionally clean out /usr/release/root so a previous img build 24292b0ebb9SMatthew Dillon# does not blow up a future quick iso build 24392b0ebb9SMatthew Dillon# 244fe70af21SMatthew Dillon# We install with INSTALLSTRIPPEDMODULES to make things fit into the ISO. 245fe70af21SMatthew Dillon# We leave the kernel's debug variables intact. 246fe70af21SMatthew Dillon# 2476ca9a59cSMatthew Dillonbuildiso: 24892b0ebb9SMatthew Dillon -rm -rf ${ISOROOT} 24992b0ebb9SMatthew Dillon -chflags -R noschg ${ISOROOT} 25092b0ebb9SMatthew Dillon rm -rf ${ISOROOT} 25192b0ebb9SMatthew Dillon mkdir -p ${ISOROOT} 2525b22b655SMatthew Dillon if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi 253f4ec1279SSascha Wildner ( cd ${.CURDIR}/..; make -DWANT_INSTALLER DESTDIR=${ISOROOT} installworld ) 254ab64cf06SSimon Schubert ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \ 255ab64cf06SSimon Schubert make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution ) 25621aa02d0SChris Pressey cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd 257588a679cSSimon Schubert cd ${.CURDIR}/..; \ 258588a679cSSimon Schubert for kernconf in ${KERNCONF}; do \ 25991856cf5SSascha Wildner make DESTDIR=${ISOROOT} installkernel KERNCONF=$${kernconf}; \ 260588a679cSSimon Schubert done 26191856cf5SSascha Wildner rm -rf ${ISOROOT}/boot/kernel.old 26291856cf5SSascha Wildner ln -s kernel ${ISOROOT}/boot/kernel/kernel.BOOTP 2639e5f57baSSascha Wildner mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/ 2646ca9a59cSMatthew Dillon mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var 2656ca9a59cSMatthew Dillon dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev 2668188de86SMatthew Dillon 267fe70af21SMatthew Dillon# The GUI build includes the pkgsrc tree (~1G+) while the nominal release 268fe70af21SMatthew Dillon# build does not. 269fe70af21SMatthew Dillon# 270fe70af21SMatthew Dillon# The GUI build includes full sources while the nominal release build 271fe70af21SMatthew Dillon# only includes kernel sources (~27MB). 27219d86faaSMatthew Dillon# 273e2dbfa0bSThomas Nikolajsensrcs: 274e2dbfa0bSThomas Nikolajsen.if !defined(WITHOUT_SRCS) 275c19c746bSMatthew Dillon.if make(gui) 2763342e40aSMatthew Dillon rm -f ${ISOROOT}/usr/src-sys.tgz 2773342e40aSMatthew Dillon rm -f ${ISOROOT}/usr/src-sys.tar.bz2 2783342e40aSMatthew Dillon cd ${ISOROOT}/usr && make pkgsrc-create-repo GITHOST=${GITHOST} 279*c59cfa66SSascha Wildner # NOTE: Adding the git gc --aggressive helps by significantly 280*c59cfa66SSascha Wildner # reducing the disk space required. 281*c59cfa66SSascha Wildner # 282*c59cfa66SSascha Wildner cd ${ISOROOT}/usr/pkgsrc && git gc --aggressive 2833342e40aSMatthew Dillon cd ${ISOROOT}/usr && make src-create-repo GITHOST=${GITHOST} 284c19c746bSMatthew Dillon.else 285e2dbfa0bSThomas Nikolajsen rm -f ${ISOROOT}/usr/src-sys.tgz 286fe70af21SMatthew Dillon rm -f ${ISOROOT}/usr/src-sys.tar.bz2 287cacf78aaSSascha Wildner cd ${.CURDIR}/.. && tar --exclude .git -s '/^\./src/' \ 288fe70af21SMatthew Dillon -cf - ./Makefile ./Makefile.inc1 ./sys | \ 289fe70af21SMatthew Dillon bzip2 -9 > ${ISOROOT}/usr/src-sys.tar.bz2 290c19c746bSMatthew Dillon.endif 29166b79064SMatthew Dillon.endif 29219d86faaSMatthew Dillon 2935af45f85SMatthew Dillon# Customize the ISO by copying rootskels in reverse priority order, 2945af45f85SMatthew Dillon# building packages, and doing other post-install tasks. 2955af45f85SMatthew Dillon# 2968188de86SMatthew Dilloncustomizeiso: 2975af45f85SMatthew Dillon # Copy the rootskels. Allow sources to be owned by someone other 2983cf4b4a1SSascha Wildner # than root (as is common when checked out via git). 2995af45f85SMatthew Dillon # 3008188de86SMatthew Dillon.for ROOTSKEL in ${ROOTSKELS} 3018188de86SMatthew Dillon cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT} 3025af45f85SMatthew Dillon @test -O ${.CURDIR} || echo "chowning copied files to root:wheel" 3035af45f85SMatthew Dillon @test -O ${.CURDIR} || ((cd ${ROOTSKEL} && find .) | fgrep -v cpignore | (cd ${ISOROOT} && xargs chown root:wheel)) 3048188de86SMatthew Dillon.endfor 3057249926bSMatthew Dillon pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd 3064fba3387SChris Pressey.for UPGRADE_ITEM in Makefile \ 3074fba3387SChris Pressey etc.${MACHINE_ARCH} \ 3084fba3387SChris Pressey rc.d/Makefile \ 3094fba3387SChris Pressey periodic/Makefile \ 3104fba3387SChris Pressey periodic/daily/Makefile \ 3114fba3387SChris Pressey periodic/security/Makefile \ 3124fba3387SChris Pressey periodic/weekly/Makefile \ 3134fba3387SChris Pressey periodic/monthly/Makefile 3144fba3387SChris Pressey cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM} 3154fba3387SChris Pressey.endfor 3168abe78a1SMatthew Dillon # 3178abe78a1SMatthew Dillon # Setup some things & mount pkgsrc tree. Use defensive umounts and 3188abe78a1SMatthew Dillon # rm -rf's to allow restarts. Allow /usr/pkgsrc to be read-only. 3198abe78a1SMatthew Dillon # 3208abe78a1SMatthew Dillon # If we did not get past the bootstrap we clean out the entire 3218abe78a1SMatthew Dillon # /usr/pkg infrastructure. Otherwise we attempt to pick up where 3228abe78a1SMatthew Dillon # we left off. 3238abe78a1SMatthew Dillon # 324fbc26094SSascha Wildner cp -p /etc/resolv.conf ${ISOROOT}/etc 325cc55a235SSimon Schubert ${CHROOT_CMD} "ldconfig -elf /usr/lib /usr/lib/gcc* /usr/lib/compat" 3268abe78a1SMatthew Dillon -@umount ${ISOROOT}/usr/pkgsrc/distfiles 3278abe78a1SMatthew Dillon -@umount ${ISOROOT}/usr/pkgsrc 32845e80934SMatthew Dillon -@umount ${ISOROOT}/dev 3298abe78a1SMatthew Dillon mkdir -p ${ISODIR}/distfiles 3308abe78a1SMatthew Dillon rm -rf ${ISOROOT}/usr/pkgobj 3318abe78a1SMatthew Dillon # 3321eeae16fSMatthew Dillon # Mount /usr/pkgsrc, make sure /usr/pkgsrc/distfiles is writable. 3331eeae16fSMatthew Dillon # Make /usr/pkgsrc read-only for safety, else a failed umount and 3341eeae16fSMatthew Dillon # our rm -rf will do bad things. 3358abe78a1SMatthew Dillon # 3368abe78a1SMatthew Dillon mkdir -p ${ISOROOT}/usr/pkgobj 3373aa2328eSSimon Schubert mkdir -p ${ISOROOT}/usr/pkgobj/bootstrap 3388abe78a1SMatthew Dillon mkdir -p ${ISOROOT}/usr/pkgsrc 3391eeae16fSMatthew Dillon mount_null -o ro ${PKGSRC_PATH} ${ISOROOT}/usr/pkgsrc 3400c5de895SSimon Schubert mount_null /dev ${ISOROOT}/dev 3415af45f85SMatthew Dillon cp /etc/shells ${ISOROOT}/usr/pkgsrc/distfiles/.test > /dev/null 2>&1 \ 3425af45f85SMatthew Dillon || mount_null ${ISODIR}/distfiles ${ISOROOT}/usr/pkgsrc/distfiles 3438abe78a1SMatthew Dillon # 3445af45f85SMatthew Dillon # Bootstrap, if not already installed, and add licenses needed 345ee3561eeSMatthew Dillon # for the gui release 3468abe78a1SMatthew Dillon # 347c19c746bSMatthew Dillon test -e ${ISODIR}/.didbootstrap || \ 348c19c746bSMatthew Dillon rm -rf ${ISOROOT}/usr/pkg ${ISOROOT}/var/db/pkg \ 349c19c746bSMatthew Dillon ${ISOROOT}/var/db/pkg.refcount 350c19c746bSMatthew Dillon test -e ${ISODIR}/.didbootstrap || \ 3518abe78a1SMatthew Dillon ${CHROOT_CMD} "cd /usr/pkgsrc/bootstrap; \ 352bfe02609SSascha Wildner export share_dir=/usr/pkgobj/bootstrap/work/share; \ 3531a0dc460SSascha Wildner env USE_DESTDIR=no ./bootstrap --workdir /usr/pkgobj/bootstrap/work" 354c19c746bSMatthew Dillon test -e ${ISODIR}/.didbootstrap || \ 355ee3561eeSMatthew Dillon echo ".ifdef BSD_PKG_MK # added by nrelease" \ 356ee3561eeSMatthew Dillon >> ${ISOROOT}/usr/pkg/etc/mk.conf 357c19c746bSMatthew Dillon test -e ${ISODIR}/.didbootstrap || \ 358484de26aSSascha Wildner echo "PKG_DEFAULT_OPTIONS=dri inet6" \ 35945785050SSascha Wildner >> ${ISOROOT}/usr/pkg/etc/mk.conf 36045785050SSascha Wildner.if make(gui) 36145785050SSascha Wildner test -e ${ISODIR}/.didbootstrap || \ 362ee3561eeSMatthew Dillon echo "ACCEPTABLE_LICENSES+=openmotif-license" \ 363ee3561eeSMatthew Dillon >> ${ISOROOT}/usr/pkg/etc/mk.conf 364c19c746bSMatthew Dillon test -e ${ISODIR}/.didbootstrap || \ 365ee3561eeSMatthew Dillon echo "ACCEPTABLE_LICENSES+=vim-license" \ 366ee3561eeSMatthew Dillon >> ${ISOROOT}/usr/pkg/etc/mk.conf 36745785050SSascha Wildner.endif 368c19c746bSMatthew Dillon test -e ${ISODIR}/.didbootstrap || \ 369ee3561eeSMatthew Dillon echo ".endif # added by nrelease" \ 370ee3561eeSMatthew Dillon >> ${ISOROOT}/usr/pkg/etc/mk.conf 371c19c746bSMatthew Dillon test -e ${ISODIR}/.didbootstrap || sync 372c19c746bSMatthew Dillon test -e ${ISODIR}/.didbootstrap || touch ${ISODIR}/.didbootstrap 3738abe78a1SMatthew Dillon # 3748abe78a1SMatthew Dillon # Build and install packages, skip packages already installed 3758abe78a1SMatthew Dillon # 37620585f87SMatthew Dillon.for PKG in ${PKGSRC_PACKAGES} 3778abe78a1SMatthew Dillon ${CHROOT_CMD} "cd /usr/pkgsrc/${PKG} && \ 3783fff415bSSascha Wildner (bmake check > /dev/null 2>&1 || \ 3791a0dc460SSascha Wildner env USE_DESTDIR=no bmake ${PKGSRC_OPTIONS} clean build install)" 38020585f87SMatthew Dillon.endfor 3818abe78a1SMatthew Dillon # 38231d5c88cSSascha Wildner # Remove packages which nothing depends on, add a whatis database 38331d5c88cSSascha Wildner # for pkgsrc manual pages, create an initial locate database and 38431d5c88cSSascha Wildner # clean up 3858abe78a1SMatthew Dillon # 386cc55a235SSimon Schubert ${CHROOT_CMD} "pkg_leaves | xargs pkg_delete -R" 38731d5c88cSSascha Wildner ${CHROOT_CMD} "makewhatis /usr/pkg/man" 3888abe78a1SMatthew Dillon -umount ${ISOROOT}/usr/pkgsrc/distfiles 389fbc26094SSascha Wildner umount ${ISOROOT}/usr/pkgsrc 390589a5738SSascha Wildner rm -rf ${ISOROOT}/usr/pkgobj 391fbc26094SSascha Wildner rm -f ${ISOROOT}/etc/resolv.conf 39231d5c88cSSascha Wildner ${CHROOT_CMD} /etc/periodic/weekly/310.locate 39331d5c88cSSascha Wildner umount ${ISOROOT}/dev 394d68fa6c5SMatthew Dillon # 395d68fa6c5SMatthew Dillon # Recopy files that pkgsrc may have updated in /etc into /etc.hdd 396d68fa6c5SMatthew Dillon # 397d68fa6c5SMatthew Dillon cpdup ${ISOROOT}/etc/shells ${ISOROOT}/etc.hdd/shells 398d68fa6c5SMatthew Dillon cpdup ${ISOROOT}/etc/group ${ISOROOT}/etc.hdd/group 3998398ca17SSascha Wildner 4006ca9a59cSMatthew Dillonmkiso: 401bce110a5SMatthew Dillon ( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \ 40274ec6a9dSSascha Wildner -R -J -o ${ISOFILE} \ 40364bba8c7SSimon Schubert -V "DragonFly `${.CURDIR}/../tools/gitrev.sh | cut -c -22`" . ) 404b9c3e754SMichael Neumann 405b9c3e754SMichael Neumannmkimg: 40660b68cbbSMichael Neumann if [ ! -d ${IMGMNT} ]; then mkdir -p ${IMGMNT}; fi 4079a122c9aSMatthew Dillon -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \ 4089a122c9aSMatthew Dillon vnconfig -u `cat ${ISODIR}/vn.which`; fi 409fe70af21SMatthew Dillon.ifdef IMGSIZE 410fe70af21SMatthew Dillon @echo "STEP: use an image size of ${IMGSIZE} 512-byte sectors" 411fe70af21SMatthew Dillon rm -f ${IMGFILE} 412fe70af21SMatthew Dillon sz=`bc -e "((${IMGSIZE}) * 512)" -equit`; truncate -s $${sz} ${IMGFILE} 413fe70af21SMatthew Dillon.else 4143342e40aSMatthew Dillon @echo "STEP: Determine required image size in 1GB steps" 4153342e40aSMatthew Dillon @echo " Leave ~600MB of unused space" 41660b68cbbSMichael Neumann sz=`du -ck ${ISOROOT} | tail -n 1 | cut -f 1`; \ 4173342e40aSMatthew Dillon sz=`bc -e "(($${sz}) * 1.15 + 999999 + 600000) / 1000000" -equit | \ 418fe70af21SMatthew Dillon cut -f1 -d.`; \ 419c843f8b0SMatthew Dillon sz=`bc -e "(($${sz}) * 953)" -equit | cut -f1 -d.`; \ 420fe70af21SMatthew Dillon rm -f ${IMGFILE}; \ 421fe70af21SMatthew Dillon truncate -s $${sz}M ${IMGFILE}; 422fe70af21SMatthew Dillon.endif 4239a122c9aSMatthew Dillon fdisk -IB -p ${IMGFILE} 4249a122c9aSMatthew Dillon @echo "STEP: determine free vn device" 4259a122c9aSMatthew Dillon vnconfig -l | grep "not in use" | head -n 1 | \ 4269a122c9aSMatthew Dillon cut -f 1 -d: > ${ISODIR}/vn.which 4279a122c9aSMatthew Dillon vnconfig -e -s labels `cat ${ISODIR}/vn.which` ${IMGFILE} 4289a122c9aSMatthew Dillon @echo "STEP: write standard disklabel" 4299a122c9aSMatthew Dillon disklabel -w -r `cat ${ISODIR}/vn.which`s1 auto 4309a122c9aSMatthew Dillon @echo "STEP: read disklabel back" 4319a122c9aSMatthew Dillon disklabel -r `cat ${ISODIR}/vn.which`s1 > ${IMGFILE}.label 4329a122c9aSMatthew Dillon @echo "STEP: determine number of sectors of whole disk" 43360b68cbbSMichael Neumann secs=`tail -n 1 ${IMGFILE}.label | cut -f 3 -w`; \ 4349a122c9aSMatthew Dillon echo " a: $${secs} 0 4.2BSD" >> ${IMGFILE}.label; 4359a122c9aSMatthew Dillon @echo "STEP: write modified disklabel back" 4369a122c9aSMatthew Dillon disklabel -R -r `cat ${ISODIR}/vn.which`s1 ${IMGFILE}.label 4379a122c9aSMatthew Dillon rm ${IMGFILE}.label 4389a122c9aSMatthew Dillon @echo "STEP: write bootsector" 4399a122c9aSMatthew Dillon disklabel -B `cat ${ISODIR}/vn.which`s1 4409a122c9aSMatthew Dillon boot0cfg -B -o noupdate `cat ${ISODIR}/vn.which` 4419a122c9aSMatthew Dillon newfs /dev/`cat ${ISODIR}/vn.which`s1a 4429a122c9aSMatthew Dillon mount /dev/`cat ${ISODIR}/vn.which`s1a ${IMGMNT} 4439a122c9aSMatthew Dillon cpdup ${ISOROOT} ${IMGMNT} 4449a122c9aSMatthew Dillon @echo "STEP: fixup ${IMGMNT}/etc/fstab" 445e36bedafSSascha Wildner echo "/dev/${IMGUSBDEV}s1a / ufs rw,noatime 0 1" > ${IMGMNT}/etc/fstab 4463342e40aSMatthew Dillon echo "dummy /tmp tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab 4473342e40aSMatthew Dillon echo "dummy /var/tmp tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab 4483342e40aSMatthew Dillon echo "dummy /var/run tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab 4493342e40aSMatthew Dillon echo "dummy /usr/obj tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab 4509a122c9aSMatthew Dillon echo "proc /proc procfs rw 0 0" >> ${IMGMNT}/etc/fstab 4519a122c9aSMatthew Dillon @echo "STEP: fixup ${IMGMNT}/boot/loader.conf" 4529a122c9aSMatthew Dillon -fgrep -v kernel_options ${IMGMNT}/boot/loader.conf > ${IMGMNT}/boot/loader.conf.new 4539a122c9aSMatthew Dillon echo 'vfs.root.mountfrom="ufs:${IMGUSBDEV}s1a"' >> ${IMGMNT}/boot/loader.conf.new 4549a122c9aSMatthew Dillon mv ${IMGMNT}/boot/loader.conf.new ${IMGMNT}/boot/loader.conf 4559a122c9aSMatthew Dillon @echo "STEP: cleanup" 4569a122c9aSMatthew Dillon df ${IMGMNT} 4579a122c9aSMatthew Dillon umount ${IMGMNT} 4589a122c9aSMatthew Dillon vnconfig -u `cat ${ISODIR}/vn.which` 4599a122c9aSMatthew Dillon rm -f ${ISODIR}/vn.which 46060b68cbbSMichael Neumann rmdir ${IMGMNT} 4619a122c9aSMatthew Dillon @echo "STEP: done" 462b9c3e754SMichael Neumann 4636ca9a59cSMatthew Dillonclean: 464c19c746bSMatthew Dillon -umount ${ISOROOT}/usr/pkgsrc/distfiles > /dev/null 2>&1 465c19c746bSMatthew Dillon -umount ${ISOROOT}/usr/pkgsrc > /dev/null 2>&1 4669a122c9aSMatthew Dillon -umount ${ISOROOT}/dev > /dev/null 2>&1 4679a122c9aSMatthew Dillon -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \ 4689a122c9aSMatthew Dillon vnconfig -u `cat ${ISODIR}/vn.which`; fi 4696ca9a59cSMatthew Dillon if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi 470c19c746bSMatthew Dillon rm -rf ${ISOROOT} 471c19c746bSMatthew Dillon rm -rf ${NRLOBJDIR}/nrelease 4729a122c9aSMatthew Dillon rm -f ${ISODIR}/.didbootstrap ${ISODIR}/vn.which 4736ca9a59cSMatthew Dillon 4746ca9a59cSMatthew Dillonrealclean: clean 4753ebedc5eSMatthew Dillon rm -rf ${OBJSYS}/${KERNCONF} 4768abe78a1SMatthew Dillon # 477bce110a5SMatthew Dillon # do not use PKGSRC_PKG_PATH here, we do not want to destroy an 478bce110a5SMatthew Dillon # override location. 4798abe78a1SMatthew Dillon # 480c19c746bSMatthew Dillon rm -rf ${ISODIR}/packages 481c19c746bSMatthew Dillon rm -rf ${ISODIR}/distfiles 4826ca9a59cSMatthew Dillon 483bce110a5SMatthew Dillonpkgsrc_bootstrap: 4840936984eSMatthew Dillon mkdir -p /usr/release/bootstrap 485de863bf0SMatthew Dillon (cd ${PKGSRC_PATH}/bootstrap; \ 486de863bf0SMatthew Dillon export share_dir=/usr/release/bootstrap/share; \ 487de863bf0SMatthew Dillon ./bootstrap --workdir /usr/release/bootstrap) 488bce110a5SMatthew Dillon 489bce110a5SMatthew Dillonpkgsrc_cdrecord: 490bce110a5SMatthew Dillon.if !exists (${PKGBIN_MKISOFS}) 4910936984eSMatthew Dillon (cd ${PKGSRC_PATH}/sysutils/cdrtools; bmake clean build install) 492bce110a5SMatthew Dillon.endif 493cc224c64SJoerg Sonnenberger 494e2dbfa0bSThomas Nikolajsenhelp all: 4955af45f85SMatthew Dillon @echo "make [gui] release - complete build from scratch" 4965af45f85SMatthew Dillon @echo "make [gui] quick - attempt to do an incremental rebuild" 4975af45f85SMatthew Dillon @echo "make [gui] realquick - attempt to restart after world & kernel" 4985af45f85SMatthew Dillon @echo "make [gui] restartpkgs - attempt to restart at the pkg building stage" 4998abe78a1SMatthew Dillon @echo "" 500fe70af21SMatthew Dillon @echo "PKGSRC_EXTRA_PACKAGES may be used to add additional pkgs" 501fe70af21SMatthew Dillon @echo "GITHOST may be used to override git.dragonflybsd.org" 502fe70af21SMatthew Dillon @echo "IMGSIZE may be used to override the .img (in 512-byte sectors)" 503588a679cSSimon Schubert 504e2dbfa0bSThomas Nikolajsen.PHONY: release quickrel realquickrel 505e2dbfa0bSThomas Nikolajsen.PHONY: installer 5069b29c40aSMatthew Dillon.PHONY: quick realquick 507e2dbfa0bSThomas Nikolajsen.PHONY: check buildworld1 buildworld2 50831d5c88cSSascha Wildner.PHONY: buildkernel1 buildkernel2 buildiso customizeiso mkiso mkimg 509796fd273SYONETANI Tomokazu.PHONY: clean realclean help all srcs 510cc224c64SJoerg Sonnenberger 5116ca9a59cSMatthew Dillon.include <bsd.prog.mk> 512