23e6da11f4aa381589fbe97beba91e34e8564963
[dragonfly.git] / share / mk / bsd.port.mk
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.35 2005/05/16 09:20:56 y0netan1 Exp $
3
4 PORTSDIR?=      /usr/ports
5 DFPORTSDIR?=    /usr/dfports
6 PORTPATH!=      /usr/bin/relpath ${PORTSDIR} ${.CURDIR}
7
8 .if !defined(DFOSVERSION)
9 DFOSVERSION!=   /sbin/sysctl -n kern.osreldate
10 .endif
11
12 # Temporary Hack
13 #
14 OSVERSION ?= 480102
15 UNAME_s?= FreeBSD
16 UNAME_v?=FreeBSD 4.8-CURRENT
17 UNAME_r?=4.8-CURRENT
18
19 # override for bsd.port.mk
20 PERL_VERSION?=  5.8.6
21 PERL_VER?=      5.8.6
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)
38 install-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)
63 RC_SUBR=        /etc/rc.subr
64 SUB_LIST+=      RC_SUBR=${RC_SUBR}
65 .if defined(USE_RC_SUBR) && ${USE_RC_SUBR:U} != "YES"
66 SUB_FILES+=     ${_DF_USE_RC_SUBR}
67 .endif
68 .if defined(USE_RCORDER)
69 SUB_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
86 CCVER=  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
110 TARGETS+=       all
111 TARGETS+=       build
112 TARGETS+=       checksum
113 TARGETS+=       clean
114 TARGETS+=       clean-for-cdrom
115 TARGETS+=       clean-for-cdrom-list
116 TARGETS+=       clean-restricted
117 TARGETS+=       clean-restricted-list
118 TARGETS+=       configure
119 TARGETS+=       deinstall
120 TARGETS+=       depend
121 TARGETS+=       depends
122 TARGETS+=       describe
123 TARGETS+=       distclean
124 TARGETS+=       extract
125 TARGETS+=       fetch
126 TARGETS+=       fetch-list
127 TARGETS+=       ignorelist
128 TARGETS+=       makesum
129 TARGETS+=       maintainer
130 TARGETS+=       package
131 TARGETS+=       realinstall
132 TARGETS+=       reinstall
133 TARGETS+=       install
134 TARGETS+=       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
159 all:
160 .MAIN: all
161 .endif
162
163 # Hack to get Makefiles with conditional statements working
164 XFREE86_VERSION?=       4
165 ARCH?=                  i386
166 MACHINE_ARCH?=          i386
167 HAVE_GNOME?=
168 FILESDIR?=              ${.CURDIR}/files
169 X_WINDOW_SYSTEM?=       xfree86-4
170 CAT?=                   cat
171 PREFIX?=                /usr
172 PERL_LEVEL?=            5
173 LOCALBASE?=             /usr/local
174 SED?=                   /usr/bin/sed
175 ECHO_CMD?=              echo
176 GREP?=                  /usr/bin/grep
177 AWK?=                   /usr/bin/awk
178 UNAME?=                 /usr/bin/uname
179 EXPR?=                  /bin/expr
180 HAVE_SDL?=
181
182 PKG_SUFX?=              .tgz
183 PKGNAME!=               cd ${DFPORTSDIR}/${PORTPATH}; ${MAKE} -V PKGNAME
184 .for _CATEGORY in ${CATEGORIES}
185 PKGCATEGORY?=   ${_CATEGORY}
186 .endfor
187 _PORTDIRNAME=   ${.CURDIR:T}
188 PORTDIRNAME?=   ${_PORTDIRNAME}
189 PKGORIGIN?=             ${PKGCATEGORY}/${PORTDIRNAME}
190 PLIST_SUB!=             cd ${DFPORTSDIR}/${PORTPATH}; ${MAKE} -V PLIST_SUB
191
192 PKGREPOSITORYSUBDIR?=   All
193 PKGREPOSITORY?=         ${PACKAGES}/${PKGREPOSITORYSUBDIR}
194 .if exists(${PACKAGES})
195 PKGFILE?=               ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
196 .else
197 PKGFILE?=               ${.CURDIR}/${PKGNAME}${PKG_SUFX}
198 .endif
199  
200 .endif
201