aboutsummaryrefslogtreecommitdiff
path: root/emulators/qemu-devel/Makefile
blob: 895cd7595003c620bf96e9ae35a2eef3535dbb2a (plain) (blame)
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
# New ports collection makefile for:	qemu
# Date created:			2004/05/31
# Whom:				Juergen Lock <nox@jelal.kn-bremen.de>
#
# $FreeBSD$
#

PORTNAME=	qemu
PORTVERSION=	0.7.2s.20050909
CATEGORIES=	emulators
MASTER_SITES=	http://www.qemu.org/ \
		http://people.fruitsalad.org/nox/qemu/ \
		http://dad-answers.com/qemu/
DISTNAME=	${PORTNAME}-snapshot-2005-09-09_23
EXTRACT_ONLY=	${DISTNAME}${EXTRACT_SUFX}

MAINTAINER=	nox@jelal.kn-bremen.de
COMMENT=	QEMU CPU Emulator

BUILD_DEPENDS+=	texi2html:${PORTSDIR}/textproc/texi2html
.if defined(WITH_SAMBA)
RUN_DEPENDS+=	${LOCALBASE}/sbin/smbd:${PORTSDIR}/net/samba
.endif

.if defined(WITH_KQEMU)
DISTKQEMU=	kqemu-0.7.2.tar.gz
DISTFILES=	${EXTRACT_ONLY} ${DISTKQEMU}
EXTRA_PATCHES=	${FILESDIR}/kqemu-freebsd-patch
.endif

HAS_CONFIGURE=	yes
USE_BZIP2=	yes
USE_GMAKE=	yes
USE_GETOPT_LONG=	yes
USE_SDL=	sdl
USE_PERL5=	yes
PATCH_STRIP=	-p1
CONFIGURE_ARGS+=	--prefix=${PREFIX} --cc=${CC}
MAKE_ENV+=	BSD_MAKE=${MAKE}
MAN1=		qemu.1 qemu-img.1
ONLY_FOR_ARCHS=	amd64 i386
.if defined(WITH_KQEMU)
NO_PACKAGE=	Depends on kernel, and module not redistributable
CONFIGURE_ARGS+=	--enable-kqemu
PLIST_SUB=	WITH_KQEMU=""
PLIST_SUB+=	KMODDIR=${KMODDIR}
.else
CONFIGURE_ARGS+=	--disable-kqemu
PLIST_SUB=	WITH_KQEMU="@comment "
.endif

# gcc34 (system cc on 5.x now) has problems with qemu on amd64
# (doesnt build target-i386/op.c), try the one in ports which is newer
.include <bsd.port.pre.mk>

.if ${ARCH} == "amd64"
ARCH=		x86_64
.if ${OSVERSION} >= 502126 && ${OSVERSION} <= 600029
BUILD_DEPENDS+=	gcc34:${PORTSDIR}/lang/gcc34
GCCVERSION=	030402
CC=		gcc34
.else
USE_GCC=	3.4
.endif
.else
USE_GCC=	3.4
.endif

.if defined(WITH_KQEMU) && !exists(${SRC_BASE}/sys/Makefile)
IGNORE=		kqemu requires kernel source to be installed
.endif

pre-everything::
.if !defined(WITH_KQEMU)
	@${ECHO_MSG} "Notice: you can build qemu with the (alpha!) kqemu accelerator kernel module"
	@${ECHO_MSG} "by defining WITH_KQEMU."
.endif
.if !defined(WITH_SAMBA) && !exists(${LOCALBASE}/sbin/smbd)
	@${ECHO_MSG} "Notice: if you need qemu's -smb option (smb-export local dir to guest)"
	@${ECHO_MSG} "then you also need samba, you can have this port install it by defining"
	@${ECHO_MSG} "WITH_SAMBA."
.endif

.if defined(WITH_KQEMU)
post-extract:
	@cd ${WRKSRC} && ${TAR} xfz ${_DISTDIR}/${DISTKQEMU}
	@${LN} -s Makefile.freebsd ${WRKSRC}/kqemu/BSDmakefile
.endif

pre-patch:
	@for A in ${ONLY_FOR_ARCHS}; do \
		${MKDIR} ${WRKSRC}/bsd/$$A; \
	done

post-install:
.if defined(WITH_KQEMU)
	${INSTALL_SCRIPT} ${WRKSRC}/kqemu/kqemu.ko ${KMODDIR}
	if mount |${GREP} ^devfs >/dev/null ; then \
		: ; \
	else \
		if [ ! -e /dev/kqemu ]; then\
			mknod /dev/kqemu c 250 0 ; \
		fi ; \
		${CHMOD} 666 /dev/kqemu ; \
	fi
.endif
	@${CAT} ${PKGMESSAGE}

.include <bsd.port.post.mk>