pdftract/distribution/vcpkg/portfile.cmake.template
jedarden 71872aaf73 feat(pdftract-1eaxm): implement libpdftract C FFI library
Implement the libpdftract native FFI library as a cdylib + staticlib
with cbindgen-generated headers and full extern "C" API.

Components:
- crates/pdftract-libpdftract/ with cdylib + staticlib targets
- All 9 contract methods + utility functions as extern "C"
- cbindgen config and generated pdftract.h header
- pkg-config template (pdftract.pc.in)
- Homebrew formula template (distribution/homebrew/)
- vcpkg port template (distribution/vcpkg/)
- C conformance test (tests/conformance.c)

API features:
- Owned JSON strings returned via CString::into_raw()
- Caller frees with pdftract_free() (not libc free())
- Thread-local error storage (pdftract_last_error)
- Thread-safe and reentrant (no global mutable state)
- ABI version function for compatibility checking

Verification:
- cargo build produces libpdftract.so and libpdftract.a
- Conformance test compiles and runs successfully
- Thread safety verified with 4 concurrent threads

References:
- Plan line 3477: SDK Architecture / The Ten SDKs
- Bead: pdftract-1eaxm

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-23 08:55:12 -04:00

29 lines
1.3 KiB
Text

# vcpkg portfile for pdftract
# This file is a template - variables are replaced during release
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO jedarden/pdftract
REF "v{{VERSION}}"
SHA512 "{{GITHUB_SHA512}}"
HEAD_REF main
)
# The release archive contains pre-built binaries
# Install directly to the appropriate locations
file(INSTALL "${SOURCE_PATH}/lib/libpdftract.so" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
file(INSTALL "${SOURCE_PATH}/lib/libpdftract.a" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
file(INSTALL "${SOURCE_PATH}/include/pdftract.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include")
file(INSTALL "${SOURCE_PATH}/lib/pkgconfig/pdftract.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/lib/pkgconfig")
# Fix the prefix in the pkg-config file
file(READ "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/pdftract.pc" _pcfile)
string(REPLACE "@PREFIX@" "${CURRENT_INSTALLED_DIR}" _pcfile "${_pcfile}")
file(WRITE "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/pdftract.pc" "${_pcfile}")
# Handle copyright
file(INSTALL "${SOURCE_PATH}/LICENSE-MIT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
file(INSTALL "${SOURCE_PATH}/LICENSE-APACHE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright-apache)
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE-MIT" "${SOURCE_PATH}/LICENSE-APACHE")