xref: /dragonfly/share/mk/bsd.port.mk (revision 1bf4b486)
1# $FreeBSD: src/share/mk/bsd.port.mk,v 1.303.2.2 2002/07/17 19:08:23 ru Exp $
2# $DragonFly: src/share/mk/Attic/bsd.port.mk,v 1.36 2005/07/09 20:51:04 joerg Exp $
3
4PORTSDIR?=	/usr/ports
5DFPORTSDIR?=	/usr/dfports
6PORTPATH!=	/usr/bin/relpath ${PORTSDIR} ${.CURDIR}
7
8.if !defined(DFOSVERSION)
9DFOSVERSION!=	/sbin/sysctl -n kern.osreldate
10.endif
11
12# Temporary Hack
13#
14OSVERSION ?= 480102
15UNAME_s?= FreeBSD
16UNAME_v?=FreeBSD 4.8-CURRENT
17UNAME_r?=4.8-CURRENT
18
19# override for bsd.port.mk
20PERL_VERSION?=	5.8.7
21PERL_VER?=	5.8.7
22
23.makeenv UNAME_s
24.makeenv UNAME_v
25.makeenv UNAME_r
26
27# handle both native and override ports
28.undef USE_GETOPT_LONG
29
30.if defined(USE_RCORDER)
31_DF_USE_RCORDER:=	${USE_RCORDER}
32.endif
33.if defined(USE_RC_SUBR)
34_DF_USE_RC_SUBR:=	${USE_RC_SUBR}
35.endif
36
37.if !target(install-rc-script) && !defined(BEFOREPORTMK)
38install-rc-script:
39.if defined(USE_RCORDER) || defined(USE_RC_SUBR) && ${USE_RC_SUBR:U} != "YES"
40.if defined(USE_RCORDER)
41	@${ECHO_CMD} "===> Installing early rcNG startup script(s)"
42	@${ECHO_CMD} "@cwd /" >> ${TMPPLIST}
43	@for i in ${_DF_USE_RCORDER}; do \
44		${INSTALL_SCRIPT} ${WRKDIR}/$${i} /etc/rc.d/$${i%.sh}; \
45		${ECHO_CMD} "etc/rc.d/$${i%.sh}" >> ${TMPPLIST}; \
46	done
47	@${ECHO_CMD} "@cwd ${PREFIX}" >> ${TMPPLIST}
48.endif
49.if defined(USE_RC_SUBR) && ${USE_RC_SUBR:U} != "YES"
50	@${ECHO_CMD} "===> Installing rcNG startup script(s)"
51	@${ECHO_CMD} "@cwd ${PREFIX}" >> ${TMPPLIST}
52	@for i in ${_DF_USE_RC_SUBR}; do \
53		${INSTALL_SCRIPT} ${WRKDIR}/$${i} ${PREFIX}/etc/rc.d/$${i%.sh}.sh; \
54		${ECHO_CMD} "etc/rc.d/$${i%.sh}.sh" >> ${TMPPLIST}; \
55	done
56.endif
57.else
58	@${DO_NADA}
59.endif
60.endif
61
62.if defined(USE_RC_SUBR) || defined(USE_RCORDER)
63RC_SUBR=	/etc/rc.subr
64SUB_LIST+=	RC_SUBR=${RC_SUBR}
65.if defined(USE_RC_SUBR) && ${USE_RC_SUBR:U} != "YES"
66SUB_FILES+=	${_DF_USE_RC_SUBR}
67.endif
68.if defined(USE_RCORDER)
69SUB_FILES+=	${_DF_USE_RCORDER}
70.endif
71.endif
72
73.undef USE_RC_SUBR
74.undef USE_RCORDER
75
76.if !exists(${DFPORTSDIR}/${PORTPATH}/Makefile)
77
78.if defined(USE_GCC)
79_USE_GCC:=	${USE_GCC:S/+//}
80_OR_LATER:=	999
81.  if ${_USE_GCC} != ${USE_GCC}
82_OR_LATER:= ${_USE_GCC}
83.  endif
84.  if ${USE_GCC} == 3.4 || ${_OR_LATER} <= 3.4
85.undef USE_GCC
86CCVER=	gcc34
87.makeenv CCVER
88.  endif
89.endif
90
91# If the port does not exist in /usr/dfports/<portpath> use the original
92# FreeBSD port.  Also process as per normal if BEFOREPORTMK is set so
93# any expected variables are set.
94#
95.include <bsd.own.mk>
96.include "${PORTSDIR}/Mk/bsd.port.mk"
97
98.else
99
100.if !defined(BEFOREPORTMK)
101.undef PORTSDIR
102.endif
103
104.undef BEFOREPORTMK
105.undef AFTERPORTMK
106
107# Otherwise retarget to the DragonFly override port.
108#
109
110TARGETS+=	all
111TARGETS+=	build
112TARGETS+=	checksum
113TARGETS+=	clean
114TARGETS+=	clean-for-cdrom
115TARGETS+=	clean-for-cdrom-list
116TARGETS+=	clean-restricted
117TARGETS+=	clean-restricted-list
118TARGETS+=	configure
119TARGETS+=	deinstall
120TARGETS+=	depend
121TARGETS+=	depends
122TARGETS+=	describe
123TARGETS+=	distclean
124TARGETS+=	extract
125TARGETS+=	fetch
126TARGETS+=	fetch-list
127TARGETS+=	ignorelist
128TARGETS+=	makesum
129TARGETS+=	maintainer
130TARGETS+=	package
131TARGETS+=	realinstall
132TARGETS+=	reinstall
133TARGETS+=	install
134TARGETS+=	tags
135
136# WARNING!  Do not use the -B option.  This appears to propogate to the
137# gmake (probably because both use the same environment variable, MAKEFLAGS,
138# to pass make options) where as of version 3.80 -B means 'always-make',
139# which forces all targets, which blows up gnu builds in the ports system
140# because it appears to cause the configure.status target to loop.
141#
142.if !defined(_DFPORTS_REDIRECT)
143_DFPORTS_REDIRECT=
144.if !make(package-depends-list) && !make(all-depends-list) && \
145    !make(run-depends-list) && !make(build-depends-list) && \
146    !make(describe) && !make(package-name)
147.BEGIN:
148	@echo "WARNING, USING DRAGONFLY OVERRIDE ${DFPORTSDIR}/${PORTPATH}"
149	cd ${DFPORTSDIR}/${PORTPATH} && ${MAKE} ${.TARGETS}
150.else
151.BEGIN:
152	@cd ${DFPORTSDIR}/${PORTPATH} && ${MAKE} ${.TARGETS}
153.endif
154.endif
155
156.if !empty(.TARGETS)
157${.TARGETS}:
158.else
159all:
160.MAIN: all
161.endif
162
163# Hack to get Makefiles with conditional statements working
164XFREE86_VERSION?=	4
165ARCH?=			i386
166MACHINE_ARCH?=		i386
167HAVE_GNOME?=
168FILESDIR?=		${.CURDIR}/files
169X_WINDOW_SYSTEM?=	xfree86-4
170CAT?=			cat
171PREFIX?=		/usr
172PERL_LEVEL?=		5
173LOCALBASE?=		/usr/local
174SED?=			/usr/bin/sed
175ECHO_CMD?=		echo
176GREP?=			/usr/bin/grep
177AWK?=			/usr/bin/awk
178UNAME?=			/usr/bin/uname
179EXPR?=			/bin/expr
180HAVE_SDL?=
181
182PKG_SUFX?=		.tgz
183PKGNAME!=		cd ${DFPORTSDIR}/${PORTPATH}; ${MAKE} -V PKGNAME
184.for _CATEGORY in ${CATEGORIES}
185PKGCATEGORY?=   ${_CATEGORY}
186.endfor
187_PORTDIRNAME=   ${.CURDIR:T}
188PORTDIRNAME?=   ${_PORTDIRNAME}
189PKGORIGIN?=             ${PKGCATEGORY}/${PORTDIRNAME}
190PLIST_SUB!=		cd ${DFPORTSDIR}/${PORTPATH}; ${MAKE} -V PLIST_SUB
191
192PKGREPOSITORYSUBDIR?=   All
193PKGREPOSITORY?=         ${PACKAGES}/${PKGREPOSITORYSUBDIR}
194.if exists(${PACKAGES})
195PKGFILE?=               ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
196.else
197PKGFILE?=               ${.CURDIR}/${PKGNAME}${PKG_SUFX}
198.endif
199
200.endif
201
202