1 # Makefile.usr - installed as /usr/Makefile
3 # Provides simple targets to download and maintain /usr/src, /usr/pkgsrc etc.
5 GITHOST?=git.dragonflybsd.org
7 THISGIT!= which git 2>/dev/null; echo
8 DPTBALL=/tmp/dports.tar.gz
9 PKGBALL=/tmp/pkgboot.tar.xz
10 DPDLURL=https://api.github.com/repos/jrmarino/DPorts/tarball/
11 PKGBOOT_i386=bootstrap_pkg_x86-32.tar.xz
12 PKGBOOT_x86_64=bootstrap_pkg_x86-64.tar.xz
13 PKGBOOT=http://mirror-master.dragonflybsd.org/dports/bootstraps/${PKGBOOT_${MACHINE_ARCH}}
14 GITNFMSG="git must be present on the system to use this option."
16 ERRPS="Error: ${.CURDIR}/pkgsrc already exists"
17 ERRDP="Error: ${.CURDIR}/dports already exists"
18 ERRSR="Error: ${.CURDIR}/src already exists"
19 ERRNPS="Error: ${.CURDIR}/pkgsrc does not exist"
20 ERRNDP="Error: ${.CURDIR}/dports does not exist"
21 ERRNSR="Error: ${.CURDIR}/src does not exist"
22 ERRPKG="Error: Bootstrap not neccessary, ${.CURDIR}/local/sbin/pkg already exists"
23 WSTARS="***************************************************************"
24 WARNPS=" Warning: Delete or move ${.CURDIR}/pkg before building any dport!"
25 LPATT=" make %-23s- %s\n"
29 .if exists(${.CURDIR}/pkgsrc/.git)
30 .if exists(${.CURDIR}/pkgsrc/Makefile)
31 @printf ${LPATT} "pkgsrc-update" "update your pkgsrc repo from the net"
33 @printf ${LPATT} "pkgsrc-checkout" "Initial checkout of pkgsrc repository"
36 @printf ${LPATT} "pkgsrc-create" "fetch initial pkgsrc repository from the net"
37 @printf ${LPATT} "pkgsrc-create-shallow" "fetch initial history-free pkgsrc repository"
38 @printf ${LPATT} "pkgsrc-create-repo" "fetch pkgsrc repository only, no checkout"
41 .if exists(${.CURDIR}/dports/.git)
42 @printf ${LPATT} "dports-update" "update your dports repo from Github"
44 . if exists(${.CURDIR}/dports)
45 @printf ${LPATT} "dports-replace" "Replace dports with latest tarball from Github"
47 @printf ${LPATT} "dports-create" "fetch initial dports repository from Github"
48 @printf ${LPATT} "dports-create-shallow" "fetch initial history-free dports repository"
49 @printf ${LPATT} "dports-download" "download & install dports tarball from Github"
52 @printf ${LPATT} "pkg-bootstrap" "Use pre-built pkg to install dports packages"
53 @printf ${LPATT} "pkg-bootstrap-force" "Force it (pkg.conf will be overwritten)"
56 .if exists(${.CURDIR}/src/.git)
57 .if exists(${.CURDIR}/src/Makefile)
58 @printf ${LPATT} "src-update" "update your src repository from the net"
60 @printf ${LPATT} "src-checkout" "Initial checkout of src repository"
63 @printf ${LPATT} "src-create" "fetch initial src repository from the net"
64 @printf ${LPATT} "src-create-shallow" "fetch initial history-free src repository"
65 @printf ${LPATT} "src-create-repo" "fetch src repository only, no checkout"
68 .if exists(${.CURDIR}/src-sys.tar.bz2)
69 @printf ${LPATT} "release-sys-extract" "extract the pre-packaged sys-only sources"
72 @echo "If automating please feel free to run git pull's from cron."
73 @echo "We prefer once a day but you can run them more often if you desire"
78 .elif exists (${.CURDIR}/pkgsrc)
81 @echo "If problems occur you may have to rm -rf pkgsrc and try again."
83 mkdir -p ${.CURDIR}/pkgsrc
84 cd ${.CURDIR}/pkgsrc && git init
85 cd ${.CURDIR}/pkgsrc && \
86 git remote add origin git://${GITHOST}/pkgsrcv2.git
87 cd ${.CURDIR}/pkgsrc && git fetch origin
88 cd ${.CURDIR}/pkgsrc && git branch master origin/master
91 pkgsrc-create: pkgsrc-create-repo
94 .elif exists (${.CURDIR}/pkgsrc)
97 cd ${.CURDIR}/pkgsrc && git checkout master
98 cd ${.CURDIR}/pkgsrc && git pull
101 pkgsrc-create-shallow:
104 .elif exists (${.CURDIR}/pkgsrc)
107 @echo "If problems occur you may have to rm -rf pkgsrc and try again."
109 mkdir -p ${.CURDIR}/pkgsrc
110 cd ${.CURDIR}/pkgsrc && git init
111 cd ${.CURDIR}/pkgsrc && \
112 git remote add origin git://${GITHOST}/pkgsrcv2.git
113 cd ${.CURDIR}/pkgsrc && git fetch --depth=1 origin
114 cd ${.CURDIR}/pkgsrc && git branch master origin/master
115 cd ${.CURDIR}/pkgsrc && git checkout master
116 cd ${.CURDIR}/pkgsrc && git pull
122 .elif !exists (${.CURDIR}/pkgsrc)
125 cd ${.CURDIR}/pkgsrc && git checkout master
131 .elif !exists (${.CURDIR}/pkgsrc)
134 cd ${.CURDIR}/pkgsrc && git pull
140 .elif exists (${.CURDIR}/src)
143 @echo "If problems occur you may have to rm -rf src and try again."
145 mkdir -p ${.CURDIR}/src
146 cd ${.CURDIR}/src && git init
147 cd ${.CURDIR}/src && \
148 git remote add origin git://${GITHOST}/dragonfly.git
149 cd ${.CURDIR}/src && git fetch origin
150 cd ${.CURDIR}/src && git branch master origin/master
153 src-create: src-create-repo
156 .elif exists (${.CURDIR}/src)
159 cd ${.CURDIR}/src && git checkout master
160 cd ${.CURDIR}/src && git pull
166 .elif exists (${.CURDIR}/src)
169 @echo "If problems occur you may have to rm -rf src and try again."
171 mkdir -p ${.CURDIR}/src
172 cd ${.CURDIR}/src && git init
173 cd ${.CURDIR}/src && \
174 git remote add origin git://${GITHOST}/dragonfly.git
175 cd ${.CURDIR}/src && git fetch --depth=1 origin
176 cd ${.CURDIR}/src && git branch master origin/master
177 cd ${.CURDIR}/src && git checkout master
178 cd ${.CURDIR}/src && git pull
184 .elif !exists (${.CURDIR}/src)
187 cd ${.CURDIR}/src && git checkout master
193 .elif !exists (${.CURDIR}/src)
196 cd ${.CURDIR}/src && git pull
200 cd ${.CURDIR} && tar xvpjf src-sys.tar.bz2
205 .elif !exists (${.CURDIR}/dports)
208 cd ${.CURDIR}/dports && git pull
214 .elif exists (${.CURDIR}/dports)
217 @echo "If problems occur you may have to rm -rf dports and try again."
219 git clone git://mirror-master.dragonflybsd.org/dports.git ${.CURDIR}/dports
220 .if exists(${.CURDIR}/pkg)
227 dports-create-shallow:
230 .elif exists (${.CURDIR}/dports)
233 @echo "If problems occur you may have to rm -rf dports and try again."
235 git clone --depth=1 git://mirror-master.dragonflybsd.org/dports.git \
237 .if exists(${.CURDIR}/pkg)
245 .if exists (${.CURDIR}/dports)
249 fetch -o ${DPTBALL} ${DPDLURL}
250 tar -xf ${DPTBALL} -C ${.CURDIR}
251 mv /usr/jrmarino-DPorts-* ${.CURDIR}/dports
253 .if exists(${.CURDIR}/pkg)
261 .if !exists (${.CURDIR}/dports)
263 .elif exists(${.CURDIR}/dports/.git)
264 @echo "Error: this is git repository currently."
265 @echo "Remove ${.CURDIR}/dports and execute \"make dports-downloads\" if you want"
266 @echo "to convert to a non-git version."
269 fetch -o ${DPTBALL} ${DPDLURL}
270 rm -rf ${.CURDIR}/dports
271 tar -xf ${DPTBALL} -C ${.CURDIR}
272 mv /usr/jrmarino-DPorts-* ${.CURDIR}/dports
277 @fetch -o ${PKGBALL} ${PKGBOOT}
278 @tar -xJf ${PKGBALL} -C ${.CURDIR}/local
280 ABI=${ABIVERS} ${.CURDIR}/local/sbin/pkg-static install -y -f pkg
283 .if exists(${.CURDIR}/local/sbin/pkg)
285 .elif exists(${.CURDIR}/local/etc/pkg.conf)
286 @echo "Error: ${.CURDIR}/local/etc/pkg.conf will be ovewritten"
287 @echo "Please move this file and rerun 'make pkg-bootstrap'"
289 @fetch -o ${PKGBALL} ${PKGBOOT}
290 @tar -xJf ${PKGBALL} -C ${.CURDIR}/local
292 ABI=${ABIVERS} ${.CURDIR}/local/sbin/pkg-static install -y pkg