Merge from vendor branch LIBARCHIVE:
[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.33 2005/05/03 14:16:04 joerg 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 .  if ${USE_GCC} == 3.4
80 .undef USE_GCC
81 CCVER=  gcc34
82 .makeenv CCVER
83 .  endif
84 .endif
85
86 # If the port does not exist in /usr/dfports/<portpath> use the original
87 # FreeBSD port.  Also process as per normal if BEFOREPORTMK is set so
88 # any expected variables are set.
89 #
90 .include <bsd.own.mk>
91 .include "${PORTSDIR}/Mk/bsd.port.mk"
92
93 .else
94
95 .if !defined(BEFOREPORTMK)
96 .undef PORTSDIR
97 .endif
98
99 .undef BEFOREPORTMK
100 .undef AFTERPORTMK
101
102 # Otherwise retarget to the DragonFly override port.
103 #
104
105 TARGETS+=       all
106 TARGETS+=       build
107 TARGETS+=       checksum
108 TARGETS+=       clean
109 TARGETS+=       clean-for-cdrom
110 TARGETS+=       clean-for-cdrom-list
111 TARGETS+=       clean-restricted
112 TARGETS+=       clean-restricted-list
113 TARGETS+=       configure
114 TARGETS+=       deinstall
115 TARGETS+=       depend
116 TARGETS+=       depends
117 TARGETS+=       describe
118 TARGETS+=       distclean
119 TARGETS+=       extract
120 TARGETS+=       fetch
121 TARGETS+=       fetch-list
122 TARGETS+=       ignorelist
123 TARGETS+=       makesum
124 TARGETS+=       maintainer
125 TARGETS+=       package
126 TARGETS+=       realinstall
127 TARGETS+=       reinstall
128 TARGETS+=       install
129 TARGETS+=       tags
130
131 # WARNING!  Do not use the -B option.  This appears to propogate to the
132 # gmake (probably because both use the same environment variable, MAKEFLAGS,
133 # to pass make options) where as of version 3.80 -B means 'always-make',
134 # which forces all targets, which blows up gnu builds in the ports system
135 # because it appears to cause the configure.status target to loop.
136 #
137 .if !defined(_DFPORTS_REDIRECT)
138 _DFPORTS_REDIRECT=
139 .if !make(package-depends-list) && !make(all-depends-list) && \
140     !make(run-depends-list) && !make(build-depends-list) && \
141     !make(describe) && !make(package-name)
142 .BEGIN:
143         @echo "WARNING, USING DRAGONFLY OVERRIDE ${DFPORTSDIR}/${PORTPATH}"
144         cd ${DFPORTSDIR}/${PORTPATH} && ${MAKE} ${.TARGETS}
145 .else
146 .BEGIN:
147         @cd ${DFPORTSDIR}/${PORTPATH} && ${MAKE} ${.TARGETS} 
148 .endif
149 .endif
150
151 .if !empty(.TARGETS)
152 ${.TARGETS}:
153 .else
154 all:
155 .MAIN: all
156 .endif
157
158 # Hack to get Makefiles with conditional statements working
159 XFREE86_VERSION?=       4
160 ARCH?=                  i386
161 MACHINE_ARCH?=          i386
162 HAVE_GNOME?=
163 FILESDIR?=              ${.CURDIR}/files
164 X_WINDOW_SYSTEM?=       xfree86-4
165 CAT?=                   cat
166 PREFIX?=                /usr
167 PERL_LEVEL?=            5
168 LOCALBASE?=             /usr/local
169 SED?=                   /usr/bin/sed
170 ECHO_CMD?=              echo
171 GREP?=                  /usr/bin/grep
172 AWK?=                   /usr/bin/awk
173 UNAME?=                 /usr/bin/uname
174 EXPR?=                  /bin/expr
175 HAVE_SDL?=
176
177 PKG_SUFX?=              .tgz
178 PKGNAME!=               cd ${DFPORTSDIR}/${PORTPATH}; ${MAKE} -V PKGNAME
179 .for _CATEGORY in ${CATEGORIES}
180 PKGCATEGORY?=   ${_CATEGORY}
181 .endfor
182 _PORTDIRNAME=   ${.CURDIR:T}
183 PORTDIRNAME?=   ${_PORTDIRNAME}
184 PKGORIGIN?=             ${PKGCATEGORY}/${PORTDIRNAME}
185 PLIST_SUB!=             cd ${DFPORTSDIR}/${PORTPATH}; ${MAKE} -V PLIST_SUB
186
187 PKGREPOSITORYSUBDIR?=   All
188 PKGREPOSITORY?=         ${PACKAGES}/${PKGREPOSITORYSUBDIR}
189 .if exists(${PACKAGES})
190 PKGFILE?=               ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
191 .else
192 PKGFILE?=               ${.CURDIR}/${PKGNAME}${PKG_SUFX}
193 .endif
194  
195 .endif
196