kernel/i915: Add missing opt_acpi.h to SRCS.
[dragonfly.git] / etc / Makefile.usr
CommitLineData
95f63bef 1# Makefile.usr - installed as /usr/Makefile
809ae383 2#
df16f41a 3# Provides simple targets to download and maintain /usr/src, /usr/dports etc.
809ae383 4
fe70af21
MD
5GITHOST?=git.dragonflybsd.org
6
4060abb3
JM
7THISGIT!= which git 2>/dev/null; echo
8DPTBALL=/tmp/dports.tar.gz
3271cef5 9PKGBALL=/tmp/pkgboot.tar.xz
898339da 10DPDLURL=https://api.github.com/repos/DragonFlyBSD/DPorts/tarball/
daa5ccc1 11PKGBOOT_VERSION=02
937aaebf
JM
12PKGBOOT_i386=bootstrap_pkg_${PKGBOOT_VERSION}_x86-32.tar.xz
13PKGBOOT_x86_64=bootstrap_pkg_${PKGBOOT_VERSION}_x86-64.tar.xz
f201b797 14PKGBOOT=http://mirror-master.dragonflybsd.org/dports/bootstraps/${PKGBOOT_${MACHINE_ARCH}}
4060abb3 15GITNFMSG="git must be present on the system to use this option."
4060abb3
JM
16ERRDP="Error: ${.CURDIR}/dports already exists"
17ERRSR="Error: ${.CURDIR}/src already exists"
4060abb3
JM
18ERRNDP="Error: ${.CURDIR}/dports does not exist"
19ERRNSR="Error: ${.CURDIR}/src does not exist"
3271cef5 20ERRPKG="Error: Bootstrap not neccessary, ${.CURDIR}/local/sbin/pkg already exists"
4060abb3
JM
21WSTARS="***************************************************************"
22WARNPS=" Warning: Delete or move ${.CURDIR}/pkg before building any dport!"
23LPATT=" make %-23s- %s\n"
24
e2dbfa0b 25help all:
4922fbd1 26 @echo "HELP:"
4060abb3
JM
27 @echo
28.if exists(${.CURDIR}/dports/.git)
0b576dae 29 @printf ${LPATT} "dports-update" "update your dports repository from the net"
4922fbd1 30.else
4060abb3 31. if exists(${.CURDIR}/dports)
0b576dae 32 @printf ${LPATT} "dports-replace" "Replace dports with latest tarball (Github)"
4060abb3 33. else
0b576dae 34 @printf ${LPATT} "dports-create" "fetch initial dports repository from the net"
4060abb3 35 @printf ${LPATT} "dports-create-shallow" "fetch initial history-free dports repository"
0b576dae 36 @printf ${LPATT} "dports-download" "download & install dports tarball (Github)"
4060abb3 37. endif
4922fbd1 38.endif
3271cef5 39 @printf ${LPATT} "pkg-bootstrap" "Use pre-built pkg to install dports packages"
f201b797 40 @printf ${LPATT} "pkg-bootstrap-force" "Force it (pkg.conf will be overwritten)"
4060abb3
JM
41 @echo
42
4922fbd1
MD
43.if exists(${.CURDIR}/src/.git)
44.if exists(${.CURDIR}/src/Makefile)
4060abb3 45 @printf ${LPATT} "src-update" "update your src repository from the net"
4922fbd1 46.else
4060abb3 47 @printf ${LPATT} "src-checkout" "Initial checkout of src repository"
4922fbd1
MD
48.endif
49.else
4060abb3
JM
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"
4922fbd1 53.endif
4060abb3 54 @echo
9effbeff 55.if exists(${.CURDIR}/src-sys.tar.bz2)
4060abb3
JM
56 @printf ${LPATT} "release-sys-extract" "extract the pre-packaged sys-only sources"
57 @echo
4922fbd1 58.endif
4922fbd1 59 @echo "If automating please feel free to run git pull's from cron."
4060abb3 60 @echo "We prefer once a day but you can run them more often if you desire"
4922fbd1 61
3ab6e27a 62src-create-repo:
4060abb3
JM
63.if empty(THISGIT)
64 @echo ${GITNFMSG}
65.elif exists (${.CURDIR}/src)
66 @echo ${ERRSR}
67.else
4922fbd1 68 @echo "If problems occur you may have to rm -rf src and try again."
4060abb3 69 @echo
4922fbd1
MD
70 mkdir -p ${.CURDIR}/src
71 cd ${.CURDIR}/src && git init
72 cd ${.CURDIR}/src && \
fe70af21 73 git remote add origin git://${GITHOST}/dragonfly.git
4922fbd1
MD
74 cd ${.CURDIR}/src && git fetch origin
75 cd ${.CURDIR}/src && git branch master origin/master
4060abb3 76.endif
3ab6e27a
MD
77
78src-create: src-create-repo
4060abb3
JM
79.if empty(THISGIT)
80 @echo ${GITNFMSG}
81.elif exists (${.CURDIR}/src)
82 @echo ${ERRSR}
83.else
4922fbd1
MD
84 cd ${.CURDIR}/src && git checkout master
85 cd ${.CURDIR}/src && git pull
4060abb3 86.endif
f03b7956 87
03ac22da 88src-create-shallow:
4060abb3
JM
89.if empty(THISGIT)
90 @echo ${GITNFMSG}
91.elif exists (${.CURDIR}/src)
92 @echo ${ERRSR}
93.else
03ac22da 94 @echo "If problems occur you may have to rm -rf src and try again."
4060abb3 95 @echo
03ac22da
MD
96 mkdir -p ${.CURDIR}/src
97 cd ${.CURDIR}/src && git init
98 cd ${.CURDIR}/src && \
bf00df77 99 git remote add origin git://${GITHOST}/dragonfly.git
03ac22da
MD
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
4060abb3 104.endif
03ac22da 105
4922fbd1 106src-checkout:
4060abb3
JM
107.if empty(THISGIT)
108 @echo ${GITNFMSG}
109.elif !exists (${.CURDIR}/src)
110 @echo ${ERRNSR}
111.else
4922fbd1 112 cd ${.CURDIR}/src && git checkout master
4060abb3 113.endif
e2dbfa0b 114
4922fbd1 115src-update:
4060abb3
JM
116.if empty(THISGIT)
117 @echo ${GITNFMSG}
118.elif !exists (${.CURDIR}/src)
119 @echo ${ERRNSR}
120.else
4922fbd1 121 cd ${.CURDIR}/src && git pull
4060abb3 122.endif
e2dbfa0b 123
809ae383 124release-sys-extract:
9effbeff 125 cd ${.CURDIR} && tar xvpjf src-sys.tar.bz2
809ae383 126
4060abb3
JM
127dports-update:
128.if empty(THISGIT)
129 @echo ${GITNFMSG}
130.elif !exists (${.CURDIR}/dports)
131 @echo ${ERRNDP}
132.else
133 cd ${.CURDIR}/dports && git pull
134.endif
135
136dports-create:
137.if empty(THISGIT)
138 @echo ${GITNFMSG}
139.elif exists (${.CURDIR}/dports)
140 @echo ${ERRDP}
141.else
142 @echo "If problems occur you may have to rm -rf dports and try again."
143 @echo
f201b797 144 git clone git://mirror-master.dragonflybsd.org/dports.git ${.CURDIR}/dports
4060abb3
JM
145.if exists(${.CURDIR}/pkg)
146 @echo ${WSTARS}
147 @echo ${WARNPS}
148 @echo ${WSTARS}
149.endif
150.endif
151
152dports-create-shallow:
153.if empty(THISGIT)
154 @echo ${GITNFMSG}
155.elif exists (${.CURDIR}/dports)
156 @echo ${ERRDP}
157.else
158 @echo "If problems occur you may have to rm -rf dports and try again."
159 @echo
f201b797 160 git clone --depth=1 git://mirror-master.dragonflybsd.org/dports.git \
4060abb3
JM
161 ${.CURDIR}/dports
162.if exists(${.CURDIR}/pkg)
163 @echo ${WSTARS}
164 @echo ${WARNPS}
165 @echo ${WSTARS}
166.endif
167.endif
168
169dports-download:
170.if exists (${.CURDIR}/dports)
171 @echo ${ERRDP}
172.else
173 rm -f ${DPTBALL}
174 fetch -o ${DPTBALL} ${DPDLURL}
175 tar -xf ${DPTBALL} -C ${.CURDIR}
898339da 176 mv /usr/DragonFlyBSD-DPorts-* ${.CURDIR}/dports
4060abb3
JM
177 rm -f ${DPTBALL}
178.if exists(${.CURDIR}/pkg)
179 @echo ${WSTARS}
180 @echo ${WARNPS}
181 @echo ${WSTARS}
182.endif
183.endif
184
185dports-replace:
186.if !exists (${.CURDIR}/dports)
187 @echo ${ERRNDP}
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."
192.else
193 rm -f ${DPTBALL}
194 fetch -o ${DPTBALL} ${DPDLURL}
195 rm -rf ${.CURDIR}/dports
196 tar -xf ${DPTBALL} -C ${.CURDIR}
898339da 197 mv /usr/DragonFlyBSD-DPorts-* ${.CURDIR}/dports
4060abb3
JM
198 rm -f ${DPTBALL}
199.endif
3271cef5 200
f201b797
MD
201pkg-bootstrap-force:
202 @fetch -o ${PKGBALL} ${PKGBOOT}
203 @tar -xJf ${PKGBALL} -C ${.CURDIR}/local
204 @rm -f ${PKGBALL}
daa5ccc1 205.if defined(ABIVERS)
f201b797 206 ABI=${ABIVERS} ${.CURDIR}/local/sbin/pkg-static install -y -f pkg
daa5ccc1
MD
207.else
208 ${.CURDIR}/local/sbin/pkg-static install -y -f pkg
209.endif
f201b797 210
3271cef5
JM
211pkg-bootstrap:
212.if exists(${.CURDIR}/local/sbin/pkg)
213 @echo ${ERRPKG}
214.elif exists(${.CURDIR}/local/etc/pkg.conf)
215 @echo "Error: ${.CURDIR}/local/etc/pkg.conf will be ovewritten"
216 @echo "Please move this file and rerun 'make pkg-bootstrap'"
217.else
218 @fetch -o ${PKGBALL} ${PKGBOOT}
219 @tar -xJf ${PKGBALL} -C ${.CURDIR}/local
220 @rm -f ${PKGBALL}
daa5ccc1 221.if defined(ABIVERS)
f201b797 222 ABI=${ABIVERS} ${.CURDIR}/local/sbin/pkg-static install -y pkg
daa5ccc1
MD
223.else
224 ${.CURDIR}/local/sbin/pkg-static install -y pkg
225.endif
3271cef5 226.endif