Skip to content

Commit

Permalink
[libmicrohttpd] Support build on UNIX and use msbuild on Windows (#11983
Browse files Browse the repository at this point in the history
)

* [libmicrohttpd] Support build on UNIX and use msbuild on Windows

* update baseline
  • Loading branch information
JackBoosY committed Jun 23, 2020
1 parent 2c280ee commit 67a031a
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 95 deletions.
74 changes: 0 additions & 74 deletions ports/libmicrohttpd/CMakeLists.txt

This file was deleted.

3 changes: 2 additions & 1 deletion ports/libmicrohttpd/CONTROL
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Source: libmicrohttpd
Version: 0.9.63-2
Version: 0.9.63-3
Homepage: https://www.gnu.org/software/libmicrohttpd/
Description: GNU libmicrohttpd is a small C library that is supposed to make it easy to run an HTTP server as part of another application
Supports: !(arm|uwp)
12 changes: 12 additions & 0 deletions ports/libmicrohttpd/fix-msvc-project.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/w32/common/libmicrohttpd-files.vcxproj b/w32/common/libmicrohttpd-files.vcxproj
index 6f1e03b..c0ddea8 100644
--- a/w32/common/libmicrohttpd-files.vcxproj
+++ b/w32/common/libmicrohttpd-files.vcxproj
@@ -3,6 +3,7 @@
<ItemGroup>
<ClCompile Include="$(MhdSrc)microhttpd\base64.c" />
<ClCompile Include="$(MhdSrc)microhttpd\basicauth.c" />
+ <ClCompile Include="$(MhdSrc)microhttpd\sha256.c" />
<ClCompile Include="$(MhdSrc)microhttpd\connection.c" />
<ClCompile Include="$(MhdSrc)microhttpd\daemon.c" />
<ClCompile Include="$(MhdSrc)microhttpd\digestauth.c" />
56 changes: 41 additions & 15 deletions ports/libmicrohttpd/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set(MICROHTTPD_VERSION 0.9.63)
vcpkg_fail_port_install(ON_TARGET "UWP" ON_ARCH "arm")

vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
set(MICROHTTPD_VERSION 0.9.63)

vcpkg_download_distfile(ARCHIVE
URLS "https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-${MICROHTTPD_VERSION}.tar.gz" "https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-${MICROHTTPD_VERSION}.tar.gz"
Expand All @@ -11,18 +11,44 @@ vcpkg_download_distfile(ARCHIVE
vcpkg_extract_source_archive_ex(
ARCHIVE ${ARCHIVE}
OUT_SOURCE_PATH SOURCE_PATH
PATCHES fix-msvc-project.patch
)

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()

file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libmicrohttpd RENAME copyright)
if (VCPKG_TARGET_IS_WINDOWS)
if (TRIPLET_SYSTEM_ARCH MATCHES "x86")
set(MSBUILD_PLATFORM "Win32")
else ()
set(MSBUILD_PLATFORM "x64")
endif()

if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set(MICROHTTPD_CONFIGURATION_RELEASE "Release-dll")
set(MICROHTTPD_CONFIGURATION_DEBUG "Debug-dll")
else()
set(MICROHTTPD_CONFIGURATION_RELEASE "Release-static")
set(MICROHTTPD_CONFIGURATION_DEBUG "Debug-static")
endif()

vcpkg_install_msbuild(
SOURCE_PATH ${SOURCE_PATH}
PROJECT_SUBPATH w32/VS2015/libmicrohttpd.vcxproj
PLATFORM ${MSBUILD_PLATFORM}
RELEASE_CONFIGURATION ${MICROHTTPD_CONFIGURATION_RELEASE}
DEBUG_CONFIGURATION ${MICROHTTPD_CONFIGURATION_DEBUG}
)

file(GLOB MICROHTTPD_HEADERS ${SOURCE_PATH}/src/include/*h)
foreach(MICROHTTPD_HEADER ${MICROHTTPD_HEADERS})
file(COPY ${MICROHTTPD_HEADER} DESTINATION ${CURRENT_PACKAGES_DIR}/include)
endforeach()
else()
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
)

vcpkg_install_make()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
endif()

file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
5 changes: 0 additions & 5 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -808,11 +808,6 @@ libmesh:x64-windows-static=skip
libmesh:x86-windows=skip
libmesh:x64-osx=skip
libmesh:x64-linux=skip
libmicrohttpd:arm64-windows=fail
libmicrohttpd:arm-uwp=fail
libmicrohttpd:x64-linux=fail
libmicrohttpd:x64-osx=fail
libmicrohttpd:x64-uwp=fail
libmodbus:arm-uwp=fail
libmodbus:x64-uwp=fail
libmodman:arm-uwp=fail
Expand Down

0 comments on commit 67a031a

Please sign in to comment.