1
0

portfile.cmake 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. vcpkg_from_github(
  2. OUT_SOURCE_PATH SOURCE_PATH
  3. REPO xiph/flac
  4. REF b32e5cbf9818ca23dd22aaa75522042c16ea7d17 #1.4.2
  5. SHA512 911891203f3064b39058e209b62fc3fac8940ed01cc3c3d75c9e3e6f94b5cc5905efde94304a6aafa453adde2da2f9bafea9fb5297e6231562133a8acac2ea47 HEAD_REF master
  6. PATCHES
  7. uwp-library-console.patch
  8. uwp-createfile2.patch
  9. fix-compile-options.patch
  10. )
  11. if(VCPKG_TARGET_IS_MINGW)
  12. set(WITH_STACK_PROTECTOR OFF)
  13. string(APPEND VCPKG_C_FLAGS " -D_FORTIFY_SOURCE=0")
  14. string(APPEND VCPKG_CXX_FLAGS " -D_FORTIFY_SOURCE=0")
  15. else()
  16. set(WITH_STACK_PROTECTOR ON)
  17. endif()
  18. if("asm" IN_LIST FEATURES)
  19. VCPKG_FIND_ACQUIRE_PROGRAM(NASM)
  20. GET_FILENAME_COMPONENT(NASM_PATH "${NASM}" DIRECTORY)
  21. vcpkg_add_to_path("${NASM_PATH}")
  22. endif()
  23. vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
  24. FEATURES
  25. asm WITH_ASM
  26. )
  27. vcpkg_cmake_configure(
  28. SOURCE_PATH "${SOURCE_PATH}"
  29. OPTIONS
  30. ${FEATURE_OPTIONS}
  31. -DBUILD_PROGRAMS=OFF
  32. -DBUILD_EXAMPLES=OFF
  33. -DBUILD_DOCS=OFF
  34. -DBUILD_TESTING=OFF
  35. -DWITH_STACK_PROTECTOR=${WITH_STACK_PROTECTOR}
  36. -DINSTALL_MANPAGES=OFF
  37. )
  38. vcpkg_cmake_install()
  39. vcpkg_cmake_config_fixup(PACKAGE_NAME FLAC CONFIG_PATH lib/cmake/FLAC)
  40. vcpkg_copy_pdbs()
  41. file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
  42. file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
  43. file(REMOVE "${CURRENT_PACKAGES_DIR}/share/LICENSE")
  44. if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
  45. vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/FLAC/export.h"
  46. "#if defined(FLAC__NO_DLL)"
  47. "#if 0"
  48. )
  49. vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/FLAC++/export.h"
  50. "#if defined(FLAC__NO_DLL)"
  51. "#if 0"
  52. )
  53. else()
  54. vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/FLAC/export.h"
  55. "#if defined(FLAC__NO_DLL)"
  56. "#if 1"
  57. )
  58. vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/FLAC++/export.h"
  59. "#if defined(FLAC__NO_DLL)"
  60. "#if 1"
  61. )
  62. endif()
  63. if(VCPKG_TARGET_IS_WINDOWS)
  64. vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/flac.pc" " -lm" "")
  65. if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/flac.pc")
  66. vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/flac.pc" " -lm" "")
  67. endif()
  68. endif()
  69. vcpkg_fixup_pkgconfig()
  70. # This license (BSD) is relevant only for library - if someone would want to install
  71. # FLAC cmd line tools as well additional license (GPL) should be included
  72. file(INSTALL "${SOURCE_PATH}/COPYING.Xiph" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)