aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed John <ted@brambles.org>2017-07-14 23:45:04 +0100
committerTed John <ted@brambles.org>2017-07-14 23:45:57 +0100
commit73ed70bb33875d00606998c515a82c519ea3c6cc (patch)
treeef1cbeb337ec0754af184bb4ee1a1431467fa7f4
parent8c9744fa14c9b8ed643f906aeb31e3b231577133 (diff)
downloadvcpkg-73ed70bb33875d00606998c515a82c519ea3c6cc.tar.gz
vcpkg-73ed70bb33875d00606998c515a82c519ea3c6cc.zip
[duktape] Revert duk_config.h to its original state
-rw-r--r--ports/duktape/portfile.cmake19
1 files changed, 14 insertions, 5 deletions
diff --git a/ports/duktape/portfile.cmake b/ports/duktape/portfile.cmake
index 84278616c..14934a31a 100644
--- a/ports/duktape/portfile.cmake
+++ b/ports/duktape/portfile.cmake
@@ -8,11 +8,13 @@ vcpkg_download_distfile(ARCHIVE_FILE
)
vcpkg_extract_source_archive(${ARCHIVE_FILE})
-# Patch duk_config.h to remove 'undef DUK_F_DLL_BUILD'
-vcpkg_apply_patches(
- SOURCE_PATH ${SOURCE_PATH}
- PATCHES "${CMAKE_CURRENT_LIST_DIR}/duk_config.h.patch"
-)
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ # Patch duk_config.h to remove 'undef DUK_F_DLL_BUILD'
+ vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES "${CMAKE_CURRENT_LIST_DIR}/duk_config.h.patch"
+ )
+endif()
vcpkg_configure_cmake(
SOURCE_PATH ${CMAKE_PATH}
@@ -21,6 +23,13 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
+# Revert duk_config.h to its original state
+# This is always done in case the file has already been previously patched
+set(DUK_CONFIG_H_PATH "${CURRENT_PACKAGES_DIR}/include/duk_config.h")
+file(READ ${DUK_CONFIG_H_PATH} CONTENT)
+string(REPLACE "// #undef DUK_F_DLL_BUILD" "#undef DUK_F_DLL_BUILD" CONTENT "${CONTENT}")
+file(WRITE ${DUK_CONFIG_H_PATH} "${CONTENT}")
+
# Remove debug include
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)