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