summaryrefslogtreecommitdiff
path: root/sysutils/xentools33/Makefile
blob: f5df465b469af6360dde72cd10ce0f83f28fc673 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# $NetBSD: Makefile,v 1.50 2016/05/18 21:24:44 joerg Exp $

VERSION=	3.3.2
DISTNAME=	xen-${VERSION}
PKGNAME=	xentools33-${VERSION}
PKGREVISION=	20
CATEGORIES=	sysutils
MASTER_SITES=	http://bits.xensource.com/oss-xen/release/${VERSION}/

MAINTAINER=	cegger@NetBSD.org
HOMEPAGE=	http://xen.org/
COMMENT=	Userland Tools for Xen 3.3.x

LICENSE=	gnu-gpl-v2

#DEPENDS+=	${PYPKGPREFIX}-twisted-[0-9]*:../../net/py-twisted
DEPENDS+=	${PYPKGPREFIX}-readline-[0-9]*:../../devel/py-readline
DEPENDS+=	${PYPKGPREFIX}-curses>=0nb4:../../devel/py-curses

BUILD_DEPENDS+= dev86-[0-9]*:../../devel/dev86 # needed to build firmware

PKG_SYSCONFSUBDIR=	xen
PYTHON_VERSIONS_INCOMPATIBLE=	33 34 35 # py-xml

ONLY_FOR_PLATFORM=	Linux-2.6*-i386 Linux-2.6*-x86_64
ONLY_FOR_PLATFORM+=	NetBSD-[5-9].*-x86_64 NetBSD-[5-9].*-i386

CONFLICTS+=		libxen-[0-9]*
CONFLICTS+=		xentools20-[0-9]*
CONFLICTS+=		xentools30-* xentools3-*
CONFLICTS+=		xenstoretools-*

