kernel - fix vkernel64 startup when no hw virtualization present
[dragonfly.git] / etc / Makefile.usr
1 # Makefile.usr - installed as /usr/Makefile
2 #
3 # Provides simple targets to download and maintain /usr/src, /usr/pkgsrc etc.
4
5 GITHOST?=git.dragonflybsd.org
6
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."
15 ABIVERS=`uname -P`
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"
26
27 help all:
28         @echo "HELP:"
29 .if exists(${.CURDIR}/pkgsrc/.git)
30 .if exists(${.CURDIR}/pkgsrc/Makefile)
31         @printf ${LPATT} "pkgsrc-update"         "update your pkgsrc repo from the net"
32 .else
33         @printf ${LPATT} "pkgsrc-checkout"       "Initial checkout of pkgsrc repository"
34 .endif
35 .else
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"
39 .endif
40         @echo
41 .if exists(${.CURDIR}/dports/.git)
42         @printf ${LPATT} "dports-update"         "update your dports repo from Github"
43 .else
44 .  if exists(${.CURDIR}/dports)
45         @printf ${LPATT} "dports-replace"        "Replace dports with latest tarball from Github"
46 .  else
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"
50 .  endif
51 .endif
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)"
54         @echo
55
56 .if exists(${.CURDIR}/src/.git)
57 .if exists(${.CURDIR}/src/Makefile)
58         @printf ${LPATT} "src-update"         "update your src repository from the net"
59 .else
60         @printf ${LPATT} "src-checkout"       "Initial checkout of src repository"
61 .endif
62 .else
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"
66 .endif
67         @echo
68 .if exists(${.CURDIR}/src-sys.tar.bz2)
69         @printf ${LPATT} "release-sys-extract" "extract the pre-packaged sys-only sources"
70         @echo
71 .endif
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"
74
75 pkgsrc-create-repo:
76 .if empty(THISGIT)
77         @echo ${GITNFMSG}
78 .elif exists (${.CURDIR}/pkgsrc)
79         @echo ${ERRPS}
80 .else
81         @echo "If problems occur you may have to rm -rf pkgsrc and try again."
82         @echo
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
89 .endif
90
91 pkgsrc-create: pkgsrc-create-repo
92 .if empty(THISGIT)
93         @echo ${GITNFMSG}
94 .elif exists (${.CURDIR}/pkgsrc)
95         @echo ${ERRPS}
96 .else
97         cd ${.CURDIR}/pkgsrc && git checkout master
98         cd ${.CURDIR}/pkgsrc && git pull
99 .endif
100
101 pkgsrc-create-shallow:
102 .if empty(THISGIT)
103         @echo ${GITNFMSG}
104 .elif exists (${.CURDIR}/pkgsrc)
105         @echo ${ERRPS}
106 .else
107         @echo "If problems occur you may have to rm -rf pkgsrc and try again."
108         @echo
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
117 .endif
118
119 pkgsrc-checkout:
120 .if empty(THISGIT)
121         @echo ${GITNFMSG}
122 .elif !exists (${.CURDIR}/pkgsrc)
123         @echo ${ERRNPS}
124 .else
125         cd ${.CURDIR}/pkgsrc && git checkout master
126 .endif
127
128 pkgsrc-update:
129 .if empty(THISGIT)
130         @echo ${GITNFMSG}
131 .elif !exists (${.CURDIR}/pkgsrc)
132         @echo ${ERRNPS}
133 .else
134         cd ${.CURDIR}/pkgsrc && git pull
135 .endif
136
137 src-create-repo:
138 .if empty(THISGIT)
139         @echo ${GITNFMSG}
140 .elif exists (${.CURDIR}/src)
141         @echo ${ERRSR}
142 .else
143         @echo "If problems occur you may have to rm -rf src and try again."
144         @echo
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
151 .endif
152
153 src-create: src-create-repo
154 .if empty(THISGIT)
155         @echo ${GITNFMSG}
156 .elif exists (${.CURDIR}/src)
157         @echo ${ERRSR}
158 .else
159         cd ${.CURDIR}/src && git checkout master
160         cd ${.CURDIR}/src && git pull
161 .endif
162
163 src-create-shallow:
164 .if empty(THISGIT)
165         @echo ${GITNFMSG}
166 .elif exists (${.CURDIR}/src)
167         @echo ${ERRSR}
168 .else
169         @echo "If problems occur you may have to rm -rf src and try again."
170         @echo
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
179 .endif
180
181 src-checkout:
182 .if empty(THISGIT)
183         @echo ${GITNFMSG}
184 .elif !exists (${.CURDIR}/src)
185         @echo ${ERRNSR}
186 .else
187         cd ${.CURDIR}/src && git checkout master
188 .endif
189
190 src-update:
191 .if empty(THISGIT)
192         @echo ${GITNFMSG}
193 .elif !exists (${.CURDIR}/src)
194         @echo ${ERRNSR}
195 .else
196         cd ${.CURDIR}/src && git pull
197 .endif
198
199 release-sys-extract:
200         cd ${.CURDIR} && tar xvpjf src-sys.tar.bz2
201
202 dports-update:
203 .if empty(THISGIT)
204         @echo ${GITNFMSG}
205 .elif !exists (${.CURDIR}/dports)
206         @echo ${ERRNDP}
207 .else
208         cd ${.CURDIR}/dports && git pull
209 .endif
210
211 dports-create:
212 .if empty(THISGIT)
213         @echo ${GITNFMSG}
214 .elif exists (${.CURDIR}/dports)
215         @echo ${ERRDP}
216 .else
217         @echo "If problems occur you may have to rm -rf dports and try again."
218         @echo
219         git clone git://mirror-master.dragonflybsd.org/dports.git ${.CURDIR}/dports
220 .if exists(${.CURDIR}/pkg)
221         @echo ${WSTARS}
222         @echo ${WARNPS}
223         @echo ${WSTARS}
224 .endif
225 .endif
226
227 dports-create-shallow:
228 .if empty(THISGIT)
229         @echo ${GITNFMSG}
230 .elif exists (${.CURDIR}/dports)
231         @echo ${ERRDP}
232 .else
233         @echo "If problems occur you may have to rm -rf dports and try again."
234         @echo
235         git clone --depth=1 git://mirror-master.dragonflybsd.org/dports.git \
236            ${.CURDIR}/dports
237 .if exists(${.CURDIR}/pkg)
238         @echo ${WSTARS}
239         @echo ${WARNPS}
240         @echo ${WSTARS}
241 .endif
242 .endif
243
244 dports-download:
245 .if exists (${.CURDIR}/dports)
246         @echo ${ERRDP}
247 .else
248         rm -f ${DPTBALL}
249         fetch -o ${DPTBALL} ${DPDLURL}
250         tar -xf ${DPTBALL} -C ${.CURDIR}
251         mv /usr/jrmarino-DPorts-* ${.CURDIR}/dports
252         rm -f ${DPTBALL}
253 .if exists(${.CURDIR}/pkg)
254         @echo ${WSTARS}
255         @echo ${WARNPS}
256         @echo ${WSTARS}
257 .endif
258 .endif
259
260 dports-replace:
261 .if !exists (${.CURDIR}/dports)
262         @echo ${ERRNDP}
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."
267 .else
268         rm -f ${DPTBALL}
269         fetch -o ${DPTBALL} ${DPDLURL}
270         rm -rf ${.CURDIR}/dports
271         tar -xf ${DPTBALL} -C ${.CURDIR}
272         mv /usr/jrmarino-DPorts-* ${.CURDIR}/dports
273         rm -f ${DPTBALL}
274 .endif
275
276 pkg-bootstrap-force:
277         @fetch -o ${PKGBALL} ${PKGBOOT}
278         @tar -xJf ${PKGBALL} -C ${.CURDIR}/local
279         @rm -f ${PKGBALL}
280         ABI=${ABIVERS} ${.CURDIR}/local/sbin/pkg-static install -y -f pkg
281
282 pkg-bootstrap:
283 .if exists(${.CURDIR}/local/sbin/pkg)
284         @echo ${ERRPKG}
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'"
288 .else
289         @fetch -o ${PKGBALL} ${PKGBOOT}
290         @tar -xJf ${PKGBALL} -C ${.CURDIR}/local
291         @rm -f ${PKGBALL}
292         ABI=${ABIVERS} ${.CURDIR}/local/sbin/pkg-static install -y pkg
293 .endif