gen-rc 3.9 KB

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