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