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