1 |
commit: dccb419d713441f745564eadfab23156bfcade0d |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jul 6 09:03:32 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jul 6 09:04:17 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dccb419d |
7 |
|
8 |
app-emulation/virtualbox-guest-additions: respect toolchain env (mostly) |
9 |
|
10 |
Nearly there but there's some snags with LD. Most of this is syncing |
11 |
with vbox. |
12 |
|
13 |
Bug: https://bugs.gentoo.org/759100 |
14 |
Closes: https://bugs.gentoo.org/739662 |
15 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
16 |
|
17 |
.../virtualbox-guest-additions-6.1.34-r2.ebuild | 272 +++++++++++++++++++++ |
18 |
1 file changed, 272 insertions(+) |
19 |
|
20 |
diff --git a/app-emulation/virtualbox-guest-additions/virtualbox-guest-additions-6.1.34-r2.ebuild b/app-emulation/virtualbox-guest-additions/virtualbox-guest-additions-6.1.34-r2.ebuild |
21 |
new file mode 100644 |
22 |
index 000000000000..76a478a3ee24 |
23 |
--- /dev/null |
24 |
+++ b/app-emulation/virtualbox-guest-additions/virtualbox-guest-additions-6.1.34-r2.ebuild |
25 |
@@ -0,0 +1,272 @@ |
26 |
+# Copyright 2022 Gentoo Authors |
27 |
+# Distributed under the terms of the GNU General Public License v2 |
28 |
+ |
29 |
+EAPI=8 |
30 |
+ |
31 |
+inherit edo linux-mod systemd toolchain-funcs udev |
32 |
+ |
33 |
+MY_PN="VirtualBox" |
34 |
+MY_PV="${PV/beta/BETA}" |
35 |
+MY_PV="${MY_PV/rc/RC}" |
36 |
+MY_P="${MY_PN}-${MY_PV}" |
37 |
+[[ "${PV}" == *a ]] && DIR_PV="$(ver_cut 1-3)" |
38 |
+ |
39 |
+DESCRIPTION="VirtualBox kernel modules and user-space tools for Gentoo guests" |
40 |
+HOMEPAGE="https://www.virtualbox.org/" |
41 |
+SRC_URI="https://download.virtualbox.org/virtualbox/${DIR_PV:-${MY_PV}}/${MY_P}.tar.bz2 |
42 |
+ https://dev.gentoo.org/~polynomial-c/virtualbox/patchsets/virtualbox-6.1.12-patches-01.tar.xz" |
43 |
+ |
44 |
+LICENSE="GPL-2" |
45 |
+SLOT="0/$(ver_cut 1-2)" |
46 |
+[[ "${PV}" == *_beta* ]] || [[ "${PV}" == *_rc* ]] || \ |
47 |
+KEYWORDS="~amd64 ~x86" |
48 |
+IUSE="X" |
49 |
+ |
50 |
+# automount Error: VBoxServiceAutoMountWorker: Group "vboxsf" does not exist |
51 |
+RDEPEND=" |
52 |
+ acct-group/vboxguest |
53 |
+ acct-group/vboxsf |
54 |
+ acct-user/vboxguest |
55 |
+ X? ( x11-apps/xrandr |
56 |
+ x11-apps/xrefresh |
57 |
+ x11-libs/libXmu |
58 |
+ x11-libs/libX11 |
59 |
+ x11-libs/libXt |
60 |
+ x11-libs/libXext |
61 |
+ x11-libs/libXau |
62 |
+ x11-libs/libXdmcp |
63 |
+ x11-libs/libSM |
64 |
+ x11-libs/libICE ) |
65 |
+ sys-apps/dbus |
66 |
+" |
67 |
+DEPEND=" |
68 |
+ ${RDEPEND} |
69 |
+ >=dev-util/kbuild-0.1.9998.3127 |
70 |
+ >=dev-lang/yasm-0.6.2 |
71 |
+ sys-devel/bin86 |
72 |
+ sys-libs/pam |
73 |
+ sys-power/iasl |
74 |
+ x11-base/xorg-proto |
75 |
+" |
76 |
+PDEPEND=" |
77 |
+ X? ( x11-drivers/xf86-video-vboxvideo ) |
78 |
+" |
79 |
+BUILD_TARGETS="all" |
80 |
+BUILD_TARGET_ARCH="${ARCH}" |
81 |
+ |
82 |
+S="${WORKDIR}/${MY_PN}-${DIR_PV:-${PV}}" |
83 |
+VBOX_MOD_SRC_DIR="${S}/out/linux.${ARCH}/release/bin/additions/src" |
84 |
+ |
85 |
+pkg_setup() { |
86 |
+ export DISTCC_DISABLE=1 #674256 |
87 |
+ MODULE_NAMES="vboxguest(misc:${VBOX_MOD_SRC_DIR}/vboxguest:${VBOX_MOD_SRC_DIR}/vboxguest) |
88 |
+ vboxsf(misc:${VBOX_MOD_SRC_DIR}/vboxsf:${VBOX_MOD_SRC_DIR}/vboxsf)" |
89 |
+ use X && MODULE_NAMES+=" vboxvideo(misc:${VBOX_MOD_SRC_DIR}/vboxvideo::${VBOX_MOD_SRC_DIR}/vboxvideo)" |
90 |
+ |
91 |
+ linux-mod_pkg_setup |
92 |
+ BUILD_PARAMS="KERN_DIR=/lib/modules/${KV_FULL}/build KERNOUT=${KV_OUT_DIR} KBUILD_EXTRA_SYMBOLS=${S}/Module.symvers" |
93 |
+} |
94 |
+ |
95 |
+src_prepare() { |
96 |
+ # Remove shipped binaries (kBuild,yasm), see bug #232775 |
97 |
+ rm -r kBuild/bin tools || die |
98 |
+ |
99 |
+ # Provide kernel sources |
100 |
+ pushd src/VBox/Additions &>/dev/null || die |
101 |
+ ebegin "Extracting guest kernel module sources" |
102 |
+ kmk GuestDrivers-src vboxguest-src vboxsf-src vboxvideo-src &>/dev/null |
103 |
+ eend $? || die |
104 |
+ popd &>/dev/null || die |
105 |
+ |
106 |
+ # PaX fixes (see bug #298988) |
107 |
+ pushd "${VBOX_MOD_SRC_DIR}" &>/dev/null || die |
108 |
+ eapply "${FILESDIR}"/vboxguest-6.0.6-log-use-c99.patch |
109 |
+ popd &>/dev/null || die |
110 |
+ |
111 |
+ # Disable things unused or splitted into separate ebuilds |
112 |
+ cp "${FILESDIR}/${PN}-5-localconfig" LocalConfig.kmk || die |
113 |
+ use X || echo "VBOX_WITH_X11_ADDITIONS :=" >> LocalConfig.kmk |
114 |
+ |
115 |
+ # Remove pointless GCC version check |
116 |
+ sed -e '/^check_gcc$/d' -i configure || die |
117 |
+ |
118 |
+ # Respect LDFLAGS |
119 |
+ #sed -e "s@_LDFLAGS\.${ARCH}*.*=@& ${LDFLAGS}@g" \ |
120 |
+ # -i Config.kmk src/libs/xpcom18a4/Config.kmk || die |
121 |
+ |
122 |
+ # Do not use hard-coded ld (related to bug #488176) |
123 |
+ #sed -e '/QUIET)ld /s@ld @$(LD) @' \ |
124 |
+ # -i src/VBox/Devices/PC/ipxe/Makefile.kmk || die |
125 |
+ |
126 |
+ eapply "${WORKDIR}/patches" |
127 |
+ eapply_user |
128 |
+} |
129 |
+ |
130 |
+src_configure() { |
131 |
+ tc-export AR CC CXX LD RANLIB |
132 |
+ |
133 |
+ # Build the user-space tools, warnings are harmless |
134 |
+ local myconf=( |
135 |
+ --with-gcc="$(tc-getCC)" |
136 |
+ --with-g++="$(tc-getCXX)" |
137 |
+ |
138 |
+ --nofatal |
139 |
+ --disable-xpcom |
140 |
+ --disable-sdl-ttf |
141 |
+ --disable-pulse |
142 |
+ --disable-alsa |
143 |
+ --target-arch=${ARCH} |
144 |
+ --with-linux="${KV_OUT_DIR}" |
145 |
+ --build-headless |
146 |
+ ) |
147 |
+ |
148 |
+ # bug #843437 |
149 |
+ cat >> LocalConfig.kmk <<-EOF || die |
150 |
+ CFLAGS=${CFLAGS} |
151 |
+ CXXFLAGS=${CXXFLAGS} |
152 |
+ EOF |
153 |
+ |
154 |
+ edo ./configure "${myconf[@]}" |
155 |
+} |
156 |
+ |
157 |
+src_compile() { |
158 |
+ source ./env.sh || die |
159 |
+ |
160 |
+ # Force kBuild to respect C[XX]FLAGS and MAKEOPTS (bug #178529) |
161 |
+ MAKEJOBS=$(grep -Eo '(\-j|\-\-jobs)(=?|[[:space:]]*)[[:digit:]]+' <<< ${MAKEOPTS}) |
162 |
+ MAKELOAD=$(grep -Eo '(\-l|\-\-load-average)(=?|[[:space:]]*)[[:digit:]]+' <<< ${MAKEOPTS}) |
163 |
+ MAKEOPTS="${MAKEJOBS} ${MAKELOAD}" |
164 |
+ |
165 |
+ local myemakeargs=( |
166 |
+ VBOX_BUILD_PUBLISHER=_Gentoo |
167 |
+ VBOX_ONLY_ADDITIONS=1 |
168 |
+ |
169 |
+ KBUILD_VERBOSE=2 |
170 |
+ |
171 |
+ AS="$(tc-getCC)" |
172 |
+ CC="$(tc-getCC)" |
173 |
+ CXX="$(tc-getCXX)" |
174 |
+ LD="$(tc-getCC)" |
175 |
+ |
176 |
+ TOOL_GCC3_CC="$(tc-getCC)" |
177 |
+ TOOL_GCC3_CXX="$(tc-getCXX)" |
178 |
+ TOOL_GCC3_LD="$(tc-getCC)" |
179 |
+ TOOL_GCC3_AS="$(tc-getCC)" |
180 |
+ TOOL_GCC3_AR="$(tc-getAR)" |
181 |
+ TOOL_GCC3_OBJCOPY="$(tc-getOBJCOPY)" |
182 |
+ #TOOL_GCC3_LD_SYSMOD="$(tc-getCC)" |
183 |
+ |
184 |
+ TOOL_GXX3_CC="$(tc-getCC)" |
185 |
+ TOOL_GXX3_CXX="$(tc-getCXX)" |
186 |
+ TOOL_GXX3_LD="$(tc-getCXX)" |
187 |
+ TOOL_GXX3_AS="$(tc-getCXX)" |
188 |
+ TOOL_GXX3_AR="$(tc-getAR)" |
189 |
+ TOOL_GXX3_OBJCOPY="$(tc-getOBJCOPY)" |
190 |
+ #TOOL_GXX3_LD_SYSMOD="$(tc-getCXX)" |
191 |
+ |
192 |
+ TOOL_GCC3_CFLAGS="${CFLAGS}" |
193 |
+ TOOL_GCC3_CXXFLAGS="${CXXFLAGS}" |
194 |
+ VBOX_GCC_OPT="${CXXFLAGS}" |
195 |
+ VBOX_NM="$(tc-getNM)" |
196 |
+ TOOL_YASM_AS=yasm |
197 |
+ ) |
198 |
+ |
199 |
+ MAKE="kmk" emake "${myemakeargs[@]}" |
200 |
+ |
201 |
+ # Now creating the kernel modules. We must do this _after_ |
202 |
+ # we compiled the user-space tools as we need two of the |
203 |
+ # automatically generated header files. (>=3.2.0) |
204 |
+ linux-mod_src_compile |
205 |
+} |
206 |
+ |
207 |
+src_install() { |
208 |
+ linux-mod_src_install |
209 |
+ |
210 |
+ cd "${S}"/out/linux.${ARCH}/release/bin/additions || die |
211 |
+ |
212 |
+ insinto /sbin |
213 |
+ newins mount.vboxsf mount.vboxsf |
214 |
+ fperms 4755 /sbin/mount.vboxsf |
215 |
+ |
216 |
+ newinitd "${FILESDIR}"/${PN}-8.initd-r1 ${PN} |
217 |
+ |
218 |
+ insinto /usr/sbin/ |
219 |
+ newins VBoxService vboxguest-service |
220 |
+ fperms 0755 /usr/sbin/vboxguest-service |
221 |
+ |
222 |
+ insinto /usr/bin |
223 |
+ doins VBoxControl |
224 |
+ fperms 0755 /usr/bin/VBoxControl |
225 |
+ |
226 |
+ # VBoxClient user service and xrandr wrapper |
227 |
+ if use X ; then |
228 |
+ doins VBoxClient |
229 |
+ fperms 0755 /usr/bin/VBoxClient |
230 |
+ doins VBoxDRMClient |
231 |
+ fperms 4755 /usr/bin/VBoxDRMClient |
232 |
+ |
233 |
+ pushd "${S}"/src/VBox/Additions/x11/Installer &>/dev/null \ |
234 |
+ || die |
235 |
+ newins 98vboxadd-xclient VBoxClient-all |
236 |
+ fperms 0755 /usr/bin/VBoxClient-all |
237 |
+ popd &>/dev/null || die |
238 |
+ fi |
239 |
+ |
240 |
+ # udev rule for vboxdrv |
241 |
+ local udev_rules_dir="/lib/udev/rules.d" |
242 |
+ dodir ${udev_rules_dir} |
243 |
+ echo 'KERNEL=="vboxguest", OWNER="vboxguest", GROUP="vboxguest", MODE="0660"' \ |
244 |
+ >> "${ED}/${udev_rules_dir}/60-virtualbox-guest-additions.rules" \ |
245 |
+ || die |
246 |
+ echo 'KERNEL=="vboxuser", OWNER="vboxguest", GROUP="vboxguest", MODE="0660"' \ |
247 |
+ >> "${ED}/${udev_rules_dir}/60-virtualbox-guest-additions.rules" \ |
248 |
+ || die |
249 |
+ |
250 |
+ # VBoxClient autostart file |
251 |
+ insinto /etc/xdg/autostart |
252 |
+ doins "${FILESDIR}"/vboxclient.desktop |
253 |
+ |
254 |
+ # sample xorg.conf |
255 |
+ dodoc "${FILESDIR}"/xorg.conf.vbox |
256 |
+ docompress -x "${ED}"/usr/share/doc/${PF}/xorg.conf.vbox |
257 |
+ |
258 |
+ systemd_dounit "${FILESDIR}/${PN}.service" |
259 |
+} |
260 |
+ |
261 |
+pkg_postinst() { |
262 |
+ linux-mod_pkg_postinst |
263 |
+ udev_reload |
264 |
+ if ! use X ; then |
265 |
+ elog "use flag X is off, enable it to install the" |
266 |
+ elog "X Window System video driver." |
267 |
+ fi |
268 |
+ elog "" |
269 |
+ elog "Please add users to the \"vboxguest\" group so they can" |
270 |
+ elog "benefit from seamless mode, auto-resize and clipboard." |
271 |
+ elog "" |
272 |
+ elog "The vboxsf group has been added to make automount services work." |
273 |
+ elog "These services are part of the shared folders support." |
274 |
+ elog "" |
275 |
+ elog "Please add:" |
276 |
+ elog "/etc/init.d/${PN}" |
277 |
+ elog "to the default runlevel in order to start" |
278 |
+ elog "needed services." |
279 |
+ elog "To use the VirtualBox X driver, use the following" |
280 |
+ elog "file as your /etc/X11/xorg.conf:" |
281 |
+ elog " /usr/share/doc/${PF}/xorg.conf.vbox" |
282 |
+ elog "" |
283 |
+ elog "Also make sure you use the Mesa library for OpenGL:" |
284 |
+ elog " eselect opengl set xorg-x11" |
285 |
+ elog "" |
286 |
+ elog "An autostart .desktop file has been installed to start" |
287 |
+ elog "VBoxClient in desktop sessions." |
288 |
+ elog "" |
289 |
+ elog "You can mount shared folders with:" |
290 |
+ elog " mount -t vboxsf <shared_folder_name> <mount_point>" |
291 |
+ elog "" |
292 |
+ elog "Warning:" |
293 |
+ elog "this ebuild is only needed if you are running gentoo" |
294 |
+ elog "inside a VirtualBox Virtual Machine, you don't need" |
295 |
+ elog "it to run VirtualBox itself." |
296 |
+ elog "" |
297 |
+} |