[duktape] Add port for duktape 2.0.3

This commit is contained in:
Ted John 2017-07-14 19:37:25 +01:00
parent 6950aeb637
commit 94e262d3f6
5 changed files with 102 additions and 0 deletions

View File

@ -0,0 +1,23 @@
# CMAKE project for duktape
option(SOURCE_PATH "Root directory.")
option(ENABLE_STATIC "Build a static library.")
set (PROJECT duktape)
project (${PROJECT})
file(GLOB_RECURSE DUKTAPE_SOURCES "${SOURCE_PATH}/src/*.c")
file(GLOB_RECURSE DUKTAPE_HEADERS "${SOURCE_PATH}/src/*.h")
if (ENABLE_STATIC)
add_library(${PROJECT} STATIC ${DUKTAPE_SOURCES} ${DUKTAPE_HEADERS})
else ()
add_definitions(-DDUK_F_DLL_BUILD)
add_library(${PROJECT} SHARED ${DUKTAPE_SOURCES})
endif ()
set_target_properties(${PROJECT} PROPERTIES PUBLIC_HEADER "${DUKTAPE_HEADERS}")
install(TARGETS ${PROJECT}
ARCHIVE DESTINATION "lib"
RUNTIME DESTINATION "bin"
PUBLIC_HEADER DESTINATION "include")

4
ports/duktape/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: duktape
Version: 2.0.3-1
Description: Embeddable Javascript engine with a focus on portability and compact footprint.
Build-Depends:

25
ports/duktape/LICENSE Normal file
View File

@ -0,0 +1,25 @@
===============
Duktape license
===============
(http://opensource.org/licenses/MIT)
Copyright (c) 2013-2017 by Duktape authors (see AUTHORS.rst)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -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__)

View File

@ -0,0 +1,37 @@
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})
# 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)
vcpkg_configure_cmake(
SOURCE_PATH ${CMAKE_PATH}
OPTIONS -DENABLE_STATIC=OFF -DSOURCE_PATH=${SOURCE_PATH}
)
else()
vcpkg_configure_cmake(
SOURCE_PATH ${CMAKE_PATH}
OPTIONS -DENABLE_STATIC=ON -DSOURCE_PATH=${SOURCE_PATH}
)
endif()
vcpkg_install_cmake()
# Remove debug include
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
# Copy copright information
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/duktape RENAME copyright)
vcpkg_copy_pdbs()