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 DPDLURL=https://api.github.com/repos/jrmarino/DPorts/tarball/
10 GITNFMSG="git must be present on the system to use this option."
11 ERRPS="Error: ${.CURDIR}/pkgsrc already exists"
12 ERRDP="Error: ${.CURDIR}/dports already exists"
13 ERRSR="Error: ${.CURDIR}/src already exists"
14 ERRNPS="Error: ${.CURDIR}/pkgsrc does not exist"
15 ERRNDP="Error: ${.CURDIR}/dports does not exist"
16 ERRNSR="Error: ${.CURDIR}/src does not exist"
17 WSTARS="***************************************************************"
18 WARNPS=" Warning: Delete or move ${.CURDIR}/pkg before building any dport!"
19 LPATT=" make %-23s- %s\n"
24 .if exists(${.CURDIR}/pkgsrc/.git)
25 .if exists(${.CURDIR}/pkgsrc/Makefile)
26 @printf ${LPATT} "pkgsrc-update" "update your pkgsrc repo from the net"
28 @printf ${LPATT} "pkgsrc-checkout" "Initial checkout of pkgsrc repository"
31 @printf ${LPATT} "pkgsrc-create" "fetch initial pkgsrc repository from the net"
32 @printf ${LPATT} "pkgsrc-create-shallow" "fetch initial history-free pkgsrc repository"
33 @printf ${LPATT} "pkgsrc-create-repo" "fetch pkgsrc repository only, no checkout"
36 .if exists(${.CURDIR}/dports/.git)
37 @printf ${LPATT} "dports-update" "update your dports repo from Github"
39 . if exists(${.CURDIR}/dports)
40 @printf ${LPATT} "dports-replace" "Replace dports with latest tarball from Github"
42 @printf ${LPATT} "dports-create" "fetch initial dports repository from Github"
43 @printf ${LPATT} "dports-create-shallow" "fetch initial history-free dports repository"
44 @printf ${LPATT} "dports-download" "download & install dports tarball from Github"
49 .if exists(${.CURDIR}/src/.git)
50 .if exists(${.CURDIR}/src/Makefile)
51 @printf ${LPATT} "src-update" "update your src repository from the net"
53 @printf ${LPATT} "src-checkout" "Initial checkout of src repository"
56 @printf ${LPATT} "src-create" "fetch initial src repository from the net"
57 @printf ${LPATT} "src-create-shallow" "fetch initial history-free src repository"
58 @printf ${LPATT} "src-create-repo" "fetch src repository only, no checkout"
61 .if exists(${.CURDIR}/src-sys.tar.bz2)
62 @printf ${LPATT} "release-sys-extract" "extract the pre-packaged sys-only sources"
65 @echo "If automating please feel free to run git pull's from cron."
66 @echo "We prefer once a day but you can run them more often if you desire"
71 .elif exists (${.CURDIR}/pkgsrc)
74 @echo "If problems occur you may have to rm -rf pkgsrc and try again."
76 mkdir -p ${.CURDIR}/pkgsrc
77 cd ${.CURDIR}/pkgsrc && git init
78 cd ${.CURDIR}/pkgsrc && \
79 git remote add origin git://${GITHOST}/pkgsrcv2.git
80 cd ${.CURDIR}/pkgsrc && git fetch origin
81 cd ${.CURDIR}/pkgsrc && git branch master origin/master
84 pkgsrc-create: pkgsrc-create-repo
87 .elif exists (${.CURDIR}/pkgsrc)
90 cd ${.CURDIR}/pkgsrc && git checkout master
91 cd ${.CURDIR}/pkgsrc && git pull
94 pkgsrc-create-shallow:
97 .elif exists (${.CURDIR}/pkgsrc)
100 @echo "If problems occur you may have to rm -rf pkgsrc and try again."
102 mkdir -p ${.CURDIR}/pkgsrc
103 cd ${.CURDIR}/pkgsrc && git init
104 cd ${.CURDIR}/pkgsrc && \
105 git remote add origin git://${GITHOST}/pkgsrcv2.git
106 cd ${.CURDIR}/pkgsrc && git fetch --depth=1 origin
107 cd ${.CURDIR}/pkgsrc && git branch master origin/master
108 cd ${.CURDIR}/pkgsrc && git checkout master
109 cd ${.CURDIR}/pkgsrc && git pull
115 .elif !exists (${.CURDIR}/pkgsrc)
118 cd ${.CURDIR}/pkgsrc && git checkout master
124 .elif !exists (${.CURDIR}/pkgsrc)
127 cd ${.CURDIR}/pkgsrc && git pull
133 .elif exists (${.CURDIR}/src)
136 @echo "If problems occur you may have to rm -rf src and try again."
138 mkdir -p ${.CURDIR}/src
139 cd ${.CURDIR}/src && git init
140 cd ${.CURDIR}/src && \
141 git remote add origin git://${GITHOST}/dragonfly.git
142 cd ${.CURDIR}/src && git fetch origin
143 cd ${.CURDIR}/src && git branch master origin/master
146 src-create: src-create-repo
149 .elif exists (${.CURDIR}/src)
152 cd ${.CURDIR}/src && git checkout master
153 cd ${.CURDIR}/src && git pull
159 .elif exists (${.CURDIR}/src)
162 @echo "If problems occur you may have to rm -rf src and try again."
164 mkdir -p ${.CURDIR}/src
165 cd ${.CURDIR}/src && git init
166 cd ${.CURDIR}/src && \
167 git remote add origin git://${GITHOST}/dragonfly.git
168 cd ${.CURDIR}/src && git fetch --depth=1 origin
169 cd ${.CURDIR}/src && git branch master origin/master
170 cd ${.CURDIR}/src && git checkout master
171 cd ${.CURDIR}/src && git pull
177 .elif !exists (${.CURDIR}/src)
180 cd ${.CURDIR}/src && git checkout master
186 .elif !exists (${.CURDIR}/src)
189 cd ${.CURDIR}/src && git pull
193 cd ${.CURDIR} && tar xvpjf src-sys.tar.bz2
198 .elif !exists (${.CURDIR}/dports)
201 cd ${.CURDIR}/dports && git pull
207 .elif exists (${.CURDIR}/dports)
210 @echo "If problems occur you may have to rm -rf dports and try again."
212 git clone git://github.com/jrmarino/DPorts.git ${.CURDIR}/dports
213 .if exists(${.CURDIR}/pkg)
220 dports-create-shallow:
223 .elif exists (${.CURDIR}/dports)
226 @echo "If problems occur you may have to rm -rf dports and try again."
228 git clone --depth=1 git://github.com/jrmarino/DPorts.git \
230 .if exists(${.CURDIR}/pkg)
238 .if exists (${.CURDIR}/dports)
242 fetch -o ${DPTBALL} ${DPDLURL}
243 tar -xf ${DPTBALL} -C ${.CURDIR}
244 mv /usr/jrmarino-DPorts-* ${.CURDIR}/dports
246 .if exists(${.CURDIR}/pkg)
254 .if !exists (${.CURDIR}/dports)
256 .elif exists(${.CURDIR}/dports/.git)
257 @echo "Error: this is git repository currently."
258 @echo "Remove ${.CURDIR}/dports and execute \"make dports-downloads\" if you want"
259 @echo "to convert to a non-git version."
262 fetch -o ${DPTBALL} ${DPDLURL}
263 rm -rf ${.CURDIR}/dports
264 tar -xf ${DPTBALL} -C ${.CURDIR}
265 mv /usr/jrmarino-DPorts-* ${.CURDIR}/dports