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://leaf.dragonflybsd.org/~marino/dports-src/${PKGBOOT_${MACHINE_ARCH}}
14 GITNFMSG="git must be present on the system to use this option."
15 ERRPS="Error: ${.CURDIR}/pkgsrc already exists"
16 ERRDP="Error: ${.CURDIR}/dports already exists"
17 ERRSR="Error: ${.CURDIR}/src already exists"
18 ERRNPS="Error: ${.CURDIR}/pkgsrc does not exist"
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}/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 .if !exists(${.CURDIR}/local/sbin/pkg)
53 @printf ${LPATT} "pkg-bootstrap" "Use pre-built pkg to install dports packages"
57 .if exists(${.CURDIR}/src/.git)
58 .if exists(${.CURDIR}/src/Makefile)
59 @printf ${LPATT} "src-update" "update your src repository from the net"
61 @printf ${LPATT} "src-checkout" "Initial checkout of src repository"
64 @printf ${LPATT} "src-create" "fetch initial src repository from the net"
65 @printf ${LPATT} "src-create-shallow" "fetch initial history-free src repository"
66 @printf ${LPATT} "src-create-repo" "fetch src repository only, no checkout"
69 .if exists(${.CURDIR}/src-sys.tar.bz2)
70 @printf ${LPATT} "release-sys-extract" "extract the pre-packaged sys-only sources"
73 @echo "If automating please feel free to run git pull's from cron."
74 @echo "We prefer once a day but you can run them more often if you desire"
79 .elif exists (${.CURDIR}/pkgsrc)
82 @echo "If problems occur you may have to rm -rf pkgsrc and try again."
84 mkdir -p ${.CURDIR}/pkgsrc
85 cd ${.CURDIR}/pkgsrc && git init
86 cd ${.CURDIR}/pkgsrc && \
87 git remote add origin git://${GITHOST}/pkgsrcv2.git
88 cd ${.CURDIR}/pkgsrc && git fetch origin
89 cd ${.CURDIR}/pkgsrc && git branch master origin/master
92 pkgsrc-create: pkgsrc-create-repo
95 .elif exists (${.CURDIR}/pkgsrc)
98 cd ${.CURDIR}/pkgsrc && git checkout master
99 cd ${.CURDIR}/pkgsrc && git pull
102 pkgsrc-create-shallow:
105 .elif exists (${.CURDIR}/pkgsrc)
108 @echo "If problems occur you may have to rm -rf pkgsrc and try again."
110 mkdir -p ${.CURDIR}/pkgsrc
111 cd ${.CURDIR}/pkgsrc && git init
112 cd ${.CURDIR}/pkgsrc && \
113 git remote add origin git://${GITHOST}/pkgsrcv2.git
114 cd ${.CURDIR}/pkgsrc && git fetch --depth=1 origin
115 cd ${.CURDIR}/pkgsrc && git branch master origin/master
116 cd ${.CURDIR}/pkgsrc && git checkout master
117 cd ${.CURDIR}/pkgsrc && git pull
123 .elif !exists (${.CURDIR}/pkgsrc)
126 cd ${.CURDIR}/pkgsrc && git checkout master
132 .elif !exists (${.CURDIR}/pkgsrc)
135 cd ${.CURDIR}/pkgsrc && git pull
141 .elif exists (${.CURDIR}/src)
144 @echo "If problems occur you may have to rm -rf src and try again."
146 mkdir -p ${.CURDIR}/src
147 cd ${.CURDIR}/src && git init
148 cd ${.CURDIR}/src && \
149 git remote add origin git://${GITHOST}/dragonfly.git
150 cd ${.CURDIR}/src && git fetch origin
151 cd ${.CURDIR}/src && git branch master origin/master
154 src-create: src-create-repo
157 .elif exists (${.CURDIR}/src)
160 cd ${.CURDIR}/src && git checkout master
161 cd ${.CURDIR}/src && git pull
167 .elif exists (${.CURDIR}/src)
170 @echo "If problems occur you may have to rm -rf src and try again."
172 mkdir -p ${.CURDIR}/src
173 cd ${.CURDIR}/src && git init
174 cd ${.CURDIR}/src && \
175 git remote add origin git://${GITHOST}/dragonfly.git
176 cd ${.CURDIR}/src && git fetch --depth=1 origin
177 cd ${.CURDIR}/src && git branch master origin/master
178 cd ${.CURDIR}/src && git checkout master
179 cd ${.CURDIR}/src && git pull
185 .elif !exists (${.CURDIR}/src)
188 cd ${.CURDIR}/src && git checkout master
194 .elif !exists (${.CURDIR}/src)
197 cd ${.CURDIR}/src && git pull
201 cd ${.CURDIR} && tar xvpjf src-sys.tar.bz2
206 .elif !exists (${.CURDIR}/dports)
209 cd ${.CURDIR}/dports && git pull
215 .elif exists (${.CURDIR}/dports)
218 @echo "If problems occur you may have to rm -rf dports and try again."
220 git clone git://github.com/jrmarino/DPorts.git ${.CURDIR}/dports
221 .if exists(${.CURDIR}/pkg)
228 dports-create-shallow:
231 .elif exists (${.CURDIR}/dports)
234 @echo "If problems occur you may have to rm -rf dports and try again."
236 git clone --depth=1 git://github.com/jrmarino/DPorts.git \
238 .if exists(${.CURDIR}/pkg)
246 .if exists (${.CURDIR}/dports)
250 fetch -o ${DPTBALL} ${DPDLURL}
251 tar -xf ${DPTBALL} -C ${.CURDIR}
252 mv /usr/jrmarino-DPorts-* ${.CURDIR}/dports
254 .if exists(${.CURDIR}/pkg)
262 .if !exists (${.CURDIR}/dports)
264 .elif exists(${.CURDIR}/dports/.git)
265 @echo "Error: this is git repository currently."
266 @echo "Remove ${.CURDIR}/dports and execute \"make dports-downloads\" if you want"
267 @echo "to convert to a non-git version."
270 fetch -o ${DPTBALL} ${DPDLURL}
271 rm -rf ${.CURDIR}/dports
272 tar -xf ${DPTBALL} -C ${.CURDIR}
273 mv /usr/jrmarino-DPorts-* ${.CURDIR}/dports
278 .if exists(${.CURDIR}/local/sbin/pkg)
280 .elif exists(${.CURDIR}/local/etc/pkg.conf)
281 @echo "Error: ${.CURDIR}/local/etc/pkg.conf will be ovewritten"
282 @echo "Please move this file and rerun 'make pkg-bootstrap'"
284 @fetch -o ${PKGBALL} ${PKGBOOT}
285 @tar -xJf ${PKGBALL} -C ${.CURDIR}/local
287 @echo "type 'rehash; pkg-static install -y pkg; rehash' to install the latest pkg"