1 # Makefile.usr - installed as /usr/Makefile
3 # Provides simple targets to download and maintain /usr/src, /usr/dports etc.
5 GITHOST?=git.dragonflybsd.org
6 GITHOST_DPORTS?=mirror-master.dragonflybsd.org
8 THISGIT!= which git 2>/dev/null; echo
9 DPTBALL=/tmp/dports.tar.gz
10 PKGBALL=/tmp/pkgboot.tar.xz
11 DPDLURL=https://api.github.com/repos/DragonFlyBSD/DPorts/tarball/
13 PKGBOOT_i386=bootstrap_pkg_${PKGBOOT_VERSION}_x86-32.tar.xz
14 PKGBOOT_x86_64=bootstrap_pkg_${PKGBOOT_VERSION}_x86-64.tar.xz
15 PKGBOOT=http://mirror-master.dragonflybsd.org/dports/bootstraps/${PKGBOOT_${MACHINE_ARCH}}
16 GITNFMSG="git must be present on the system to use this option."
17 ERRDP="Error: ${.CURDIR}/dports already exists"
18 ERRSR="Error: ${.CURDIR}/src already exists"
19 ERRNDP="Error: ${.CURDIR}/dports does not exist"
20 ERRNSR="Error: ${.CURDIR}/src does not exist"
21 ERRPKG="Error: Bootstrap not neccessary, ${.CURDIR}/local/sbin/pkg already exists"
22 WSTARS="***************************************************************"
23 WARNPS=" Warning: Delete or move ${.CURDIR}/pkg before building any dport!"
24 LPATT=" make %-23s- %s\n"
29 .if exists(${.CURDIR}/dports/.git)
30 @printf ${LPATT} "dports-update" "update your dports repository from the net"
32 . if exists(${.CURDIR}/dports)
33 @printf ${LPATT} "dports-replace" "Replace dports with latest tarball (Github)"
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)"
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)"
44 .if exists(${.CURDIR}/src/.git)
45 .if exists(${.CURDIR}/src/Makefile)
46 @printf ${LPATT} "src-update" "update your src repository from the net"
48 @printf ${LPATT} "src-checkout" "Initial checkout of src repository"
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"
56 .if exists(${.CURDIR}/src-sys.tar.bz2)
57 @printf ${LPATT} "release-sys-extract" "extract the pre-packaged sys-only sources"
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"
66 .elif exists (${.CURDIR}/src)
69 @echo "If problems occur you may have to rm -rf src and try again."
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
79 src-create: src-create-repo
82 .elif exists (${.CURDIR}/src)
85 cd ${.CURDIR}/src && git checkout master
86 cd ${.CURDIR}/src && git pull
92 .elif exists (${.CURDIR}/src)
95 @echo "If problems occur you may have to rm -rf src and try again."
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
110 .elif !exists (${.CURDIR}/src)
113 cd ${.CURDIR}/src && git checkout master
119 .elif !exists (${.CURDIR}/src)
122 cd ${.CURDIR}/src && git pull
126 cd ${.CURDIR} && tar xvpjf src-sys.tar.bz2
131 .elif !exists (${.CURDIR}/dports)
134 cd ${.CURDIR}/dports && git pull
140 .elif exists (${.CURDIR}/dports)
143 @echo "If problems occur you may have to rm -rf dports and try again."
145 git clone git://${GITHOST_DPORTS}/dports.git ${.CURDIR}/dports
146 .if exists(${.CURDIR}/pkg)
153 dports-create-shallow:
156 .elif exists (${.CURDIR}/dports)
159 @echo "If problems occur you may have to rm -rf dports and try again."
161 git clone --depth=1 git://${GITHOST_DPORTS}/dports.git \
163 .if exists(${.CURDIR}/pkg)
171 .if exists (${.CURDIR}/dports)
175 fetch -o ${DPTBALL} ${DPDLURL}
176 tar -xf ${DPTBALL} -C ${.CURDIR}
177 mv /usr/DragonFlyBSD-DPorts-* ${.CURDIR}/dports
179 .if exists(${.CURDIR}/pkg)
187 .if !exists (${.CURDIR}/dports)
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."
195 fetch -o ${DPTBALL} ${DPDLURL}
196 rm -rf ${.CURDIR}/dports
197 tar -xf ${DPTBALL} -C ${.CURDIR}
198 mv /usr/DragonFlyBSD-DPorts-* ${.CURDIR}/dports
202 # NOTE: In force mode we also have to remove any old pkg.conf
203 # which might interfere with the newer pkg bootstrap.
206 @rm -f /usr/local/etc/pkg.conf
207 @fetch -o ${PKGBALL} ${PKGBOOT}
208 @tar -xJf ${PKGBALL} -C ${.CURDIR}/local
211 ABI=${ABIVERS} ${.CURDIR}/local/sbin/pkg-static install -y -f pkg
213 ${.CURDIR}/local/sbin/pkg-static install -y -f pkg
217 .if exists(${.CURDIR}/local/sbin/pkg)
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'"
223 @fetch -o ${PKGBALL} ${PKGBOOT}
224 @tar -xJf ${PKGBALL} -C ${.CURDIR}/local
227 ABI=${ABIVERS} ${.CURDIR}/local/sbin/pkg-static install -y pkg
229 ${.CURDIR}/local/sbin/pkg-static install -y pkg