From 093900b22528b6abdd97b59ce1ccb50a46c74844 Mon Sep 17 00:00:00 2001 From: atkawa7 Date: Wed, 22 Aug 2018 00:57:50 +0200 Subject: [PATCH] [new port] libmaxminddb init (#4132) * maxminddb init * [libmaxminddb] CMake cleanup. Build static lib instead of exporting all symbols on Windows. --- ports/libmaxminddb/CMakeLists.txt | 34 +++++++++++++++++++++++++++++++ ports/libmaxminddb/CONTROL | 3 +++ ports/libmaxminddb/portfile.cmake | 26 +++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 ports/libmaxminddb/CMakeLists.txt create mode 100644 ports/libmaxminddb/CONTROL create mode 100644 ports/libmaxminddb/portfile.cmake diff --git a/ports/libmaxminddb/CMakeLists.txt b/ports/libmaxminddb/CMakeLists.txt new file mode 100644 index 0000000000..c46c6319be --- /dev/null +++ b/ports/libmaxminddb/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required (VERSION 3.9) +project(maxminddb C) + +set(CMAKE_DEBUG_POSTFIX d) +set(CMAKE_SHARED_LIBRARY_PREFIX lib) +set(CMAKE_STATIC_LIBRARY_PREFIX lib) + +if(MSVC) + add_compile_options(-D_CRT_SECURE_NO_WARNINGS) +endif() + +set(SRCS + src/maxminddb.c + src/data-pool.c +) + +include_directories(. src include projects/VS12) + +add_library(maxminddb ${SRCS}) + +if(WIN32) + target_link_libraries(maxminddb ws2_32) +endif() + +install( + TARGETS maxminddb + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +if(NOT DISABLE_INSTALL_HEADERS) + install(FILES include/maxminddb.h projects/VS12/maxminddb_config.h DESTINATION include/maxminddb) +endif() diff --git a/ports/libmaxminddb/CONTROL b/ports/libmaxminddb/CONTROL new file mode 100644 index 0000000000..a075cdb552 --- /dev/null +++ b/ports/libmaxminddb/CONTROL @@ -0,0 +1,3 @@ +Source: libmaxminddb +Version: 1.3.2-1 +Description: C library for the MaxMind DB file format \ No newline at end of file diff --git a/ports/libmaxminddb/portfile.cmake b/ports/libmaxminddb/portfile.cmake new file mode 100644 index 0000000000..f2b17342f9 --- /dev/null +++ b/ports/libmaxminddb/portfile.cmake @@ -0,0 +1,26 @@ +include(vcpkg_common_functions) + +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO maxmind/libmaxminddb + REF 1.3.2 + SHA512 43ff5f4e3a413772cd315412afc1070fb80280405d8845dc9d94a795265a71007c6c182dc01da8e14bf7b8ab8defe05714bec543faa956e7fb0f0a7756e7df48 + HEAD_REF master +) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS_DEBUG + -DDISABLE_INSTALL_HEADERS=ON +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libmaxminddb RENAME copyright)