vcpkg/ports/rhash/portfile.cmake
Kai Pastor ea91673467
[rhash] Fix error, revise dllexport/dllimport (#36950)
Pass `RHASH_XVERSION` as a number number, not as a string. General
error, but detected by Android NDK r26
~~~

vcpkg/buildtrees/rhash/src/v1.4.4-e609ae2b07.clean/librhash/rhash.c:877:10:
error: incompatible pointer to integer conversion returning 'char[1]'
from a function with result type 'rhash_uptr_t' (aka 'unsigned int')
[-Wint-conversion]
                return RHASH_XVERSION;
                       ^~~~~~~~~~~~~~
<command line>:2:24: note: expanded from macro 'RHASH_XVERSION'
#define RHASH_XVERSION ""
                       ^~
1 error generated.
~~~

Complement `dllexport` with `dllimport` for shared windows, and omit it
everywhere else.

Add missing pc file as if installed with official build system.
2024-02-28 17:12:10 -08:00

29 lines
958 B
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO rhash/RHash
REF "v${VERSION}"
SHA512 00a7e5e058b53ce20ae79509815452ed9cb699d1322b678220b72c61dea3ea2f8fa131acfade8bb6d9f6af913f0c3c472330841181b22314b8755166310c946f
HEAD_REF master
)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}/librhash")
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}/librhash"
OPTIONS
-DRHASH_VERSION=${VERSION}
OPTIONS_DEBUG
-DRHASH_SKIP_HEADERS=ON
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-rhash)
vcpkg_fixup_pkgconfig()
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/rhash.h" "# define RHASH_API" "# define RHASH_API __declspec(dllimport)")
endif()
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)