qemu: packaging target {x86_64,arm}-softmmu and friends
[feed/packages.git] / utils / qemu / Makefile
1 #
2 # Copyright (C) 2016 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=qemu
11 PKG_VERSION:=2.6.2
12 PKG_RELEASE:=1
13 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
14 PKG_SOURCE_URL:=http://wiki.qemu-project.org/download/
15 PKG_SOURCE_MD5SUM:=bdf1f3d0c177ebeb35a079a4bc3fc74e
16 PKG_LICENSE:=GPL-2.0
17 PKG_LICENSE_FILES:=LICENSE tcg/LICENSE
18 PKG_MAINTAINER:=Yousong Zhou <yszhou4tech@gmail.com>
19
20 PKG_INSTALL:=1
21 PKG_USE_MIPS16:=0
22
23 include $(INCLUDE_DIR)/uclibc++.mk
24 include $(INCLUDE_DIR)/package.mk
25
26 define Package/qemu-ga
27 SECTION:=utils
28 CATEGORY:=Utilities
29 TITLE:=QEMU Guest Agent
30 URL:=http://www.qemu.org
31 DEPENDS:= +glib2 $(CXX_DEPENDS)
32 endef
33
34 define Package/qemu-ga/description
35 This package contains the QEMU Guest Agent daemon
36 endef
37
38 define Package/qemu-ga/install
39 $(INSTALL_DIR) $(1)/usr/bin
40 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/qemu-ga $(1)/usr/bin
41 $(INSTALL_DIR) $(1)/etc/init.d
42 $(INSTALL_BIN) ./files/qemu-ga.init $(1)/etc/init.d/qemu-ga
43 $(INSTALL_DIR) $(1)/etc/hotplug.d/virtio-ports
44 $(INSTALL_BIN) ./files/virtio-ports.hotplug $(1)/etc/hotplug.d/virtio-ports/qemu-ga
45 endef
46
47 define Package/qemu-blobs
48 SECTION:=utils
49 CATEGORY:=Utilities
50 TITLE:=QEMU blobs of BIOS, VGA BIOS and keymaps
51 URL:=http://www.qemu.org
52 DEPENDS:=
53 endef
54
55 define Package/qemu-blobs/install
56 $(INSTALL_DIR) $(1)/usr/share/qemu
57 $(CP) $(PKG_INSTALL_DIR)/usr/share/qemu/* $(1)/usr/share/qemu
58 endef
59
60 define Package/qemu-bridge-helper
61 SECTION:=utils
62 CATEGORY:=Utilities
63 TITLE:=QEMU bridge helper
64 URL:=http://www.qemu.org
65 DEPENDS:=+glib2 $(CXX_DEPENDS)
66 endef
67
68 define Package/qemu-bridge-helper/install
69 $(INSTALL_DIR) $(1)/usr/lib/
70 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/qemu-bridge-helper $(1)/usr/lib
71 $(INSTALL_DIR) $(1)/etc/qemu
72 $(INSTALL_DATA) ./files/bridge.conf $(1)/etc/qemu
73 endef
74
75 PKG_CONFIG_DEPENDS += CONFIG_PACKAGE_qemu-ga
76
77 # Naming rules used in qemu Makefile.target
78 define qemu-prog_
79 $(if $(filter %-softmmu,$(1)), \
80 $(patsubst %-softmmu,qemu-system-%,$(1)), \
81 $(error unknown qemu target $(1)) \
82 )
83 endef
84 qemu-prog = $(strip $(call qemu-prog_,$(1)))
85
86 # Why libfdt was enabled for all softmmu targets: according to qemu's
87 # configure script, libfdt is only strictly required for the following targets
88 # and is optional for others. But libfdt support will be built into other
89 # targets when any single target enabled it.
90 #
91 # aarch64%-softmmu arm%-softmmu ppc%-softmmu microblaze%-softmmu
92 #
93 define qemu-target
94 PKG_CONFIG_DEPENDS += CONFIG_PACKAGE_qemu-$(1)
95
96 define Package/qemu-$(1)
97 SECTION:=utils
98 CATEGORY:=Utilities
99 TITLE:=QEMU target $(1)
100 URL:=http://www.qemu.org
101 DEPENDS:= +glib2 +libpthread +zlib $(CXX_DEPENDS) \
102 $(if $(filter %-softmmu,$(1)),+libncurses +libfdt +qemu-blobs) \
103 @(TARGET_x86_64||TARGET_sunxi)
104 endef
105
106 define Package/qemu-$(1)/description
107 This package contains the QEMU target $(1)
108 endef
109
110 define Package/qemu-$(1)/install
111 $(INSTALL_DIR) $$(1)/usr/bin
112 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(call qemu-prog,$(1)) $$(1)/usr/bin
113 endef
114
115 endef
116
117 QEMU_TARGET_LIST := \
118 x86_64-softmmu \
119 arm-softmmu \
120
121 $(foreach target,$(QEMU_TARGET_LIST), \
122 $(eval $(call qemu-target,$(target))) \
123 )
124
125 # QEMU configure script does not recognize these options
126 CONFIGURE_ARGS:=$(filter-out \
127 --target=% \
128 --host=% \
129 --build=% \
130 --program-prefix=% \
131 --program-suffix=% \
132 --exec-prefix=% \
133 --disable-nls \
134 , $(CONFIGURE_ARGS))
135
136 # Tell build system of qemu to not add _FORTIFY_SOURCE options and let the base
137 # build system decide flavor of fortify_source to use
138 CONFIGURE_ARGS += \
139 --cross-prefix=$(TARGET_CROSS) \
140 --host-cc="$(HOSTCC)" \
141 --disable-fortify-source \
142 --disable-stack-protector \
143
144 CONFIGURE_ARGS += \
145 --audio-drv-list='' \
146 --disable-debug-info \
147 --disable-modules \
148 --disable-sdl \
149 --disable-qom-cast-debug \
150 --disable-virtfs \
151 --disable-vnc \
152 --disable-debug-tcg \
153 --disable-sparse \
154 --disable-strip \
155 --disable-vnc-sasl \
156 --disable-vnc-jpeg \
157 --disable-vnc-png \
158 --disable-uuid \
159 --disable-vde \
160 --disable-netmap \
161 --disable-xen \
162 --disable-xen-pci-passthrough \
163 --disable-xen-pv-domain-build \
164 --disable-brlapi \
165 --disable-bluez \
166 --disable-tcg-interpreter \
167 --disable-cap-ng \
168 --disable-spice \
169 --disable-libiscsi \
170 --disable-libnfs \
171 --disable-cocoa \
172 --disable-bsd-user \
173 --disable-curl \
174 --disable-linux-aio \
175 --disable-attr \
176 --disable-docs \
177 --disable-opengl \
178 --disable-rbd \
179 --disable-xfsctl \
180 --disable-smartcard \
181 --disable-libusb \
182 --disable-usb-redir \
183 --disable-zlib-test \
184 --disable-lzo \
185 --disable-snappy \
186 --disable-bzip2 \
187 --disable-guest-agent-msi \
188 --disable-tools \
189 --disable-seccomp \
190 --disable-glusterfs \
191 --disable-archipelago \
192 --disable-gtk \
193 --disable-gnutls \
194 --disable-nettle \
195 --disable-gcrypt \
196 --disable-rdma \
197 --disable-vte \
198 --disable-virglrenderer \
199 --disable-tpm \
200 --disable-libssh2 \
201 --disable-vhdx \
202 --disable-numa \
203 --disable-tcmalloc \
204 --disable-jemalloc \
205 --disable-strip \
206 --disable-werror \
207
208 QEMU_CONFIGURE_TARGET_LIST := $(foreach target,$(QEMU_TARGET_LIST),$(if $(CONFIG_PACKAGE_qemu-$(target)),$(target)))
209 CONFIGURE_ARGS += --target-list='$(QEMU_CONFIGURE_TARGET_LIST)'
210
211 ifneq ($(CONFIG_PACKAGE_qemu-ga),)
212 CONFIGURE_ARGS += --enable-guest-agent
213 endif
214
215 TARGET_LDFLAGS += -Wl,--as-needed
216 MAKE_VARS += V=s
217 # ARCH is special in qemu's build system, e.g. ARCH mips64 will be translated
218 # there to mips and stored in config-host.mak
219 MAKE_FLAGS:=$(filter-out \
220 ARCH=% \
221 ,$(MAKE_FLAGS))
222
223 QEMU_MAKE_TARGETS := \
224 $(if $(CONFIG_PACKAGE_qemu-ga),qemu-ga) \
225 $(if $(CONFIG_PACKAGE_qemu-bridge-helper),qemu-bridge-helper) \
226 $(foreach target,$(QEMU_TARGET_LIST),$(if $(CONFIG_PACKAGE_qemu-$(target)),subdir-$(target))) \
227
228 define Build/Compile
229 $(if $(strip $(QEMU_MAKE_TARGETS)),$(call Build/Compile/Default,$(QEMU_MAKE_TARGETS)))
230 endef
231
232 $(eval $(call BuildPackage,qemu-ga))
233 $(eval $(call BuildPackage,qemu-bridge-helper))
234 $(eval $(call BuildPackage,qemu-blobs))
235 $(foreach target,$(QEMU_TARGET_LIST), \
236 $(eval $(call BuildPackage,qemu-$(target))) \
237 )