Was supposed to be a linux distribution, now just a collection of build scripts for packages on top of (ideally) any distribution.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

145 lines
4.9 KiB

# NOTE: This package uses a prebuilt BIOS image, that can only be properly built with OpenWatcom.
import 'vcs/svn'
import 'misc/debian'
name=VirtualBox
deb_name=virtualbox
8 years ago
version=5.1.24
define_option 'pulseaudio: Add pulseaudio support'
define_option 'pam: Use PAM for authentication'
define_option 'docs: Build documentation (requires texlive)'
8 years ago
misc_debian_download -r contrib -n "$deb_name" -O dfsg-2 \
'4784ea878d4e1b8f5bc9ce47c42c2831'
dlfile "http://download.virtualbox.org/virtualbox/$orig_version/$name-$orig_version.tar.bz2" \
8 years ago
'2938f2b75f99f35205e033753c3087f3'
_
# Unpack and sanitize the source tarball
extract "${deb_name}_$version.debian.tar.xz"
( cd debian
# We don't need to repack the sources.
sed -i -e '/^tar.*-cJf/,+2d' get-orig-source.sh
./get-orig-source.sh --upstream-version "$orig_version"
)
mv debian "$name-$orig_version"
cd "$name-$orig_version"
# Exclude some patches
misc_debian_patch_exclude 01-build-arch.patch # Debian-exclusive patch that uses dpkg-architecture.
misc_debian_patch_exclude 04-vboxdrv-references.patch # Debian-specific error messages.
misc_debian_patch_exclude 12-make-module.patch # Debian uses amd64 instead of x86_64.
misc_debian_patch_exclude 13-modules-mismatch.patch # Debian-specific error messages.
# Replace /usr/include with whatever we're using
sed -i -e "/^+\t\/usr\/include/s/usr\/include/$(safe_sed "$dir_prefix/$dir_include")/" debian/patches/18-system-xorg.patch
# Apply debian patches
misc_debian_patch
# Fix path to sysconfdir in some scripts
sed -i -e "s/\/etc\/vbox\//$(safe_sed "/$dir_prefix/$dir_sysconf/vbox/")/g" \
src/VBox/Installer/linux/VBox.sh \
src/VBox/Installer/linux/vboxdrv.sh \
src/VBox/Installer/linux/*-service.sh \
src/VBox/HostDrivers/*/linux/Makefile
# Make vboxdrv.sh find the proper kernel sources
sed -i -e 's/\${INSTALL_DIR}\/src\/vboxhost/\${INSTALL_DIR}\/src/' \
-e '/^elif test -x \/usr\/lib\/virtualbox\/VirtualBox/,+2d' src/VBox/Installer/linux/vboxdrv.sh
# Make sure VBox.sh finds the proper INSTALL_DIR
sed -i -e '/^if test -f \/usr\/lib\/virtualbox\/VirtualBox/,+2d' \
-e 's/^elif test -f "${MY_DIR}/if test -f "${MY_DIR}/' src/VBox/Installer/linux/VBox.sh
# Qt5 requires -std=c++11
sed -i -e 's/^CXX_FLAGS="\(.*\)"/CXX_FLAGS="\1 -std=c++11"/' configure
# Copy debian's configuration, barring a few things
egrep -vf - debian/LocalConfig.kmk > LocalConfig.kmk << 'EOF'
^VBOX_JAVA_HOME
^VBOX_PATH_DOCBOOK_DTD
EOF
# Append our configuration
cat >> LocalConfig.kmk << EOF
VBOX_PATH_APP_PRIVATE_ARCH := /$dir_prefix/$dir_lib/$name
VBOX_PATH_SHARED_LIBS := \$(VBOX_PATH_APP_PRIVATE_ARCH)
VBOX_WITH_RUNPATH := \$(VBOX_PATH_APP_PRIVATE_ARCH)
VBOX_PATH_APP_PRIVATE := /$dir_prefix/$dir_data/$name
VBOX_PATH_APP_DOCS = /$dir_prefix/$dir_doc/$name
VBOX_GCC_OPT := $CXXFLAGS
VBOX_USE_SYSTEM_XORG_HEADERS := 1
VBOX_NO_LEGACY_XORG_X11 := 1
VBOX_WITH_REGISTRATION_REQUEST :=
VBOX_WITH_UPDATE_REQUEST :=
VBOX_WITH_EXTPACK_VBOXDTRACE :=
VBOX_WITHOUT_ADDITIONS := 1
$(option pam || echo VBOX_WITH_PAM :=)
EOF
./configure \
--ose \
--disable-kmods \
--with-makeself=/bin/true \
--disable-java \
$(option pulseaudio || echo --disable-pulse) \
$(option docs || echo --disable-docs)
source ./env.sh
kmk LOCALCFG=./LocalConfig.kmk
# Install VirtualBox
# manpages (by debian)
install -Dm644 -t "$dir_install/$dir_prefix/$dir_man/man1" \
debian/manpages/VirtualBox.1 \
debian/manpages/VBoxManage.1 \
debian/manpages/VBoxSDL.1 \
debian/manpages/VBoxHeadless.1 \
debian/manpages/VBoxBalloonCtrl.1 \
debian/manpages/vboxwebsrv.1
cd "out/$BUILD_PLATFORM.$BUILD_PLATFORM_ARCH/release/bin"
rm -f *.debug
# Apply suid to VirtualBox
chmod 4711 VirtualBox VBoxSDL VBoxHeadless
# binaries
mkdir -p "$dir_install/$dir_prefix/$dir_bin"
for i in VirtualBox VBoxManage VBoxSDL VBoxHeadless VBoxAutostart VBoxBalloonCtrl VBoxBugReport VBoxDTrace vboxwebsrv; do
ln -sf "/$dir_prefix/$dir_lib/$name/VBox.sh" "$dir_install/$dir_prefix/$dir_bin/$i"
done
# icons
mkdir -p "$dir_install/$dir_prefix/$dir_data/pixmaps"
mv VBox.png "$dir_install/$dir_prefix/$dir_data/pixmaps"
for i in icons/*; do
mkdir -p "$dir_install/$dir_prefix/$dir_data/icons/hicolor/$(basename $i)/mimetypes"
mv $i/* "$dir_install/$dir_prefix/$dir_data/icons/hicolor/$(basename $i)/mimetypes"
done
rm -rf icons
# desktop
mkdir -p "$dir_install/$dir_prefix/$dir_data/applications" "$dir_install/$dir_prefix/$dir_data/mime/packages"
mv virtualbox.desktop "$dir_install/$dir_prefix/$dir_data/applications"
mv virtualbox.xml "$dir_install/$dir_prefix/$dir_data/mime/packages"
# install configuration
mkdir -p "$dir_install/$dir_prefix/$dir_sysconf/vbox"
echo "INSTALL_DIR='/$dir_prefix/$dir_lib/$name'" > "$dir_install/$dir_prefix/$dir_sysconf/vbox/vbox.cfg"
# Move the directory
mkdir -p "$dir_install/$dir_prefix/$dir_lib"
cp -Ta . "$dir_install/$dir_prefix/$dir_lib/$name"
# vim:set tabstop=4 shiftwidth=4 syntax=sh expandtab: