Support PORTDIRNAME and PKGORIGIN.
[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.26 2005/01/16 17:53:35 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 .makeenv UNAME_s
20 .makeenv UNAME_v
21 .makeenv UNAME_r
22 .makeenv OSVERSION
23
24 .if !exists(${DFPORTSDIR}/${PORTPATH}/Makefile)
25
26 .if defined(USE_RC_SUBR)
27 .undef USE_RC_SUBR
28 RC_SUBR=        /etc/rc.subr
29 .endif
30
31 .if defined(USE_GCC)
32 .  if ${USE_GCC} == 3.4
33 .undef USE_GCC
34 CCVER=  gcc34
35 .makeenv CCVER
36 .  endif
37 .endif
38
39 # If the port does not exist in /usr/dfports/<portpath> use the original
40 # FreeBSD port.  Also process as per normal if BEFOREPORTMK is set so
41 # any expected variables are set.
42 #
43 .include <bsd.own.mk>
44 .include "${PORTSDIR}/Mk/bsd.port.mk"
45
46 .else
47
48 .if !defined(BEFOREPORTMK)
49 .undef PORTSDIR
50 .endif
51
52 .undef BEFOREPORTMK
53 .undef AFTERPORTMK
54
55 # Otherwise retarget to the DragonFly override port.
56 #
57
58 TARGETS+=       all
59 TARGETS+=       build
60 TARGETS+=       checksum
61 TARGETS+=       clean
62 TARGETS+=       clean-for-cdrom
63 TARGETS+=       clean-for-cdrom-list
64 TARGETS+=       clean-restricted
65 TARGETS+=       clean-restricted-list
66 TARGETS+=       configure
67 TARGETS+=       deinstall
68 TARGETS+=       depend
69 TARGETS+=       depends
70 TARGETS+=       describe
71 TARGETS+=       distclean
72 TARGETS+=       extract
73 TARGETS+=       fetch
74 TARGETS+=       fetch-list
75 TARGETS+=       ignorelist
76 TARGETS+=       makesum
77 TARGETS+=       maintainer
78 TARGETS+=       package
79 TARGETS+=       realinstall
80 TARGETS+=       reinstall
81 TARGETS+=       install
82 TARGETS+=       tags
83
84 # WARNING!  Do not use the -B option.  This appears to propogate to the
85 # gmake (probably because both use the same environment variable, MAKEFLAGS,
86 # to pass make options) where as of version 3.80 -B means 'always-make',
87 # which forces all targets, which blows up gnu builds in the ports system
88 # because it appears to cause the configure.status target to loop.
89 #
90 .if !defined(_DFPORTS_REDIRECT)
91 _DFPORTS_REDIRECT=
92 .if !make(package-depends-list) && !make(all-depends-list) && \
93     !make(run-depends-list) && !make(build-depends-list) && \
94     !make(describe) && !make(package-name)
95 .BEGIN:
96         @echo "WARNING, USING DRAGONFLY OVERRIDE ${DFPORTSDIR}/${PORTPATH}"
97         cd ${DFPORTSDIR}/${PORTPATH} && ${MAKE} ${.TARGETS}
98 .else
99 .BEGIN:
100         @cd ${DFPORTSDIR}/${PORTPATH} && ${MAKE} ${.TARGETS} 
101 .endif
102 .endif
103
104 .if !empty(.TARGETS)
105 ${.TARGETS}:
106 .else
107 all:
108 .MAIN: all
109 .endif
110
111 # Hack to get Makefiles with conditional statements working
112 XFREE86_VERSION?=       4
113 ARCH?=                  i386
114 MACHINE_ARCH?=          i386
115 HAVE_GNOME?=
116 FILESDIR?=              ${.CURDIR}/files
117 X_WINDOW_SYSTEM?=       xfree86-4
118 CAT?=                   cat
119 PREFIX?=                /usr
120 PERL_LEVEL?=            5
121 LOCALBASE?=             /usr/local
122 SED?=                   /usr/bin/sed
123 ECHO_CMD?=              echo
124 GREP?=                  /usr/bin/grep
125 AWK?=                   /usr/bin/awk
126 UNAME?=                 /usr/bin/uname
127 EXPR?=                  /bin/expr
128 HAVE_SDL?=
129
130 PKG_SUFX?=              .tgz
131 PKGNAME!=               cd ${DFPORTSDIR}/${PORTPATH}; ${MAKE} -V PKGNAME
132 .for _CATEGORY in ${CATEGORIES}
133 PKGCATEGORY?=   ${_CATEGORY}
134 .endfor
135 _PORTDIRNAME=   ${.CURDIR:T}
136 PORTDIRNAME?=   ${_PORTDIRNAME}
137 PKGORIGIN?=             ${PKGCATEGORY}/${PORTDIRNAME}
138
139 PKGREPOSITORYSUBDIR?=   All
140 PKGREPOSITORY?=         ${PACKAGES}/${PKGREPOSITORYSUBDIR}
141 .if exists(${PACKAGES})
142 PKGFILE?=               ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
143 .else
144 PKGFILE?=               ${.CURDIR}/${PKGNAME}${PKG_SUFX}
145 .endif
146  
147 .endif
148