WRKSRC=			${WRKDIR}/xen-${VERSION}/tools
CHECK_PORTABILITY_SKIP=	examples/* xm-test/ramdisk/make-release.sh

EGDIR=			${PREFIX}/share/examples/xen
MESSAGE_SUBST=		EGDIR=${EGDIR}

USE_TOOLS+=		perl 	#for pod2man
USE_TOOLS+=		gmake
MAKE_ENV+=		CONFIG_NetBSD=yes
MAKE_ENV+=		CONFIG_MBOOTPACK=no
MAKE_ENV+=		EGDIR=${EGDIR:Q}
MAKE_ENV+=		MV=${MV:Q} PYTHON=${PYTHONBIN:Q} SED=${SED:Q}
.if ${MACHINE_ARCH} == "i386"
MAKE_ENV+=		XEN_TARGET_ARCH="x86_32" XEN_COMPILE_ARCH="x86_32"
.elif  ${MACHINE_ARCH} == "x86_64"
MAKE_ENV+=		XEN_TARGET_ARCH="x86_64" XEN_COMPILE_ARCH="x86_64"
.else
MAKE_ENV+=		XEN_TARGET_ARCH="unsupported"
.endif
PY_PATCHPLIST=		yes
REPLACE_PYTHON+=	misc/xm
REPLACE_PYTHON+=	misc/netfix
REPLACE_PYTHON+=	misc/xen-bugtool
REPLACE_PYTHON+=	misc/xencons
REPLACE_PYTHON+=	misc/xend
REPLACE_PYTHON+=	misc/xensymoops
REPLACE_PYTHON+=	misc/xen-python-path
REPLACE_PYTHON+=	pygrub/src/pygrub
REPLACE_PYTHON+=	python/xen/util/*.py
REPLACE_PYTHON+=	python/xen/xend/*.py
REPLACE_PYTHON+=	python/xen/xm/*.py
REPLACE_PYTHON+=	python/xen/util/*.py
REPLACE_PYTHON+=	python/*.py
REPLACE_PYTHON+=	security/python/xensec_gen/cgi-bin/policy.cgi
REPLACE_PYTHON+=	security/python/xensec_gen/*.py
REPLACE_PYTHON+=	security/python/*.py
REPLACE_PYTHON+=	security/*.py
REPLACE_PYTHON+=	xenmon/*.py
REPLACE_PYTHON+=	xentrace/xentrace_format

SUBST_CLASSES+=		pathsvar
SUBST_STAGE.pathsvar=	pre-configure
SUBST_FILES.pathsvar=	examples/init.d/sysconfig.xendomains \
			examples/xend-config.sxp \
			python/xen/xend/server/relocate.py \
			python/xen/xend/XendOptions.py \
			security/Makefile security/python/xensec_gen/main.py \
			xenstore/xs_lib.c
SUBST_SED.pathsvar=	-e "s|/var/lib|${VARBASE}/run|g"

SUBST_CLASSES+=		py
SUBST_STAGE.py=		pre-configure
SUBST_FILES.py=		check/check_python
SUBST_FILES.py+=	check/check_python_devel
SUBST_FILES.py+=	pygrub/Makefile
SUBST_FILES.py+=	python/Makefile
SUBST_FILES.py+=	security/Makefile
SUBST_FILES.py+=	include/xen-foreign/Makefile
SUBST_FILES.py+=	include/xen-foreign/mkheader.py
SUBST_FILES.py+=	../xen/tools/get-fields.sh
SUBST_SED.py=		-e "s,python,${PYTHONBIN},g"

SUBST_CLASSES+=		conf
SUBST_STAGE.conf=	pre-configure
SUBST_FILES.conf=	python/xen/xend/XendOptions.py
SUBST_FILES.conf+=	python/xen/xend/osdep.py
SUBST_FILES.conf+=	python/xen/xm/create.py
SUBST_FILES.conf+=	python/xen/xm/addlabel.py
SUBST_FILES.conf+=	python/xen/xm/getlabel.py
SUBST_FILES.conf+=	python/xen/xm/rmlabel.py
SUBST_FILES.conf+=	xentrace/Makefile
SUBST_FILES.conf+=	ioemu/configure
SUBST_FILES.conf+=	ioemu/vl.c
SUBST_SED.conf=		-e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g"

SUBST_CLASSES+=		prefix
SUBST_STAGE.prefix=	pre-configure
SUBST_FILES.prefix=	python/xen/util/auxbin.py
SUBST_FILES.prefix+=	python/xen/xend/osdep.py
SUBST_FILES.prefix+=	misc/xen-python-path
SUBST_FILES.prefix+=	ioemu/vl.c
SUBST_SED.prefix=	-e "s,@PREFIX@,${PREFIX},g"

REPLACE_PYTHON+=	misc/xsview

SUBST_CLASSES.NetBSD+=	proc
SUBST_STAGE.proc=	pre-configure
SUBST_FILES.proc=	python/xen/xend/XendVnet.py
SUBST_SED.proc=		-e "s|/proc|/kern|g"

OPSYSVARS+=		PROCPATH
PROCPATH.NetBSD=	/kern
PROCPATH.*=		/proc

RCD_SCRIPTS=		xend xenbackendd xendomains
FILES_SUBST+=		RCD_INTERPRETER=${PYTHONBIN:Q}
FILES_SUBST+=		PROCPATH=${PROCPATH:Q}
FILES_SUBST+=		PKG_SYSCONFDIR=${PKG_SYSCONFDIR:Q}

BLKTAP_FILES=		blk_netbsd.c blktapctrl_netbsd.c

XEND_SCRIPTS=		block vif-bridge vif-ip qemu-ifup xen-subr

CONF_FILES=		${EGDIR}/formats ${PKG_SYSCONFDIR}/formats

CONF_FILES+=		${EGDIR}/xend-config.sxp \
			${PKG_SYSCONFDIR}/xend-config.sxp
.for s in ${XEND_SCRIPTS}
CONF_FILES_PERMS+=	${EGDIR}/${s} ${PKG_SYSCONFDIR}/scripts/${s}	\
			${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0755
.endfor

OWN_DIRS=		${PKG_SYSCONFDIR}/scripts /var/log/xen

.include "../../mk/compiler.mk"
.if !empty(PKGSRC_COMPILER:Mclang)
EXTRA_HOSTCFLAGS+=	-Wno-error=ignored-attributes -Wno-error=format-security
EXTRA_CFLAGS+=	-Wno-error=ignored-attributes -no-integrated-as \
		-Wno-error=tautological-compare -Wno-error=null-dereference \
		-Wno-error=self-assign -Wno-error=sometimes-uninitialized \
		-Wno-error=unused-function
.elif !empty(PKGSRC_COMPILER:Mgcc)
EXTRA_CFLAGS+=	-Wno-error=unused-but-set-variable
.endif

MAKE_ENV+=	EXTRA_HOSTCFLAGS=${EXTRA_HOSTCFLAGS:Q} EXTRA_CFLAGS=${EXTRA_CFLAGS:Q}

pre-build:
	rm -f ${WRKSRC}/check/check_x11_devel
.for s in ${BLKTAP_FILES}
	cp ${FILESDIR}/${s} ${WRKSRC}/blktap/drivers/
.endfor
	pod2man ${WRKSRC}/../docs/man/xend-config.sxp.pod.5  |\
	    sed -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
	    >${WRKDIR}/xend-config.sxp.5
	pod2man ${WRKSRC}/../docs/man/xmdomain.cfg.pod.5 |\
	    sed -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
	    >${WRKDIR}/xmdomain.cfg.5
	pod2man ${WRKSRC}/../docs/man/xm.pod.1 |\
	    sed -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
	    >${WRKDIR}/xm.1

.if ${OPSYS} == "NetBSD"
post-build:
	cd ${FILESDIR}; for src in *-nbsd; do				\
		dst="$${src%-nbsd}";					\
		${SED}	-e "s|@PKG_SYSCONFDIR@|${PKG_SYSCONFDIR}|g"	\
			-e "s|@PREFIX@|${PREFIX}|g"			\
			$$src > ${WRKSRC}/examples/$$dst;		\
	done
	${CC} ${CFLAGS}  ${LDFLAGS} \
	    -DVBD_SCRIPT=\"${PKG_SYSCONFDIR}/scripts/block\" \
	    -DLOG_FILE=\"${VARBASE}/log/xenbackendd.log\" \
	    -DPID_FILE=\"${VARBASE}/run/xenbackendd.pid\" \
	    -o ${WRKDIR}/xenbackendd.bin ${FILESDIR}/xenbackendd.c \
	    -I${WRKSRC}/libxc -I${WRKSRC}/include -L${WRKSRC}/libxc \
	    -I${WRKSRC}/xenstore -L${WRKSRC}/xenstore \
	    -lxenctrl -lxenstore

.endif

INSTALLATION_DIRS=	${EGDIR} ${PKGMANDIR}/man5

post-install:
	${INSTALL_PROGRAM} ${WRKDIR}/xenbackendd.bin \
	    ${DESTDIR}${PREFIX}/sbin/xenbackendd
	for f in xend-config.sxp xmexample1 xmexample2 xmexample3 netbsd1; do \
		${INSTALL_DATA} ${WRKSRC}/examples/$$f ${DESTDIR}${EGDIR}/$$f;	\
	done
.for s in ${XEND_SCRIPTS}
	${INSTALL_SCRIPT} ${WRKSRC}/examples/${s} ${DESTDIR}${EGDIR}/${s}
.endfor
	${INSTALL_DATA} ${WRKDIR}/xend-config.sxp.5 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man5
	${INSTALL_DATA} ${WRKDIR}/xmdomain.cfg.5 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man5
	${INSTALL_DATA} ${WRKDIR}/xm.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
	for f in hvm qemu-ifup; do \
		${INSTALL_DATA} ${WRKSRC}/examples/$$f ${DESTDIR}${EGDIR}/$$f;	\
	done

.include "../../lang/python/application.mk"
.include "../../lang/python/extension.mk"
.include "../../textproc/py-xml/buildlink3.mk"
.include "../../devel/ncurses/buildlink3.mk"
#.include "../../devel/SDL/buildlink3.mk"

.include "../../mk/bsd.pkg.mk"