gen-rc 4.0 KB

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