tools/make_libdeps.sh: Use sys.mk from src/.
[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
ad8b70e0
AL
5# DragonFly BSD source repository
6GITURL_SRC?=git://git.dragonflybsd.org/dragonfly.git
7# Branch to be fetched & checked out
8# * master - latest development branch
9# * DragonFly_RELEASE_x_y - stable release branch x.y
10BRANCH?=master
11
12# DPorts source repository
13GITURL_DPORTS?=git://mirror-master.dragonflybsd.org/dports.git
14
15# Mirror from which to fetch the pkg bootstrap
16MIRROR?=https://mirror-master.dragonflybsd.org
fe70af21 17
4060abb3 18DPTBALL=/tmp/dports.tar.gz
3271cef5 19PKGBALL=/tmp/pkgboot.tar.xz
898339da 20DPDLURL=https://api.github.com/repos/DragonFlyBSD/DPorts/tarball/
daa5ccc1 21PKGBOOT_VERSION=02
937aaebf 22PKGBOOT_x86_64=bootstrap_pkg_${PKGBOOT_VERSION}_x86-64.tar.xz
ad8b70e0 23PKGBOOT=${MIRROR}/dports/bootstraps/${PKGBOOT_${MACHINE_ARCH}}
9c71144e 24ERRPKG="Error: Bootstrap not necessary, ${.CURDIR}/local/sbin/pkg already exists"
4060abb3
JM
25WSTARS="***************************************************************"
26WARNPS=" Warning: Delete or move ${.CURDIR}/pkg before building any dport!"
27LPATT=" make %-23s- %s\n"
28
e2dbfa0b 29help all:
4922fbd1 30 @echo "HELP:"
4060abb3
JM
31 @echo
32.if exists(${.CURDIR}/dports/.git)
0b576dae 33 @printf ${LPATT} "dports-update" "update your dports repository from the net"
4922fbd1 34.else
4060abb3 35. if exists(${.CURDIR}/dports)
0b576dae 36 @printf ${LPATT} "dports-replace" "Replace dports with latest tarball (Github)"
4060abb3 37. else
0b576dae 38 @printf ${LPATT} "dports-create" "fetch initial dports repository from the net"
4060abb3 39 @printf ${LPATT} "dports-create-shallow" "fetch initial history-free dports repository"
0b576dae 40 @printf ${LPATT} "dports-download" "download & install dports tarball (Github)"
4060abb3 41. endif
3271cef5 42.endif
ad8b70e0 43 @echo
3271cef5 44 @printf ${LPATT} "pkg-bootstrap" "Use pre-built pkg to install dports packages"
f201b797 45 @printf ${LPATT} "pkg-bootstrap-force" "Force it (pkg.conf will be overwritten)"
4060abb3
JM
46 @echo
47
4922fbd1 48.if exists(${.CURDIR}/src/.git)
4060abb3 49 @printf ${LPATT} "src-update" "update your src repository from the net"
4922fbd1 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"
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
ad8b70e0
AL
59 @echo "src checkout branch: ${BRANCH}"
60 @echo
61 @echo "If automating please feel free to run 'git pull' from cron."
62 @echo "We prefer once a day but you can run them more often if you desire."
4922fbd1 63
fff08b59
AHJ
64git-check:
65 @/usr/bin/which -s git || \
66 (echo "git must be present on the system to use this option."; /usr/bin/false)
67
68src-check: git-check
69 @/bin/test ! -d ${.CURDIR}/src/.git || \
70 (echo "Error: ${.CURDIR}/src already exists"; /usr/bin/false)
71
72src-check-hasdir: git-check
73 @/bin/test -d ${.CURDIR}/src/.git || \
74 (echo "Error: ${.CURDIR}/src does not exist"; /usr/bin/false)
75
ad8b70e0
AL
76src-create: src-check
77 @echo "If problems occur you may have to 'rm -rf src' and try again."
4060abb3 78 @echo
ad8b70e0 79 git clone --branch ${BRANCH} -- ${GITURL_SRC} ${.CURDIR}/src
f03b7956 80
fff08b59 81src-create-shallow: src-check
ad8b70e0 82 @echo "If problems occur you may have to 'rm -rf src' and try again."
4060abb3 83 @echo
ad8b70e0 84 git clone --depth 1 --branch ${BRANCH} -- ${GITURL_SRC} ${.CURDIR}/src
e2dbfa0b 85
fff08b59 86src-update: src-check-hasdir
4922fbd1 87 cd ${.CURDIR}/src && git pull
e2dbfa0b 88
ad8b70e0 89.if exists(${.CURDIR}/src-sys.tar.bz2)
809ae383 90release-sys-extract:
9effbeff 91 cd ${.CURDIR} && tar xvpjf src-sys.tar.bz2
ad8b70e0 92.endif
809ae383 93
fff08b59
AHJ
94dports-check: git-check
95 @/bin/test ! -d ${.CURDIR}/dports/.git || \
96 (echo "Error: ${.CURDIR}/dports already exists"; /usr/bin/false)
97
ad8b70e0
AL
98dports-check-hasdir: git-check
99 @/bin/test -d ${.CURDIR}/dports/.git || \
100 (echo "Error: ${.CURDIR}/dports does not exist"; /usr/bin/false)
101
f0ef1af5
PAT
102dports-download-check:
103 @/bin/test ! -d ${.CURDIR}/dports || \
104 (echo "Error: ${.CURDIR}/dports already exists"; /usr/bin/false)
5c0c71f9
PAT
105 @/bin/test ! -d ${.CURDIR}/DragonFlyBSD-DPorts-* || \
106 (echo "Error: ${.CURDIR}/DragonFlyBSD-DPorts-* already exists"; /usr/bin/false)
f0ef1af5 107
fff08b59 108dports-create: dports-check
ad8b70e0 109 @echo "If problems occur you may have to 'rm -rf dports' and try again."
4060abb3 110 @echo
ad8b70e0 111 git clone ${GITURL_DPORTS} ${.CURDIR}/dports
4060abb3
JM
112.if exists(${.CURDIR}/pkg)
113 @echo ${WSTARS}
114 @echo ${WARNPS}
115 @echo ${WSTARS}
116.endif
4060abb3 117
fff08b59 118dports-create-shallow: dports-check
ad8b70e0 119 @echo "If problems occur you may have to 'rm -rf dports' and try again."
4060abb3 120 @echo
ad8b70e0 121 git clone --depth 1 ${GITURL_DPORTS} ${.CURDIR}/dports
4060abb3
JM
122.if exists(${.CURDIR}/pkg)
123 @echo ${WSTARS}
124 @echo ${WARNPS}
125 @echo ${WSTARS}
126.endif
4060abb3 127
ad8b70e0
AL
128dports-update: dports-check-hasdir
129 cd ${.CURDIR}/dports && git pull
130
f0ef1af5 131dports-download: dports-download-check
4060abb3
JM
132 rm -f ${DPTBALL}
133 fetch -o ${DPTBALL} ${DPDLURL}
134 tar -xf ${DPTBALL} -C ${.CURDIR}
898339da 135 mv /usr/DragonFlyBSD-DPorts-* ${.CURDIR}/dports
4060abb3
JM
136 rm -f ${DPTBALL}
137.if exists(${.CURDIR}/pkg)
138 @echo ${WSTARS}
139 @echo ${WARNPS}
140 @echo ${WSTARS}
141.endif
4060abb3 142
ad8b70e0 143dports-replace:
fff08b59 144.if exists(${.CURDIR}/dports/.git)
ad8b70e0
AL
145 @echo "Error: ${.CURDIR}/dports is a git repository currently."
146 @echo "Remove ${.CURDIR}/dports and execute 'make dports-download' if you want"
4060abb3 147 @echo "to convert to a non-git version."
fff08b59 148 @/usr/bin/false
4060abb3
JM
149.else
150 rm -f ${DPTBALL}
151 fetch -o ${DPTBALL} ${DPDLURL}
152 rm -rf ${.CURDIR}/dports
153 tar -xf ${DPTBALL} -C ${.CURDIR}
898339da 154 mv /usr/DragonFlyBSD-DPorts-* ${.CURDIR}/dports
4060abb3
JM
155 rm -f ${DPTBALL}
156.endif
3271cef5 157
0c95bff9
MD
158# NOTE: In force mode we also have to remove any old pkg.conf
159# which might interfere with the newer pkg bootstrap.
160#
f201b797 161pkg-bootstrap-force:
0c95bff9 162 @rm -f /usr/local/etc/pkg.conf
f201b797
MD
163 @fetch -o ${PKGBALL} ${PKGBOOT}
164 @tar -xJf ${PKGBALL} -C ${.CURDIR}/local
165 @rm -f ${PKGBALL}
daa5ccc1 166.if defined(ABIVERS)
f201b797 167 ABI=${ABIVERS} ${.CURDIR}/local/sbin/pkg-static install -y -f pkg
daa5ccc1
MD
168.else
169 ${.CURDIR}/local/sbin/pkg-static install -y -f pkg
170.endif
f201b797 171
3271cef5
JM
172pkg-bootstrap:
173.if exists(${.CURDIR}/local/sbin/pkg)
174 @echo ${ERRPKG}
fff08b59 175 @/usr/bin/false
3271cef5 176.elif exists(${.CURDIR}/local/etc/pkg.conf)
1b1c1a4f 177 @echo "Error: ${.CURDIR}/local/etc/pkg.conf will be overwritten"
3271cef5 178 @echo "Please move this file and rerun 'make pkg-bootstrap'"
fff08b59 179 @/usr/bin/false
3271cef5
JM
180.else
181 @fetch -o ${PKGBALL} ${PKGBOOT}
182 @tar -xJf ${PKGBALL} -C ${.CURDIR}/local
183 @rm -f ${PKGBALL}
daa5ccc1 184.if defined(ABIVERS)
f201b797 185 ABI=${ABIVERS} ${.CURDIR}/local/sbin/pkg-static install -y pkg
daa5ccc1
MD
186.else
187 ${.CURDIR}/local/sbin/pkg-static install -y pkg
188.endif
3271cef5 189.endif