aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-07-18 17:20:43 -0700
committerGitHub <noreply@github.com>2017-07-18 17:20:43 -0700
commite876a561aaa090e63973e3f140b879bc3f4e5f8c (patch)
treefe0c93cfa9bda5388fb85b174ddc7f6609ab44aa
parent344b395eedd22179c9cd3b0cad153342e2f4f9fe (diff)
parent40d2e35ca6fdf443a1b2b4d7aedf0a93cba47041 (diff)
downloadvcpkg-e876a561aaa090e63973e3f140b879bc3f4e5f8c.tar.gz
vcpkg-e876a561aaa090e63973e3f140b879bc3f4e5f8c.zip
Merge pull request #1460 from IntelOrca/ports/add-duktape
[duktape] Add port for duktape 2.0.3
-rw-r--r--ports/duktape/CMakeLists.txt20
-rw-r--r--ports/duktape/CONTROL4
-rw-r--r--ports/duktape/duk_config.h.patch13
-rw-r--r--ports/duktape/portfile.cmake38
4 files changed, 75 insertions, 0 deletions
diff --git a/ports/duktape/CMakeLists.txt b/ports/duktape/CMakeLists.txt
new file mode 100644
index 000000000..f62a9c56e
--- /dev/null
+++ b/ports/duktape/CMakeLists.txt
@@ -0,0 +1,20 @@
+# CMAKE project for duktape
+option(SOURCE_PATH "Root directory.")
+
+project (duktape)
+
+file(GLOB_RECURSE DUKTAPE_SOURCES "${SOURCE_PATH}/src/*.c")
+file(GLOB_RECURSE DUKTAPE_HEADERS "${SOURCE_PATH}/src/*.h")
+
+if (BUILD_SHARED_LIBS)
+ add_definitions(-DDUK_F_DLL_BUILD)
+endif ()
+
+add_library(duktape ${DUKTAPE_SOURCES} ${DUKTAPE_HEADERS})
+
+set_target_properties("duktape" PROPERTIES PUBLIC_HEADER "${DUKTAPE_HEADERS}")
+
+install(TARGETS duktape
+ ARCHIVE DESTINATION "lib"
+ RUNTIME DESTINATION "bin"
+ PUBLIC_HEADER DESTINATION "include")
diff --git a/ports/duktape/CONTROL b/ports/duktape/CONTROL
new file mode 100644
index 000000000..74b01d4cf
--- /dev/null
+++ b/ports/duktape/CONTROL
@@ -0,0 +1,4 @@
+Source: duktape
+Version: 2.0.3-3
+Description: Embeddable Javascript engine with a focus on portability and compact footprint.
+Build-Depends:
diff --git a/ports/duktape/duk_config.h.patch b/ports/duktape/duk_config.h.patch
new file mode 100644
index 000000000..d0be961ce
--- /dev/null
+++ b/ports/duktape/duk_config.h.patch
@@ -0,0 +1,13 @@
+diff --git a/src/duk_config.h b/src/duk_config.h
+index a942563..8d3d309 100644
+--- a/src/duk_config.h
++++ b/src/duk_config.h
+@@ -64,7 +64,7 @@
+
+ /* DLL build detection */
+ /* not configured for DLL build */
+-#undef DUK_F_DLL_BUILD
++// #undef DUK_F_DLL_BUILD
+
+ /* Apple OSX, iOS */
+ #if defined(__APPLE__)
diff --git a/ports/duktape/portfile.cmake b/ports/duktape/portfile.cmake
new file mode 100644
index 000000000..e3e84c0de
--- /dev/null
+++ b/ports/duktape/portfile.cmake
@@ -0,0 +1,38 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/duktape-2.0.3)
+set(CMAKE_PATH ${CMAKE_CURRENT_LIST_DIR})
+vcpkg_download_distfile(ARCHIVE_FILE
+ URLS "https://github.com/svaarala/duktape/releases/download/v2.0.3/duktape-2.0.3.tar.xz"
+ FILENAME "duktape-2.0.3.tar.xz"
+ SHA512 ba21731242d953d82c677e1205e3596e270e6d57156a0bca8068fc3b6a35996af69bcfac979b871a7e3eab31f28a06cb99078f0b3eaac54be9c5899f57f4100e
+)
+vcpkg_extract_source_archive(${ARCHIVE_FILE})
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES "${CMAKE_CURRENT_LIST_DIR}/duk_config.h.patch"
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${CMAKE_PATH}
+ OPTIONS -DSOURCE_PATH=${SOURCE_PATH}
+)
+
+vcpkg_install_cmake()
+
+set(DUK_CONFIG_H_PATH "${CURRENT_PACKAGES_DIR}/include/duk_config.h")
+file(READ ${DUK_CONFIG_H_PATH} CONTENT)
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ string(REPLACE "// #undef DUK_F_DLL_BUILD" "#undef DUK_F_DLL_BUILD\n#define DUK_F_DLL_BUILD 1" CONTENT "${CONTENT}")
+else()
+ string(REPLACE "// #undef DUK_F_DLL_BUILD" "#undef DUK_F_DLL_BUILD\n#define DUK_F_DLL_BUILD 0" CONTENT "${CONTENT}")
+endif()
+file(WRITE ${DUK_CONFIG_H_PATH} "${CONTENT}")
+
+# Remove debug include
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Copy copright information
+file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/duktape" RENAME "copyright")
+
+vcpkg_copy_pdbs()