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_x86_64=bootstrap_pkg_${PKGBOOT_VERSION}_x86-64.tar.xz
14 PKGBOOT=http://mirror-master.dragonflybsd.org/dports/bootstraps/${PKGBOOT_${MACHINE_ARCH}}
15 GITNFMSG="git must be present on the system to use this option."
16 ERRDP="Error: ${.CURDIR}/dports already exists"
17 ERRSR="Error: ${.CURDIR}/src already exists"
18 ERRNDP="Error: ${.CURDIR}/dports does not exist"
19 ERRNSR="Error: ${.CURDIR}/src does not exist"
20 ERRPKG="Error: Bootstrap not necessary, ${.CURDIR}/local/sbin/pkg already exists"
21 WSTARS="***************************************************************"
22 WARNPS=" Warning: Delete or move ${.CURDIR}/pkg before building any dport!"
23 LPATT=" make %-23s- %s\n"
28 .if exists(${.CURDIR}/dports/.git)
29 @printf ${LPATT} "dports-update" "update your dports repository from the net"
31 . if exists(${.CURDIR}/dports)
32 @printf ${LPATT} "dports-replace" "Replace dports with latest tarball (Github)"
34 @printf ${LPATT} "dports-create" "fetch initial dports repository from the net"
35 @printf ${LPATT} "dports-create-shallow" "fetch initial history-free dports repository"
36 @printf ${LPATT} "dports-download" "download & install dports tarball (Github)"
39 @printf ${LPATT} "pkg-bootstrap" "Use pre-built pkg to install dports packages"
40 @printf ${LPATT} "pkg-bootstrap-force" "Force it (pkg.conf will be overwritten)"
43 .if exists(${.CURDIR}/src/.git)
44 .if exists(${.CURDIR}/src/Makefile)
45 @printf ${LPATT} "src-update" "update your src repository from the net"
47 @printf ${LPATT} "src-checkout" "Initial checkout of src repository"
50 @printf ${LPATT} "src-create" "fetch initial src repository from the net"
51 @printf ${LPATT} "src-create-shallow" "fetch initial history-free src repository"
52 @printf ${LPATT} "src-create-repo" "fetch src repository only, no checkout"
55 .if exists(${.CURDIR}/src-sys.tar.bz2)
56 @printf ${LPATT} "release-sys-extract" "extract the pre-packaged sys-only sources"
59 @echo "If automating please feel free to run git pull's from cron."
60 @echo "We prefer once a day but you can run them more often if you desire"
65 .elif exists (${.CURDIR}/src/.git)
68 @echo "If problems occur you may have to rm -rf src and try again."
70 mkdir -p ${.CURDIR}/src
71 cd ${.CURDIR}/src && git init
72 cd ${.CURDIR}/src && \
73 git remote add origin git://${GITHOST}/dragonfly.git
74 cd ${.CURDIR}/src && git fetch origin
75 cd ${.CURDIR}/src && git branch master origin/master
78 src-create: src-create-repo
81 .elif exists (${.CURDIR}/src/.git)
84 cd ${.CURDIR}/src && git checkout master
85 cd ${.CURDIR}/src && git pull
91 .elif exists (${.CURDIR}/src/.git)
94 @echo "If problems occur you may have to rm -rf src and try again."
96 mkdir -p ${.CURDIR}/src
97 cd ${.CURDIR}/src && git init
98 cd ${.CURDIR}/src && \
99 git remote add origin git://${GITHOST}/dragonfly.git
100 cd ${.CURDIR}/src && git fetch --depth=1 origin
101 cd ${.CURDIR}/src && git branch master origin/master
102 cd ${.CURDIR}/src && git checkout master
103 cd ${.CURDIR}/src && git pull
109 .elif !exists (${.CURDIR}/src/.git)
112 cd ${.CURDIR}/src && git checkout master
118 .elif !exists (${.CURDIR}/src/.git)
121 cd ${.CURDIR}/src && git pull
125 cd ${.CURDIR} && tar xvpjf src-sys.tar.bz2
130 .elif !exists (${.CURDIR}/dports)
133 cd ${.CURDIR}/dports && git pull
139 .elif exists (${.CURDIR}/dports)
142 @echo "If problems occur you may have to rm -rf dports and try again."
144 git clone git://${GITHOST_DPORTS}/dports.git ${.CURDIR}/dports
145 .if exists(${.CURDIR}/pkg)
152 dports-create-shallow:
155 .elif exists (${.CURDIR}/dports)
158 @echo "If problems occur you may have to rm -rf dports and try again."
160 git clone --depth=1 git://${GITHOST_DPORTS}/dports.git \
162 .if exists(${.CURDIR}/pkg)
170 .if exists (${.CURDIR}/dports)
174 fetch -o ${DPTBALL} ${DPDLURL}
175 tar -xf ${DPTBALL} -C ${.CURDIR}
176 mv /usr/DragonFlyBSD-DPorts-* ${.CURDIR}/dports
178 .if exists(${.CURDIR}/pkg)
186 .if !exists (${.CURDIR}/dports)
188 .elif exists(${.CURDIR}/dports/.git)
189 @echo "Error: this is git repository currently."
190 @echo "Remove ${.CURDIR}/dports and execute \"make dports-downloads\" if you want"
191 @echo "to convert to a non-git version."
194 fetch -o ${DPTBALL} ${DPDLURL}
195 rm -rf ${.CURDIR}/dports
196 tar -xf ${DPTBALL} -C ${.CURDIR}
197 mv /usr/DragonFlyBSD-DPorts-* ${.CURDIR}/dports
201 # NOTE: In force mode we also have to remove any old pkg.conf
202 # which might interfere with the newer pkg bootstrap.
205 @rm -f /usr/local/etc/pkg.conf
206 @fetch -o ${PKGBALL} ${PKGBOOT}
207 @tar -xJf ${PKGBALL} -C ${.CURDIR}/local
210 ABI=${ABIVERS} ${.CURDIR}/local/sbin/pkg-static install -y -f pkg
212 ${.CURDIR}/local/sbin/pkg-static install -y -f pkg
216 .if exists(${.CURDIR}/local/sbin/pkg)
218 .elif exists(${.CURDIR}/local/etc/pkg.conf)
219 @echo "Error: ${.CURDIR}/local/etc/pkg.conf will be ovewritten"
220 @echo "Please move this file and rerun 'make pkg-bootstrap'"
222 @fetch -o ${PKGBALL} ${PKGBOOT}
223 @tar -xJf ${PKGBALL} -C ${.CURDIR}/local
226 ABI=${ABIVERS} ${.CURDIR}/local/sbin/pkg-static install -y pkg
228 ${.CURDIR}/local/sbin/pkg-static install -y pkg