| 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2012 James Almer |
| 4 | # Copyright (c) 2013 Tiancheng "Timothy" Gu |
| 5 | # |
| 6 | # This file is part of FFmpeg. |
| 7 | # |
| 8 | # FFmpeg is free software; you can redistribute it and/or |
| 9 | # modify it under the terms of the GNU Lesser General Public |
| 10 | # License as published by the Free Software Foundation; either |
| 11 | # version 2.1 of the License, or (at your option) any later version. |
| 12 | # |
| 13 | # FFmpeg is distributed in the hope that it will be useful, |
| 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 16 | # See the GNU Lesser General Public License for more details. |
| 17 | # |
| 18 | # You should have received a copy of the GNU Lesser General Public License |
| 19 | # along with FFmpeg; if not, write to the Free Software Foundation, Inc., |
| 20 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 | |
| 22 | ## Help |
| 23 | die() { |
| 24 | cat <<EOF >&2 |
| 25 | This script is used to generate Windows resources file for the FFmpeg libraries. |
| 26 | The output .rc file is to be compiled by windres(1). It is mainly useful for |
| 27 | FFmpeg developers to tweak and regenerate all resources files at once. |
| 28 | |
| 29 | Usage: $0 <libname> <comment> |
| 30 | |
| 31 | The script will output the file to '<libname>/<libname-without-lib>res.rc'. |
| 32 | |
| 33 | Example: $0 libavcodec 'FFmpeg codecs library' |
| 34 | EOF |
| 35 | exit 1 |
| 36 | } |
| 37 | |
| 38 | # Script to generate all: |
| 39 | # (to remove prefix '# ' and add 'tools/' as prefix: sed -r 's/^.{2}/tools\//') |
| 40 | # gen-rc libavutil "FFmpeg utility library" |
| 41 | # gen-rc libavcodec "FFmpeg codec library" |
| 42 | # gen-rc libavformat "FFmpeg container format library" |
| 43 | # gen-rc libavdevice "FFmpeg device handling library" |
| 44 | # gen-rc libavfilter "FFmpeg audio/video filtering library" |
| 45 | # gen-rc libpostproc "FFmpeg postprocessing library" |
| 46 | # gen-rc libavresample "Libav audio resampling library" |
| 47 | # gen-rc libswscale "FFmpeg image rescaling library" |
| 48 | # gen-rc libswresample "FFmpeg audio resampling library" |
| 49 | |
| 50 | ## Sanity checks and argument parsing |
| 51 | if test $# -lt 2 || test $# -gt 3; then |
| 52 | die |
| 53 | fi |
| 54 | |
| 55 | name=$1 |
| 56 | shortname=${name#lib} |
| 57 | comment=$2 |
| 58 | capname=`echo $name | awk '{print toupper($0)}'` |
| 59 | version=${capname}_VERSION |
| 60 | |
| 61 | mkdir -p "$name" |
| 62 | output="$name/${shortname}res.rc" |
| 63 | |
| 64 | ## REAL magic |
| 65 | cat <<EOF > $output |
| 66 | /* |
| 67 | * Windows resource file for $name |
| 68 | * |
| 69 | * Copyright (C) 2012 James Almer |
| 70 | * Copyright (C) 2013 Tiancheng "Timothy" Gu |
| 71 | * |
| 72 | * This file is part of FFmpeg. |
| 73 | * |
| 74 | * FFmpeg is free software; you can redistribute it and/or |
| 75 | * modify it under the terms of the GNU Lesser General Public |
| 76 | * License as published by the Free Software Foundation; either |
| 77 | * version 2.1 of the License, or (at your option) any later version. |
| 78 | * |
| 79 | * FFmpeg is distributed in the hope that it will be useful, |
| 80 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 81 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 82 | * Lesser General Public License for more details. |
| 83 | * |
| 84 | * You should have received a copy of the GNU Lesser General Public |
| 85 | * License along with FFmpeg; if not, write to the Free Software |
| 86 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 87 | */ |
| 88 | |
| 89 | #include <windows.h> |
| 90 | #include "$name/version.h" |
| 91 | #include "libavutil/ffversion.h" |
| 92 | #include "config.h" |
| 93 | |
| 94 | 1 VERSIONINFO |
| 95 | FILEVERSION ${version}_MAJOR, ${version}_MINOR, ${version}_MICRO, 0 |
| 96 | PRODUCTVERSION ${version}_MAJOR, ${version}_MINOR, ${version}_MICRO, 0 |
| 97 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK |
| 98 | FILEOS VOS_NT_WINDOWS32 |
| 99 | FILETYPE VFT_DLL |
| 100 | { |
| 101 | BLOCK "StringFileInfo" |
| 102 | { |
| 103 | BLOCK "040904B0" |
| 104 | { |
| 105 | VALUE "CompanyName", "FFmpeg Project" |
| 106 | VALUE "FileDescription", "$comment" |
| 107 | VALUE "FileVersion", AV_STRINGIFY($version) |
| 108 | VALUE "InternalName", "$name" |
| 109 | VALUE "LegalCopyright", "Copyright (C) 2000-" AV_STRINGIFY(CONFIG_THIS_YEAR) " FFmpeg Project" |
| 110 | VALUE "OriginalFilename", "$shortname" BUILDSUF "-" AV_STRINGIFY(${version}_MAJOR) SLIBSUF |
| 111 | VALUE "ProductName", "FFmpeg" |
| 112 | VALUE "ProductVersion", FFMPEG_VERSION |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | BLOCK "VarFileInfo" |
| 117 | { |
| 118 | VALUE "Translation", 0x0409, 0x04B0 |
| 119 | } |
| 120 | } |
| 121 | EOF |