gen-vlc-r-in 3.55 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/bin/sh
#
# Generate package/vlc.r.in from the mime types listed in vlcshell.cpp

set -e

# Extract all mime type lines, minus the quicktime ones, which are
# unwanted on MacOS X.
lines() {
    awk '/static char mimetype/,/   ;/ {print}' vlcshell.cpp | \
	grep -v static | \
	grep -v '^    ;' | \
	grep -vi "quicktime"
}

16 17
macfile() {
    cat <<EOF
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
/*****************************************************************************
 * VLC Plugin description for OS X
 *****************************************************************************/

/* Definitions of system resource types */

data 'carb' (0)
{
};

/* The first string in the array is a plugin description,
 * the second is the plugin name */
resource 'STR#' (126)
{
    {
        "VLC media player Web Plugin @VERSION@"
        "<BR>@COPYRIGHT_MESSAGE@"
        "<BR><A HREF='http://www.videolan.org'>http://www.videolan.org</A>",
        "VLC Web Plugin"
    };
};

/* A description for each MIME type in resource 128 */
resource 'STR#' (127)
{
    {
EOF

46 47
    lines | sed 's/ *".*:.*:\(.*\);"/        "\1",/' | \
	sed 's%^ */%        /%'
48

49
    cat <<EOF
50 51 52 53 54 55 56 57
    };
};

/* A series of pairs of strings... first MIME type, then file extension(s) */
resource 'STR#' (128,"MIME Type")
{
    {
EOF
58 59 60
    lines | sed 's/ *"\(.*\):\(.*\):.*;"/        "\1", "\2",/' | \
	sed 's%^ */%        /%'
    cat <<EOF
61 62 63 64
    };
};

EOF
65 66 67 68 69 70 71 72 73 74 75 76 77
}

winfile() {
    mimetype="$(lines | awk '/ *".*:.*:.*;"/ {print}' | sed 's/ *"\(.*\):.*:.*;"/\1|/' | tr -d "\n" | sed 's/|$//')"
    fileextents="$(lines | awk '/ *".*:.*:.*;"/ {print}' | sed 's/ *".*:\(.*\):.*;"/\1|/' | tr -d "\n" | sed 's/|$//')"
    fileopenname="$(lines | awk '/ *".*:.*:.*;"/ {print}' | sed 's/ *".*:.*:\(.*\);"/\1|/' | tr -d "\n" | sed 's/|$//')"
    cat <<EOF
/////////////////////////////////////////////////////////////////////////////
//
//  VLC Plugin description.
//
#define VERSION_NUMBER @VERSION_MAJOR@,@VERSION_MINOR@,@VERSION_REVISION@,@VERSION_EXTRA_RC@

78 79
#include <winuser.h>

80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
//VS_VERSION_INFO VERSIONINFO
1 VERSIONINFO
 FILEVERSION VERSION_NUMBER
 PRODUCTVERSION VERSION_NUMBER
 FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x2L
 FILESUBTYPE 0x0L

BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904e4"
        BEGIN
            VALUE "CompanyName", "VideoLAN\0"
            VALUE "ProductName", "VLC Web Plugin\0"
            VALUE "ProductVersion", "@VERSION@"
            VALUE "InternalName", "npvlc\0"
            VALUE "OriginalFilename", "npvlc.dll\0"
            VALUE "FileVersion", "@VERSION@"
            VALUE "FileDescription", "VLC media player Web Plugin\0"
            VALUE "LegalCopyright", "Copyright \251 @COPYRIGHT_YEARS@ VideoLAN and VLC Authors\0"
            VALUE "LegalTrademarks", "VLC media player, VideoLAN and x264 are registered trademarks from VideoLAN\0"
            VALUE "MIMEType", "$mimetype"
            VALUE "FileExtents", "$fileextents"
            VALUE "FileOpenName", "$fileopenname"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1252
    END
END

119 120 121 122 123 124 125
3 BITMAP "../share/pixmaps/win32/defullscreen.bmp"
4 BITMAP "../share/pixmaps/win32/play.bmp"
5 BITMAP "../share/pixmaps/win32/pause.bmp"
6 BITMAP "../share/pixmaps/win32/volume.bmp"
7 BITMAP "../share/pixmaps/win32/volume-muted.bmp"
8 ICON   "../share/pixmaps/win32/vlc.ico"
9 BITMAP "../share/pixmaps/win32/fullscreen.bmp"
126 127

ISOLATIONAWARE_MANIFEST_RESOURCE_ID RT_MANIFEST "npvlc.dll.manifest"
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
EOF
}

case "$1" in
    win)
	winfile
	;;
    macosx)
	macfile
	;;
    *)
	echo "Incorrect usage." 1>&2
	exit 1
	;;
esac