Add yajl port (#3379)

* Add yajl port

* [yajl] Patch cmake to fix install directories and avoid overwriting compiler flags
This commit is contained in:
Seo Sanghyeon 2018-05-02 17:37:15 +09:00 committed by Robert Schumacher
parent 6bff657152
commit 1e41c4377f
3 changed files with 73 additions and 0 deletions

3
ports/yajl/CONTROL Normal file
View File

@ -0,0 +1,3 @@
Source: yajl
Version: 2.1.0-1
Description: Yet Another JSON Library

36
ports/yajl/cmake.patch Normal file
View File

@ -0,0 +1,36 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4c0a9be..cbec22f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,7 +28,7 @@ ENDIF (NOT CMAKE_BUILD_TYPE)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
-IF (WIN32)
+IF (WIN32 AND FALSE)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
ADD_DEFINITIONS(-DWIN32)
SET(linkFlags "/PDB:NONE /INCREMENTAL:NO /OPT:NOREF /OPT:NOICF")
@@ -46,7 +46,8 @@ IF (WIN32)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /wd4255 /wd4130 /wd4100 /wd4711")
SET(CMAKE_C_FLAGS_DEBUG "/D DEBUG /Od /Z7")
SET(CMAKE_C_FLAGS_RELEASE "/D NDEBUG /O2")
-ELSE (WIN32)
+endif()
+if (NOT WIN32)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
IF(CMAKE_COMPILER_IS_GNUCC)
INCLUDE(CheckCCompilerFlag)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 99cf9e9..454482a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -78,7 +78,7 @@ INCLUDE_DIRECTORIES(${incDir}/..)
# at build time you may specify the cmake variable LIB_SUFFIX to handle
# 64-bit systems which use 'lib64'
INSTALL(TARGETS yajl
- RUNTIME DESTINATION lib${LIB_SUFFIX}
+ RUNTIME DESTINATION bin
LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX})
INSTALL(TARGETS yajl_s ARCHIVE DESTINATION lib${LIB_SUFFIX})

34
ports/yajl/portfile.cmake Normal file
View File

@ -0,0 +1,34 @@
include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO lloyd/yajl
REF 2.1.0
SHA512 9e786d080803df80ec03a9c2f447501e6e8e433a6baf636824bc1d50ecf4f5f80d7dfb1d47958aeb0a30fe459bd0ef033d41bc6a79e1dc6e6b5eade930b19b02
HEAD_REF master
PATCHES ${CMAKE_CURRENT_LIST_DIR}/cmake.patch
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
)
vcpkg_install_cmake()
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/yajl RENAME copyright)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share ${CURRENT_PACKAGES_DIR}/share/pkgconfig)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
file(GLOB SHAREDOBJECTS ${CURRENT_PACKAGES_DIR}/lib/libyajl.so* ${CURRENT_PACKAGES_DIR}/debug/lib/libyajl.so*)
file(REMOVE_RECURSE ${SHAREDOBJECTS} ${CURRENT_PACKAGES_DIR}/lib/yajl.lib ${CURRENT_PACKAGES_DIR}/debug/lib/yajl.lib)
else()
file(GLOB EXES ${CURRENT_PACKAGES_DIR}/bin/*.exe ${CURRENT_PACKAGES_DIR}/debug/bin/*.exe)
file(REMOVE_RECURSE
${EXES}
${CURRENT_PACKAGES_DIR}/lib/yajl_s.lib ${CURRENT_PACKAGES_DIR}/debug/lib/yajl_s.lib
${CURRENT_PACKAGES_DIR}/lib/libyajl_s.a ${CURRENT_PACKAGES_DIR}/debug/lib/libyajl_s.a
)
endif()