gen-rc 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 libpostproc "FFmpeg postprocessing library"
  41. # gen-rc libswscale "FFmpeg image rescaling library"
  42. # gen-rc libswresample "FFmpeg audio resampling library"
  43. ## Sanity checks and argument parsing
  44. if test $# -lt 2 || test $# -gt 3; then
  45. die
  46. fi
  47. name=$1
  48. shortname=${name#lib}
  49. comment=$2
  50. capname=`echo $name | awk '{print toupper($0)}'`
  51. version=${capname}_VERSION
  52. mkdir -p "$name"
  53. output="$name/${shortname}res.rc"
  54. ## REAL magic
  55. cat <<EOF > $output
  56. /*
  57. * Windows resource file for $name
  58. *
  59. * Copyright (C) 2012 James Almer
  60. * Copyright (C) 2013 Tiancheng "Timothy" Gu
  61. *
  62. * This file is part of FFmpeg.
  63. *
  64. * FFmpeg is free software; you can redistribute it and/or
  65. * modify it under the terms of the GNU Lesser General Public
  66. * License as published by the Free Software Foundation; either
  67. * version 2.1 of the License, or (at your option) any later version.
  68. *
  69. * FFmpeg is distributed in the hope that it will be useful,
  70. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  71. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  72. * Lesser General Public License for more details.
  73. *
  74. * You should have received a copy of the GNU Lesser General Public
  75. * License along with FFmpeg; if not, write to the Free Software
  76. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  77. */
  78. #include <windows.h>
  79. #include "$name/version.h"
  80. #include "libavutil/ffversion.h"
  81. #include "config.h"
  82. 1 VERSIONINFO
  83. FILEVERSION ${version}_MAJOR, ${version}_MINOR, ${version}_MICRO, 0
  84. PRODUCTVERSION ${version}_MAJOR, ${version}_MINOR, ${version}_MICRO, 0
  85. FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
  86. FILEOS VOS_NT_WINDOWS32
  87. FILETYPE VFT_DLL
  88. {
  89. BLOCK "StringFileInfo"
  90. {
  91. BLOCK "040904B0"
  92. {
  93. VALUE "CompanyName", "FFmpeg Project"
  94. VALUE "FileDescription", "$comment"
  95. VALUE "FileVersion", AV_STRINGIFY($version)
  96. VALUE "InternalName", "$name"
  97. VALUE "LegalCopyright", "Copyright (C) 2000-" AV_STRINGIFY(CONFIG_THIS_YEAR) " FFmpeg Project"
  98. VALUE "OriginalFilename", "$shortname" BUILDSUF "-" AV_STRINGIFY(${version}_MAJOR) SLIBSUF
  99. VALUE "ProductName", "FFmpeg"
  100. VALUE "ProductVersion", FFMPEG_VERSION
  101. }
  102. }
  103. BLOCK "VarFileInfo"
  104. {
  105. VALUE "Translation", 0x0409, 0x04B0
  106. }
  107. }
  108. EOF