package/libxslt: fix static build
[buildroot-gz.git] / package / qemu / qemu.mk
blob1b08b42f27f77742e2e7a006150c735e7ba78a51
1 ################################################################################
3 # qemu
5 ################################################################################
7 QEMU_VERSION = 2.5.0
8 QEMU_SOURCE = qemu-$(QEMU_VERSION).tar.bz2
9 QEMU_SITE = http://wiki.qemu.org/download
10 QEMU_LICENSE = GPLv2, LGPLv2.1, MIT, BSD-3c, BSD-2c, Others/BSD-1c
11 QEMU_LICENSE_FILES = COPYING COPYING.LIB
12 # NOTE: there is no top-level license file for non-(L)GPL licenses;
13 # the non-(L)GPL license texts are specified in the affected
14 # individual source files.
16 #-------------------------------------------------------------
17 # Host-qemu
19 HOST_QEMU_DEPENDENCIES = host-pkgconf host-python host-zlib host-libglib2 host-pixman
21 # BR ARCH qemu
22 # ------- ----
23 # arm arm
24 # armeb armeb
25 # bfin not supported
26 # i386 i386
27 # i486 i386
28 # i586 i386
29 # i686 i386
30 # x86_64 x86_64
31 # m68k m68k
32 # microblaze microblaze
33 # mips mips
34 # mipsel mipsel
35 # mips64 mips64
36 # mips64el mips64el
37 # powerpc ppc
38 # sh2a not supported
39 # sh4 sh4
40 # sh4eb sh4eb
41 # sh4a sh4
42 # sh4aeb sh4eb
43 # sh64 not supported
44 # sparc sparc
46 HOST_QEMU_ARCH = $(ARCH)
47 ifeq ($(HOST_QEMU_ARCH),i486)
48 HOST_QEMU_ARCH = i386
49 endif
50 ifeq ($(HOST_QEMU_ARCH),i586)
51 HOST_QEMU_ARCH = i386
52 endif
53 ifeq ($(HOST_QEMU_ARCH),i686)
54 HOST_QEMU_ARCH = i386
55 endif
56 ifeq ($(HOST_QEMU_ARCH),powerpc)
57 HOST_QEMU_ARCH = ppc
58 endif
59 ifeq ($(HOST_QEMU_ARCH),sh4a)
60 HOST_QEMU_ARCH = sh4
61 endif
62 ifeq ($(HOST_QEMU_ARCH),sh4aeb)
63 HOST_QEMU_ARCH = sh4eb
64 endif
65 HOST_QEMU_TARGETS = $(HOST_QEMU_ARCH)-linux-user
67 ifeq ($(BR2_PACKAGE_HOST_QEMU),y)
68 HOST_QEMU_HOST_SYSTEM_TYPE = $(shell uname -s)
69 ifneq ($(HOST_QEMU_HOST_SYSTEM_TYPE),Linux)
70 $(error "qemu-user can only be used on Linux hosts")
71 endif
73 # kernel version as major*256 + minor
74 HOST_QEMU_HOST_SYSTEM_VERSION = $(shell uname -r | awk -F. '{ print $$1 * 256 + $$2 }')
75 HOST_QEMU_TARGET_SYSTEM_VERSION = $(shell echo $(BR2_TOOLCHAIN_HEADERS_AT_LEAST) | awk -F. '{ print $$1 * 256 + $$2 }')
76 HOST_QEMU_COMPARE_VERSION = $(shell test $(HOST_QEMU_HOST_SYSTEM_VERSION) -ge $(HOST_QEMU_TARGET_SYSTEM_VERSION) && echo OK)
79 # The principle of qemu-user is that it emulates the instructions of
80 # the target architecture when running the binary, and then when this
81 # binary does a system call, it converts this system call into a
82 # system call on the host machine. This mechanism makes an assumption:
83 # that the target binary will not do system calls that do not exist on
84 # the host. This basically requires that the target binary should be
85 # built with kernel headers that are older or the same as the kernel
86 # version running on the host machine.
88 ifeq ($(BR_BUILDING),y)
89 ifneq ($(HOST_QEMU_COMPARE_VERSION),OK)
90 $(error "Refusing to build qemu-user: target Linux version newer than host's.")
91 endif
92 endif
93 endif
95 define HOST_QEMU_CONFIGURE_CMDS
96 cd $(@D); $(HOST_CONFIGURE_OPTS) ./configure \
97 --target-list="$(HOST_QEMU_TARGETS)" \
98 --prefix="$(HOST_DIR)/usr" \
99 --interp-prefix=$(STAGING_DIR) \
100 --cc="$(HOSTCC)" \
101 --host-cc="$(HOSTCC)" \
102 --python=$(HOST_DIR)/usr/bin/python2 \
103 --extra-cflags="$(HOST_CFLAGS)" \
104 --extra-ldflags="$(HOST_LDFLAGS)"
105 endef
107 define HOST_QEMU_BUILD_CMDS
108 $(HOST_MAKE_ENV) $(MAKE) -C $(@D)
109 endef
111 define HOST_QEMU_INSTALL_CMDS
112 $(HOST_MAKE_ENV) $(MAKE) -C $(@D) install
113 endef
115 $(eval $(host-generic-package))
117 # variable used by other packages
118 QEMU_USER = $(HOST_DIR)/usr/bin/qemu-$(HOST_QEMU_ARCH)
120 #-------------------------------------------------------------
121 # Target-qemu
123 QEMU_DEPENDENCIES = host-pkgconf host-python libglib2 zlib pixman
125 # Need the LIBS variable because librt and libm are
126 # not automatically pulled. :-(
127 QEMU_LIBS = -lrt -lm
129 QEMU_OPTS =
131 QEMU_VARS = \
132 LIBTOOL=$(HOST_DIR)/usr/bin/libtool \
133 PYTHON=$(HOST_DIR)/usr/bin/python2 \
134 PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
136 # If we want to specify only a subset of targets, we must still enable all
137 # of them, so that QEMU properly builds its list of default targets, from
138 # which it then checks if the specified sub-set is valid. That's what we
139 # do in the first part of the if-clause.
140 # Otherwise, if we do not want to pass a sub-set of targets, we then need
141 # to either enable or disable -user and/or -system emulation appropriately.
142 # That's what we do in the else-clause.
143 ifneq ($(call qstrip,$(BR2_PACKAGE_QEMU_CUSTOM_TARGETS)),)
144 QEMU_OPTS += --enable-system --enable-linux-user
145 QEMU_OPTS += --target-list="$(call qstrip,$(BR2_PACKAGE_QEMU_CUSTOM_TARGETS))"
146 else
148 ifeq ($(BR2_PACKAGE_QEMU_SYSTEM),y)
149 QEMU_OPTS += --enable-system
150 else
151 QEMU_OPTS += --disable-system
152 endif
154 ifeq ($(BR2_PACKAGE_QEMU_LINUX_USER),y)
155 QEMU_OPTS += --enable-linux-user
156 else
157 QEMU_OPTS += --disable-linux-user
158 endif
160 endif
162 ifeq ($(BR2_PACKAGE_QEMU_SDL),y)
163 QEMU_OPTS += --enable-sdl
164 QEMU_DEPENDENCIES += sdl
165 QEMU_VARS += SDL_CONFIG=$(BR2_STAGING_DIR)/usr/bin/sdl-config
166 else
167 QEMU_OPTS += --disable-sdl
168 endif
170 ifeq ($(BR2_PACKAGE_QEMU_FDT),y)
171 QEMU_OPTS += --enable-fdt
172 QEMU_DEPENDENCIES += dtc
173 else
174 QEMU_OPTS += --disable-fdt
175 endif
177 define QEMU_CONFIGURE_CMDS
178 ( cd $(@D); \
179 LIBS='$(QEMU_LIBS)' \
180 $(TARGET_CONFIGURE_OPTS) \
181 $(TARGET_CONFIGURE_ARGS) \
182 $(QEMU_VARS) \
183 ./configure \
184 --prefix=/usr \
185 --cross-prefix=$(TARGET_CROSS) \
186 --with-system-pixman \
187 --audio-drv-list= \
188 --enable-kvm \
189 --enable-attr \
190 --enable-vhost-net \
191 --disable-bsd-user \
192 --disable-xen \
193 --disable-slirp \
194 --disable-vnc \
195 --disable-virtfs \
196 --disable-brlapi \
197 --disable-curses \
198 --disable-curl \
199 --disable-bluez \
200 --disable-uuid \
201 --disable-vde \
202 --disable-linux-aio \
203 --disable-cap-ng \
204 --disable-docs \
205 --disable-spice \
206 --disable-rbd \
207 --disable-libiscsi \
208 --disable-usb-redir \
209 --disable-strip \
210 --disable-seccomp \
211 --disable-sparse \
212 --disable-tools \
213 $(QEMU_OPTS) \
215 endef
217 define QEMU_BUILD_CMDS
218 $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
219 endef
221 define QEMU_INSTALL_TARGET_CMDS
222 $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(QEMU_MAKE_ENV) DESTDIR=$(TARGET_DIR) install
223 endef
225 $(eval $(generic-package))