]> git.pld-linux.org Git - packages/VirtualBox.git/blob - VirtualBox-export_modules.patch
- Updated to 2.1.2. Compiles and works on i686 but spec probably needs some
[packages/VirtualBox.git] / VirtualBox-export_modules.patch
1 --- /dev/null   2009-01-22 12:52:06.498125436 +0100
2 +++ VirtualBox-2.1.0/src/VBox/HostDrivers/Support/linux/export_modules  2008-09-01 14:23:30.000000000 +0200
3 @@ -0,0 +1,93 @@
4 +#!/bin/sh
5 +
6 +#
7 +# Create a tar archive containing the sources of the vboxdrv kernel module
8 +#
9 +# Copyright (C) 2007 Sun Microsystems, Inc.
10 +#
11 +# This file is part of VirtualBox Open Source Edition (OSE), as
12 +# available from http://www.virtualbox.org. This file is free software;
13 +# you can redistribute it and/or modify it under the terms of the GNU
14 +# General Public License (GPL) as published by the Free Software
15 +# Foundation, in version 2 as it comes in the "COPYING" file of the
16 +# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 +# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 +#
19 +# The contents of this file may alternatively be used under the terms
20 +# of the Common Development and Distribution License Version 1.0
21 +# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
22 +# VirtualBox OSE distribution, in which case the provisions of the
23 +# CDDL are applicable instead of those of the GPL.
24 +#
25 +# You may elect to license modified versions of this file under the
26 +# terms and conditions of either the GPL or the CDDL or both.
27 +#
28 +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
29 +# Clara, CA 95054 USA or visit http://www.sun.com if you need
30 +# additional information or have any questions.
31 +#
32 +
33 +if [ -z "$1" ]; then
34 +    echo "Usage: $0 <filename.tar.gz> [--without-hardening]"
35 +    echo "  Export VirtualBox kernel modules to <filename.tar.gz>"
36 +    exit 1
37 +fi
38 +
39 +VBOX_WITH_HARDENING=1
40 +if [ "$2" = "--without-hardening" ]; then
41 +    VBOX_WITH_HARDENING=
42 +fi
43 +
44 +PATH_TMP="`cd \`dirname $1\`; pwd`/.vbox_modules"
45 +PATH_OUT=$PATH_TMP
46 +FILE_OUT="`cd \`dirname $1\`; pwd`/`basename $1`"
47 +PATH_ROOT="`cd \`dirname $0\`/../../../../..; pwd`"
48 +PATH_VBOXDRV="$PATH_ROOT/src/VBox/HostDrivers/Support"
49 +
50 +VBOX_VERSION_MAJOR=`sed -e "s/^ *VBOX_VERSION_MAJOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
51 +VBOX_VERSION_MINOR=`sed -e "s/^ *VBOX_VERSION_MINOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
52 +VBOX_VERSION_BUILD=`sed -e "s/^ *VBOX_VERSION_BUILD *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
53 +VBOX_VERSION_STRING=$VBOX_VERSION_MAJOR.$VBOX_VERSION_MINOR.$VBOX_VERSION_BUILD
54 +
55 +. $PATH_VBOXDRV/linux/files_vboxdrv
56 +
57 +# Temporary path for creating the modules, will be removed later
58 +mkdir $PATH_TMP || exit 1
59 +
60 +# Create auto-generated version file, needed by all modules
61 +echo "#ifndef __version_generated_h__" > $PATH_TMP/version-generated.h
62 +echo "#define __version_generated_h__" >> $PATH_TMP/version-generated.h
63 +echo "" >> $PATH_TMP/version-generated.h
64 +echo "#define VBOX_VERSION_MAJOR $VBOX_VERSION_MAJOR" >> $PATH_TMP/version-generated.h
65 +echo "#define VBOX_VERSION_MINOR $VBOX_VERSION_MINOR" >> $PATH_TMP/version-generated.h
66 +echo "#define VBOX_VERSION_BUILD $VBOX_VERSION_BUILD" >> $PATH_TMP/version-generated.h
67 +echo "#define VBOX_VERSION_STRING \"$VBOX_VERSION_STRING\"" >> $PATH_TMP/version-generated.h
68 +echo "" >> $PATH_TMP/version-generated.h
69 +echo "#endif" >> $PATH_TMP/version-generated.h
70 +
71 +# vboxdrv (VirtualBox host kernel module)
72 +mkdir $PATH_TMP/vboxdrv || exit 1
73 +for f in $FILES_VBOXDRV_NOBIN; do
74 +    install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxdrv/`echo $f|cut -d'>' -f2`"
75 +done
76 +for f in $FILES_VBOXDRV_BIN; do
77 +    install -D -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxdrv/`echo $f|cut -d'>' -f2`"
78 +done
79 +sed -e "s;_VERSION_;$VBOX_VERSION_STRING;g" < $PATH_VBOXDRV/linux/build_in_tmp > $PATH_TMP/vboxdrv/build_in_tmp
80 +chmod 0755 $PATH_TMP/vboxdrv/build_in_tmp
81 +sed -e "s;_VERSION_;$VBOX_VERSION_STRING;g" < $PATH_VBOXDRV/linux/dkms.conf > $PATH_TMP/vboxdrv/dkms.conf
82 +if [ -n "$VBOX_WITH_HARDENING" ]; then
83 +    cat                                   $PATH_VBOXDRV/linux/Makefile > $PATH_TMP/vboxdrv/Makefile
84 +else
85 +    sed -e "s;-DVBOX_WITH_HARDENING;;g" < $PATH_VBOXDRV/linux/Makefile > $PATH_TMP/vboxdrv/Makefile
86 +fi
87 +
88 +# Only temporary, omit from archive
89 +rm $PATH_TMP/version-generated.h
90 +
91 +# Create the archive
92 +tar -czf $FILE_OUT -C $PATH_TMP . || exit 1
93 +
94 +# Remove the temporary directory
95 +rm -r $PATH_TMP
96 +
This page took 0.037647 seconds and 4 git commands to generate.