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