Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add plibsys library to ports #1127

Merged
merged 3 commits into from
May 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ports/plibsys/CONTROL
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Source: plibsys
Version: 0.0.3
Description: Highly portable C system library: threads and synchronization, sockets, IPC, data structures and more.
69 changes: 69 additions & 0 deletions ports/plibsys/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO saprykin/plibsys
REF 0.0.3
SHA512 e2393fecb3e5feae81a4d60cd03e2ca17bc58453efaa5598beacdc5acedbc7c90374f9f851301fee08ace8dace843a2dff8c1c449cd457302363c98dd24e0415
HEAD_REF master
)

if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
SET(PLIBSYS_STATIC OFF)
else()
SET(PLIBSYS_STATIC ON)
endif()

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DPLIBSYS_TESTS=OFF
-DPLIBSYS_COVERAGE=OFF
-DPLIBSYS_BUILD_STATIC=${PLIBSYS_STATIC}
)

vcpkg_install_cmake()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)

file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/plibsys RENAME copyright)

if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set(PLIBSYS_FILENAME plibsys)

# Put shared libraries into the proper directory
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)

file(RENAME ${CURRENT_PACKAGES_DIR}/lib/plibsys.dll ${CURRENT_PACKAGES_DIR}/bin/plibsys.dll)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/plibsys.dll ${CURRENT_PACKAGES_DIR}/debug/bin/plibsys.dll)
else()
set(PLIBSYS_FILENAME plibsysstatic)

# For static build remove dynamic libraries
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/plibsys.lib)
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/plibsys.dll)
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/plibsys.lib)
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/plibsys.dll)
endif()

file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tmp)

# Save library files
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/${PLIBSYS_FILENAME}.lib ${CURRENT_PACKAGES_DIR}/tmp/plibsys.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/${PLIBSYS_FILENAME}.lib ${CURRENT_PACKAGES_DIR}/tmp/plibsys_debug.lib)

# Remove unused shared libraries
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib)

file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib)

# Re-install library files
file(RENAME ${CURRENT_PACKAGES_DIR}/tmp/plibsys.lib ${CURRENT_PACKAGES_DIR}/lib/plibsys.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/tmp/plibsys_debug.lib ${CURRENT_PACKAGES_DIR}/debug/lib/plibsys.lib)

# Remove duplicate library files (already installed)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/tmp)

vcpkg_copy_pdbs()