1# Makefile.usr - installed as /usr/Makefile 2# 3# Provides simple targets to download and maintain /usr/src, /usr/dports etc. 4 5# DragonFly BSD source repository 6GITURL_SRC?=git://git.dragonflybsd.org/dragonfly.git 7# Branch to be fetched & checked out 8# * master - latest development branch 9# * DragonFly_RELEASE_x_y - stable release branch x.y 10BRANCH?=master 11 12# DPorts source repository 13GITURL_DPORTS?=git://mirror-master.dragonflybsd.org/dports.git 14 15# Mirror from which to fetch the pkg bootstrap 16MIRROR?=https://mirror-master.dragonflybsd.org 17 18DPTBALL=/tmp/dports.tar.gz 19PKGBALL=/tmp/pkgboot.tar.xz 20DPDLURL=https://api.github.com/repos/DragonFlyBSD/DPorts/tarball/ 21PKGBOOT_VERSION=02 22PKGBOOT_x86_64=bootstrap_pkg_${PKGBOOT_VERSION}_x86-64.tar.xz 23PKGBOOT=${MIRROR}/dports/bootstraps/${PKGBOOT_${MACHINE_ARCH}} 24ERRPKG="Error: Bootstrap not necessary, ${.CURDIR}/local/sbin/pkg already exists" 25WSTARS="***************************************************************" 26WARNPS=" Warning: Delete or move ${.CURDIR}/pkg before building any dport!" 27LPATT=" make %-23s- %s\n" 28 29help all: 30 @echo "HELP:" 31 @echo 32.if exists(${.CURDIR}/dports/.git) 33 @printf ${LPATT} "dports-update" "update your dports repository from the net" 34.else 35. if exists(${.CURDIR}/dports) 36 @printf ${LPATT} "dports-replace" "Replace dports with latest tarball (Github)" 37. else 38 @printf ${LPATT} "dports-create" "fetch initial dports repository from the net" 39 @printf ${LPATT} "dports-create-shallow" "fetch initial history-free dports repository" 40 @printf ${LPATT} "dports-download" "download & install dports tarball (Github)" 41. endif 42.endif 43 @echo 44 @printf ${LPATT} "pkg-bootstrap" "Use pre-built pkg to install dports packages" 45 @printf ${LPATT} "pkg-bootstrap-force" "Force it (pkg.conf will be overwritten)" 46 @echo 47 48.if exists(${.CURDIR}/src/.git) 49 @printf ${LPATT} "src-update" "update your src repository from the net" 50.else 51 @printf ${LPATT} "src-create" "fetch initial src repository from the net" 52 @printf ${LPATT} "src-create-shallow" "fetch initial history-free src repository" 53.endif 54 @echo 55.if exists(${.CURDIR}/src-sys.tar.bz2) 56 @printf ${LPATT} "release-sys-extract" "extract the pre-packaged sys-only sources" 57 @echo 58.endif 59 @echo "src checkout branch: ${BRANCH}" 60 @echo 61 @echo "If automating please feel free to run 'git pull' from cron." 62 @echo "We prefer once a day but you can run them more often if you desire." 63 64git-check: 65 @/usr/bin/which -s git || \ 66 (echo "git must be present on the system to use this option."; /usr/bin/false) 67 68src-check: git-check 69 @/bin/test ! -d ${.CURDIR}/src/.git || \ 70 (echo "Error: ${.CURDIR}/src already exists"; /usr/bin/false) 71 72src-check-hasdir: git-check 73 @/bin/test -d ${.CURDIR}/src/.git || \ 74 (echo "Error: ${.CURDIR}/src does not exist"; /usr/bin/false) 75 76src-create: src-check 77 @echo "If problems occur you may have to 'rm -rf src' and try again." 78 @echo 79 git clone --branch ${BRANCH} -- ${GITURL_SRC} ${.CURDIR}/src 80 81src-create-shallow: src-check 82 @echo "If problems occur you may have to 'rm -rf src' and try again." 83 @echo 84 git clone --depth 1 --branch ${BRANCH} -- ${GITURL_SRC} ${.CURDIR}/src 85 86src-update: src-check-hasdir 87 cd ${.CURDIR}/src && git pull 88 89.if exists(${.CURDIR}/src-sys.tar.bz2) 90release-sys-extract: 91 cd ${.CURDIR} && tar xvpjf src-sys.tar.bz2 92.endif 93 94dports-check: git-check 95 @/bin/test ! -d ${.CURDIR}/dports/.git || \ 96 (echo "Error: ${.CURDIR}/dports already exists"; /usr/bin/false) 97 98dports-check-hasdir: git-check 99 @/bin/test -d ${.CURDIR}/dports/.git || \ 100 (echo "Error: ${.CURDIR}/dports does not exist"; /usr/bin/false) 101 102dports-download-check: 103 @/bin/test ! -d ${.CURDIR}/dports || \ 104 (echo "Error: ${.CURDIR}/dports already exists"; /usr/bin/false) 105 @/bin/test ! -d ${.CURDIR}/DragonFlyBSD-DPorts-* || \ 106 (echo "Error: ${.CURDIR}/DragonFlyBSD-DPorts-* already exists"; /usr/bin/false) 107 108dports-create: dports-check 109 @echo "If problems occur you may have to 'rm -rf dports' and try again." 110 @echo 111 git clone ${GITURL_DPORTS} ${.CURDIR}/dports 112.if exists(${.CURDIR}/pkg) 113 @echo ${WSTARS} 114 @echo ${WARNPS} 115 @echo ${WSTARS} 116.endif 117 118dports-create-shallow: dports-check 119 @echo "If problems occur you may have to 'rm -rf dports' and try again." 120 @echo 121 git clone --depth 1 ${GITURL_DPORTS} ${.CURDIR}/dports 122.if exists(${.CURDIR}/pkg) 123 @echo ${WSTARS} 124 @echo ${WARNPS} 125 @echo ${WSTARS} 126.endif 127 128dports-update: dports-check-hasdir 129 cd ${.CURDIR}/dports && git pull 130 131dports-download: dports-download-check 132 rm -f ${DPTBALL} 133 fetch -o ${DPTBALL} ${DPDLURL} 134 tar -xf ${DPTBALL} -C ${.CURDIR} 135 mv /usr/DragonFlyBSD-DPorts-* ${.CURDIR}/dports 136 rm -f ${DPTBALL} 137.if exists(${.CURDIR}/pkg) 138 @echo ${WSTARS} 139 @echo ${WARNPS} 140 @echo ${WSTARS} 141.endif 142 143dports-replace: 144.if exists(${.CURDIR}/dports/.git) 145 @echo "Error: ${.CURDIR}/dports is a git repository currently." 146 @echo "Remove ${.CURDIR}/dports and execute 'make dports-download' if you want" 147 @echo "to convert to a non-git version." 148 @/usr/bin/false 149.else 150 rm -f ${DPTBALL} 151 fetch -o ${DPTBALL} ${DPDLURL} 152 rm -rf ${.CURDIR}/dports 153 tar -xf ${DPTBALL} -C ${.CURDIR} 154 mv /usr/DragonFlyBSD-DPorts-* ${.CURDIR}/dports 155 rm -f ${DPTBALL} 156.endif 157 158# NOTE: In force mode we also have to remove any old pkg.conf 159# which might interfere with the newer pkg bootstrap. 160# 161pkg-bootstrap-force: 162 @rm -f /usr/local/etc/pkg.conf 163 @fetch -o ${PKGBALL} ${PKGBOOT} 164 @tar -xJf ${PKGBALL} -C ${.CURDIR}/local 165 @rm -f ${PKGBALL} 166.if defined(ABIVERS) 167 ABI=${ABIVERS} ${.CURDIR}/local/sbin/pkg-static install -y -f pkg 168.else 169 ${.CURDIR}/local/sbin/pkg-static install -y -f pkg 170.endif 171 172pkg-bootstrap: 173.if exists(${.CURDIR}/local/sbin/pkg) 174 @echo ${ERRPKG} 175 @/usr/bin/false 176.elif exists(${.CURDIR}/local/etc/pkg.conf) 177 @echo "Error: ${.CURDIR}/local/etc/pkg.conf will be overwritten" 178 @echo "Please move this file and rerun 'make pkg-bootstrap'" 179 @/usr/bin/false 180.else 181 @fetch -o ${PKGBALL} ${PKGBOOT} 182 @tar -xJf ${PKGBALL} -C ${.CURDIR}/local 183 @rm -f ${PKGBALL} 184.if defined(ABIVERS) 185 ABI=${ABIVERS} ${.CURDIR}/local/sbin/pkg-static install -y pkg 186.else 187 ${.CURDIR}/local/sbin/pkg-static install -y pkg 188.endif 189.endif 190