From 1e41c4377f38512d1d6c0d65a2e7b9c7c8b03bea Mon Sep 17 00:00:00 2001 From: Seo Sanghyeon Date: Wed, 2 May 2018 17:37:15 +0900 Subject: [PATCH] Add yajl port (#3379) * Add yajl port * [yajl] Patch cmake to fix install directories and avoid overwriting compiler flags --- ports/yajl/CONTROL | 3 +++ ports/yajl/cmake.patch | 36 ++++++++++++++++++++++++++++++++++++ ports/yajl/portfile.cmake | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 ports/yajl/CONTROL create mode 100644 ports/yajl/cmake.patch create mode 100644 ports/yajl/portfile.cmake diff --git a/ports/yajl/CONTROL b/ports/yajl/CONTROL new file mode 100644 index 0000000000..6811dc84af --- /dev/null +++ b/ports/yajl/CONTROL @@ -0,0 +1,3 @@ +Source: yajl +Version: 2.1.0-1 +Description: Yet Another JSON Library diff --git a/ports/yajl/cmake.patch b/ports/yajl/cmake.patch new file mode 100644 index 0000000000..c631ead213 --- /dev/null +++ b/ports/yajl/cmake.patch @@ -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}) diff --git a/ports/yajl/portfile.cmake b/ports/yajl/portfile.cmake new file mode 100644 index 0000000000..92742e0a77 --- /dev/null +++ b/ports/yajl/portfile.cmake @@ -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()