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