From a932e5fc209db0bfae032da585de7d86d98c5d7a Mon Sep 17 00:00:00 2001 From: Iraklis Karagkiozoglou Date: Mon, 13 Feb 2017 05:35:12 +0200 Subject: [PATCH 1/2] libnice port --- ports/libnice/CMakeLists.txt | 144 +++++++++++++++++++++++++++++++++++ ports/libnice/CONTROL | 4 + ports/libnice/portfile.cmake | 32 ++++++++ 3 files changed, 180 insertions(+) create mode 100644 ports/libnice/CMakeLists.txt create mode 100644 ports/libnice/CONTROL create mode 100644 ports/libnice/portfile.cmake diff --git a/ports/libnice/CMakeLists.txt b/ports/libnice/CMakeLists.txt new file mode 100644 index 0000000000..3c8206cda0 --- /dev/null +++ b/ports/libnice/CMakeLists.txt @@ -0,0 +1,144 @@ +cmake_minimum_required(VERSION 3.0) +project(libnice C) +SET (this_target libnice) + +add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS) + +configure_file(${CMAKE_SOURCE_DIR}/win32/vs9/config.h ${CMAKE_SOURCE_DIR}/config.h COPYONLY) +configure_file(${CMAKE_SOURCE_DIR}/win32/vs9/libnice.def ${CMAKE_SOURCE_DIR}/libnice.def COPYONLY) + +find_path(GLIB_INCLUDE_DIR glib.h) +find_library(GLIB_LIBRARY glib-2.0) +find_library(GOBJECT_LIBRARY gobject-2.0) +find_library(GIO_LIBRARY gio-2.0) +find_library(IPHLPAPI_LIBRARY iphlpapi) +find_library(WS2_32_LIB ws2_32) +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/agent + ${CMAKE_CURRENT_SOURCE_DIR}/random + ${CMAKE_CURRENT_SOURCE_DIR}/socket + ${CMAKE_CURRENT_SOURCE_DIR}/stun + ${GLIB_INCLUDE_DIR}) + + +## section: source files +# Add your source files here (one file per line), please SORT in alphabetical order for future maintenance +SET (SRCS + ./agent/address.c + ./agent/agent.c + ./agent/candidate.c + ./agent/component.c + ./agent/conncheck.c + ./agent/debug.c + ./agent/discovery.c + ./agent/discovery.c + ./agent/inputstream.c + ./agent/interfaces.c + ./agent/iostream.c + ./agent/outputstream.c + ./agent/pseudotcp.c + ./agent/stream.c + ./random/random.c + ./random/random-glib.c + ./socket/http.c + ./socket/pseudossl.c + ./socket/socket.c + ./socket/socks5.c + ./socket/tcp-active.c + ./socket/tcp-bsd.c + ./socket/tcp-passive.c + ./socket/udp-bsd.c + ./socket/udp-turn.c + ./socket/udp-turn-over-tcp.c + ./stun/debug.c + ./stun/md5.c + ./stun/rand.c + ./stun/sha1.c + ./stun/stun5389.c + ./stun/stunagent.c + ./stun/stuncrc32.c + ./stun/stunhmac.c + ./stun/stunmessage.c + ./stun/usages/bind.c + ./stun/usages/ice.c + ./stun/usages/timer.c + ./stun/usages/turn.c + ./stun/utils.c + ./libnice.def + ) + +## section: header files +# Add your header files here(one file per line), please SORT in alphabetical order for future maintenance! +SET(HEADERS + ./config.h + ./agent/address.h + ./agent/agent.h + ./agent/agent-priv.h + ./agent/candidate.h + ./agent/component.h + ./agent/conncheck.h + ./agent/debug.h + ./agent/discovery.h + ./agent/discovery.h + ./agent/inputstream.h + ./agent/interfaces.h + ./agent/iostream.h + ./agent/outputstream.h + ./agent/pseudotcp.h + ./agent/stream.h + ./random/random.h + ./random/random-glib.h + ./socket/http.h + ./socket/pseudossl.h + ./socket/socket.h + ./socket/socks5.h + ./socket/tcp-active.h + ./socket/tcp-bsd.h + ./socket/tcp-passive.h + ./socket/udp-bsd.h + ./socket/udp-turn.h + ./socket/udp-turn-over-tcp.h + ./stun/constants.h + ./stun/debug.h + ./stun/md5.h + ./stun/rand.h + ./stun/sha1.h + ./stun/stun5389.h + ./stun/stunagent.h + ./stun/stuncrc32.h + ./stun/stunhmac.h + ./stun/stunmessage.h + ./stun/usages/bind.h + ./stun/usages/ice.h + ./stun/usages/timer.h + ./stun/usages/turn.h + ./stun/utils.h + ./stun/win32_common.h + ) +add_library(libnice ${SRCS} ${HEADERS}) +set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/wd4244 /wd4005 /wd4391 /wd4142 /wd4267") +target_link_libraries(libnice ${IPHLPAPI_LIBRARY} ${WS2_32_LIB} ${GLIB_LIBRARY} ${GOBJECT_LIBRARY} ${GIO_LIBRARY}) +install(TARGETS libnice +RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib) + +if (${CMAKE_BUILD_TYPE} STREQUAL "Release") +install(FILES agent/address.h DESTINATION include/nice) +install(FILES agent/agent.h DESTINATION include/nice) +install(FILES agent/candidate.h DESTINATION include/nice) +install(FILES agent/debug.h DESTINATION include/nice) +install(FILES agent/interfaces.h DESTINATION include/nice) +install(FILES nice/nice.h DESTINATION include/nice) +install(FILES agent/pseudotcp.h DESTINATION include/nice) +install(FILES stun/constants.h DESTINATION include/stun) +install(FILES stun/debug.h DESTINATION include/stun) +install(FILES stun/stunagent.h DESTINATION include/stun) +install(FILES stun/stunmessage.h DESTINATION include/stun) +install(FILES stun/usages/bind.h DESTINATION include/stun/usages) +install(FILES stun/usages/ice.h DESTINATION include/stun/usages) +install(FILES stun/usages/timer.h DESTINATION include/stun/usages) +install(FILES stun/usages/turn.h DESTINATION include/stun/usages) +install(FILES stun/win32_common.h DESTINATION include/stun) +endif() \ No newline at end of file diff --git a/ports/libnice/CONTROL b/ports/libnice/CONTROL new file mode 100644 index 0000000000..7d16f42622 --- /dev/null +++ b/ports/libnice/CONTROL @@ -0,0 +1,4 @@ +Source: libnice +Version: 0.1.13 +Description: Libnice is an implementation of the IETF's Interactive Connectivity Establishment (ICE) standard (RFC 5245) and the Session Traversal Utilities for NAT (STUN) standard (RFC 5389). +Build-Depends: glib \ No newline at end of file diff --git a/ports/libnice/portfile.cmake b/ports/libnice/portfile.cmake new file mode 100644 index 0000000000..eb829d4a4f --- /dev/null +++ b/ports/libnice/portfile.cmake @@ -0,0 +1,32 @@ +# Common Ambient Variables: +# VCPKG_ROOT_DIR = +# TARGET_TRIPLET is the current triplet (x86-windows, etc) +# PORT is the current port name (zlib, etc) +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libnice-0.1.13) +vcpkg_download_distfile(ARCHIVE + URLS "https://nice.freedesktop.org/releases/libnice-0.1.13.tar.gz" + FILENAME "libnice-0.1.13.tar.gz" + SHA512 c9bb81e8cd0b4e3673dba07ce08a16dd8821831339b44f1006510cdc09f9ae4c6eb7d43230711a2509867acb8d7df71821c411830dbf71c5a5d7e802f14a32c1 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS_RELEASE -DOPTIMIZE=1 + OPTIONS_DEBUG -DDEBUGGABLE=1 +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +# Handle copyright +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libnice) +file(COPY ${SOURCE_PATH}/COPYING.LGPL DESTINATION ${CURRENT_PACKAGES_DIR}/share/libnice) +file(COPY ${SOURCE_PATH}/COPYING.MPL DESTINATION ${CURRENT_PACKAGES_DIR}/share/libnice) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/libnice/COPYING ${CURRENT_PACKAGES_DIR}/share/libnice/copyright) From a82a0c01b5762470c3e15d3fd1538b2af469cca8 Mon Sep 17 00:00:00 2001 From: Iraklis Karagkiozoglou Date: Mon, 13 Feb 2017 05:45:28 +0200 Subject: [PATCH 2/2] Remove auto generated comments --- ports/libnice/CMakeLists.txt | 5 ----- ports/libnice/portfile.cmake | 13 ++++--------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/ports/libnice/CMakeLists.txt b/ports/libnice/CMakeLists.txt index 3c8206cda0..c631d33171 100644 --- a/ports/libnice/CMakeLists.txt +++ b/ports/libnice/CMakeLists.txt @@ -22,8 +22,6 @@ include_directories( ${GLIB_INCLUDE_DIR}) -## section: source files -# Add your source files here (one file per line), please SORT in alphabetical order for future maintenance SET (SRCS ./agent/address.c ./agent/agent.c @@ -67,9 +65,6 @@ SET (SRCS ./stun/utils.c ./libnice.def ) - -## section: header files -# Add your header files here(one file per line), please SORT in alphabetical order for future maintenance! SET(HEADERS ./config.h ./agent/address.h diff --git a/ports/libnice/portfile.cmake b/ports/libnice/portfile.cmake index eb829d4a4f..4d4a97baec 100644 --- a/ports/libnice/portfile.cmake +++ b/ports/libnice/portfile.cmake @@ -1,13 +1,7 @@ -# Common Ambient Variables: -# VCPKG_ROOT_DIR = -# TARGET_TRIPLET is the current triplet (x86-windows, etc) -# PORT is the current port name (zlib, etc) -# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} -# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} -# - include(vcpkg_common_functions) + set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libnice-0.1.13) + vcpkg_download_distfile(ARCHIVE URLS "https://nice.freedesktop.org/releases/libnice-0.1.13.tar.gz" FILENAME "libnice-0.1.13.tar.gz" @@ -16,6 +10,7 @@ vcpkg_download_distfile(ARCHIVE vcpkg_extract_source_archive(${ARCHIVE}) file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} OPTIONS_RELEASE -DOPTIMIZE=1 @@ -23,9 +18,9 @@ vcpkg_configure_cmake( ) vcpkg_install_cmake() + vcpkg_copy_pdbs() -# Handle copyright file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libnice) file(COPY ${SOURCE_PATH}/COPYING.LGPL DESTINATION ${CURRENT_PACKAGES_DIR}/share/libnice) file(COPY ${SOURCE_PATH}/COPYING.MPL DESTINATION ${CURRENT_PACKAGES_DIR}/share/libnice)