1# Makefile.usr - installed as /usr/Makefile 2# 3# Provides simple targets to download and maintain /usr/src, /usr/dports etc. 4 5GITHOST?=git.dragonflybsd.org 6GITHOST_DPORTS?=mirror-master.dragonflybsd.org 7 8THISGIT!= which git 2>/dev/null; echo 9DPTBALL=/tmp/dports.tar.gz 10PKGBALL=/tmp/pkgboot.tar.xz 11DPDLURL=https://api.github.com/repos/DragonFlyBSD/DPorts/tarball/ 12PKGBOOT_VERSION=02 13PKGBOOT_i386=bootstrap_pkg_${PKGBOOT_VERSION}_x86-32.tar.xz 14PKGBOOT_x86_64=bootstrap_pkg_${PKGBOOT_VERSION}_x86-64.tar.xz 15PKGBOOT=http://mirror-master.dragonflybsd.org/dports/bootstraps/${PKGBOOT_${MACHINE_ARCH}} 16GITNFMSG="git must be present on the system to use this option." 17ERRDP="Error: ${.CURDIR}/dports already exists" 18ERRSR="Error: ${.CURDIR}/src already exists" 19ERRNDP="Error: ${.CURDIR}/dports does not exist" 20ERRNSR="Error: ${.CURDIR}/src does not exist" 21ERRPKG="Error: Bootstrap not neccessary, ${.CURDIR}/local/sbin/pkg already exists" 22WSTARS="***************************************************************" 23WARNPS=" Warning: Delete or move ${.CURDIR}/pkg before building any dport!" 24LPATT=" make %-23s- %s\n" 25 26help all: 27 @echo "HELP:" 28 @echo 29.if exists(${.CURDIR}/dports/.git) 30 @printf ${LPATT} "dports-update" "update your dports repository from the net" 31.else 32. if exists(${.CURDIR}/dports) 33 @printf ${LPATT} "dports-replace" "Replace dports with latest tarball (Github)" 34. else 35 @printf ${LPATT} "dports-create" "fetch initial dports repository from the net" 36 @printf ${LPATT} "dports-create-shallow" "fetch initial history-free dports repository" 37 @printf ${LPATT} "dports-download" "download & install dports tarball (Github)" 38. endif 39.endif 40 @printf ${LPATT} "pkg-bootstrap" "Use pre-built pkg to install dports packages" 41 @printf ${LPATT} "pkg-bootstrap-force" "Force it (pkg.conf will be overwritten)" 42 @echo 43 44.if exists(${.CURDIR}/src/.git) 45.if exists(${.CURDIR}/src/Makefile) 46 @printf ${LPATT} "src-update" "update your src repository from the net" 47.else 48 @printf ${LPATT} "src-checkout" "Initial checkout of src repository" 49.endif 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 @printf ${LPATT} "src-create-repo" "fetch src repository only, no checkout" 54.endif 55 @echo 56.if exists(${.CURDIR}/src-sys.tar.bz2) 57 @printf ${LPATT} "release-sys-extract" "extract the pre-packaged sys-only sources" 58 @echo 59.endif 60 @echo "If automating please feel free to run git pull's from cron." 61 @echo "We prefer once a day but you can run them more often if you desire" 62 63src-create-repo: 64.if empty(THISGIT) 65 @echo ${GITNFMSG} 66.elif exists (${.CURDIR}/src) 67 @echo ${ERRSR} 68.else 69 @echo "If problems occur you may have to rm -rf src and try again." 70 @echo 71 mkdir -p ${.CURDIR}/src 72 cd ${.CURDIR}/src && git init 73 cd ${.CURDIR}/src && \ 74 git remote add origin git://${GITHOST}/dragonfly.git 75 cd ${.CURDIR}/src && git fetch origin 76 cd ${.CURDIR}/src && git branch master origin/master 77.endif 78 79src-create: src-create-repo 80.if empty(THISGIT) 81 @echo ${GITNFMSG} 82.elif exists (${.CURDIR}/src) 83 @echo ${ERRSR} 84.else 85 cd ${.CURDIR}/src && git checkout master 86 cd ${.CURDIR}/src && git pull 87.endif 88 89src-create-shallow: 90.if empty(THISGIT) 91 @echo ${GITNFMSG} 92.elif exists (${.CURDIR}/src) 93 @echo ${ERRSR} 94.else 95 @echo "If problems occur you may have to rm -rf src and try again." 96 @echo 97 mkdir -p ${.CURDIR}/src 98 cd ${.CURDIR}/src && git init 99 cd ${.CURDIR}/src && \ 100 git remote add origin git://${GITHOST}/dragonfly.git 101 cd ${.CURDIR}/src && git fetch --depth=1 origin 102 cd ${.CURDIR}/src && git branch master origin/master 103 cd ${.CURDIR}/src && git checkout master 104 cd ${.CURDIR}/src && git pull 105.endif 106 107src-checkout: 108.if empty(THISGIT) 109 @echo ${GITNFMSG} 110.elif !exists (${.CURDIR}/src) 111 @echo ${ERRNSR} 112.else 113 cd ${.CURDIR}/src && git checkout master 114.endif 115 116src-update: 117.if empty(THISGIT) 118 @echo ${GITNFMSG} 119.elif !exists (${.CURDIR}/src) 120 @echo ${ERRNSR} 121.else 122 cd ${.CURDIR}/src && git pull 123.endif 124 125release-sys-extract: 126 cd ${.CURDIR} && tar xvpjf src-sys.tar.bz2 127 128dports-update: 129.if empty(THISGIT) 130 @echo ${GITNFMSG} 131.elif !exists (${.CURDIR}/dports) 132 @echo ${ERRNDP} 133.else 134 cd ${.CURDIR}/dports && git pull 135.endif 136 137dports-create: 138.if empty(THISGIT) 139 @echo ${GITNFMSG} 140.elif exists (${.CURDIR}/dports) 141 @echo ${ERRDP} 142.else 143 @echo "If problems occur you may have to rm -rf dports and try again." 144 @echo 145 git clone git://${GITHOST_DPORTS}/dports.git ${.CURDIR}/dports 146.if exists(${.CURDIR}/pkg) 147 @echo ${WSTARS} 148 @echo ${WARNPS} 149 @echo ${WSTARS} 150.endif 151.endif 152 153dports-create-shallow: 154.if empty(THISGIT) 155 @echo ${GITNFMSG} 156.elif exists (${.CURDIR}/dports) 157 @echo ${ERRDP} 158.else 159 @echo "If problems occur you may have to rm -rf dports and try again." 160 @echo 161 git clone --depth=1 git://${GITHOST_DPORTS}/dports.git \ 162 ${.CURDIR}/dports 163.if exists(${.CURDIR}/pkg) 164 @echo ${WSTARS} 165 @echo ${WARNPS} 166 @echo ${WSTARS} 167.endif 168.endif 169 170dports-download: 171.if exists (${.CURDIR}/dports) 172 @echo ${ERRDP} 173.else 174 rm -f ${DPTBALL} 175 fetch -o ${DPTBALL} ${DPDLURL} 176 tar -xf ${DPTBALL} -C ${.CURDIR} 177 mv /usr/DragonFlyBSD-DPorts-* ${.CURDIR}/dports 178 rm -f ${DPTBALL} 179.if exists(${.CURDIR}/pkg) 180 @echo ${WSTARS} 181 @echo ${WARNPS} 182 @echo ${WSTARS} 183.endif 184.endif 185 186dports-replace: 187.if !exists (${.CURDIR}/dports) 188 @echo ${ERRNDP} 189.elif exists(${.CURDIR}/dports/.git) 190 @echo "Error: this is git repository currently." 191 @echo "Remove ${.CURDIR}/dports and execute \"make dports-downloads\" if you want" 192 @echo "to convert to a non-git version." 193.else 194 rm -f ${DPTBALL} 195 fetch -o ${DPTBALL} ${DPDLURL} 196 rm -rf ${.CURDIR}/dports 197 tar -xf ${DPTBALL} -C ${.CURDIR} 198 mv /usr/DragonFlyBSD-DPorts-* ${.CURDIR}/dports 199 rm -f ${DPTBALL} 200.endif 201 202# NOTE: In force mode we also have to remove any old pkg.conf 203# which might interfere with the newer pkg bootstrap. 204# 205pkg-bootstrap-force: 206 @rm -f /usr/local/etc/pkg.conf 207 @fetch -o ${PKGBALL} ${PKGBOOT} 208 @tar -xJf ${PKGBALL} -C ${.CURDIR}/local 209 @rm -f ${PKGBALL} 210.if defined(ABIVERS) 211 ABI=${ABIVERS} ${.CURDIR}/local/sbin/pkg-static install -y -f pkg 212.else 213 ${.CURDIR}/local/sbin/pkg-static install -y -f pkg 214.endif 215 216pkg-bootstrap: 217.if exists(${.CURDIR}/local/sbin/pkg) 218 @echo ${ERRPKG} 219.elif exists(${.CURDIR}/local/etc/pkg.conf) 220 @echo "Error: ${.CURDIR}/local/etc/pkg.conf will be ovewritten" 221 @echo "Please move this file and rerun 'make pkg-bootstrap'" 222.else 223 @fetch -o ${PKGBALL} ${PKGBOOT} 224 @tar -xJf ${PKGBALL} -C ${.CURDIR}/local 225 @rm -f ${PKGBALL} 226.if defined(ABIVERS) 227 ABI=${ABIVERS} ${.CURDIR}/local/sbin/pkg-static install -y pkg 228.else 229 ${.CURDIR}/local/sbin/pkg-static install -y pkg 230.endif 231.endif 232