aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/cspice
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/cspice
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/cspice')
-rw-r--r--vcpkg/ports/cspice/CMakeLists.txt47
-rw-r--r--vcpkg/ports/cspice/License.txt16
-rw-r--r--vcpkg/ports/cspice/isatty.patch19
-rw-r--r--vcpkg/ports/cspice/portfile.cmake54
-rw-r--r--vcpkg/ports/cspice/vcpkg.json19
5 files changed, 155 insertions, 0 deletions
diff --git a/vcpkg/ports/cspice/CMakeLists.txt b/vcpkg/ports/cspice/CMakeLists.txt
new file mode 100644
index 0000000..96a2ceb
--- /dev/null
+++ b/vcpkg/ports/cspice/CMakeLists.txt
@@ -0,0 +1,47 @@
+cmake_minimum_required(VERSION 3.10)
+project(cspice LANGUAGES C)
+
+file(GLOB CSPICE_SOURCES "${PROJECT_SOURCE_DIR}/src/cspice/*.c")
+set(INCLUDE_PATH "${PROJECT_SOURCE_DIR}/include")
+
+add_library(cspice ${CSPICE_SOURCES})
+target_include_directories(cspice PUBLIC
+ $<BUILD_INTERFACE:${INCLUDE_PATH}>
+ $<INSTALL_INTERFACE:include>
+)
+
+if (WIN32)
+ # cf. src/cspice/mkprodct.bat
+ target_compile_definitions(cspice PRIVATE "_COMPLEX_DEFINED;MSDOS;OMIT_BLANK_CC;NON_ANSI_STDIO;_CRT_SECURE_NO_WARNINGS")
+ set_target_properties(cspice PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
+ if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ target_compile_options(cspice PRIVATE /sdl-)
+ endif()
+elseif (UNIX)
+ target_compile_definitions(cspice PRIVATE "NON_UNIX_STDIO")
+ set_target_properties(cspice PROPERTIES C_STANDARD 90)
+ target_compile_options(cspice PRIVATE -Wno-error=implicit-function-declaration)
+endif ()
+
+set_target_properties(cspice PROPERTIES
+ VERSION "${VERSION}"
+ SOVERSION "${VERSION}"
+)
+
+file(GLOB SPICE_HEADERS ${INCLUDE_PATH}/*.h)
+install(FILES ${SPICE_HEADERS} DESTINATION include/cspice)
+
+install(
+ TARGETS cspice
+ EXPORT cspice
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+ RUNTIME DESTINATION bin
+)
+
+install(
+ EXPORT cspice
+ FILE unofficial-cspice-config.cmake
+ NAMESPACE unofficial::cspice::
+ DESTINATION share/unofficial-cspice
+)
diff --git a/vcpkg/ports/cspice/License.txt b/vcpkg/ports/cspice/License.txt
new file mode 100644
index 0000000..dcec937
--- /dev/null
+++ b/vcpkg/ports/cspice/License.txt
@@ -0,0 +1,16 @@
+This software and any related materials were created by the California
+Institute of Technology (Caltech) under U.S. government contract with the
+National Aeronautics and Space Administration (NASA). The software is
+Technology and Software Publicly Available under U.S. export laws and is
+provided "as-is" to the recipient without warranty of any kind, including any
+warranties of performance or merchantability or fitness for particular use or
+purpose (as set forth in United States UCC§2312-§2313) or for any purpose
+whatsoever, for the software and related materials, however used. In no event
+shall Caltech, its Jet Propulsion Laboratory, or NASA be liable for any damages
+and/or costs, including, but not limited to, incidental or consequential
+damages of any kind, including economic damage or injury to property and lost
+profits, regardless of whether Caltech, JPL, or NASA be advised, have reason to
+know, or, in fact, shall know of the possibility. Recipient bears all risk
+relating to quality and performance of the software and any related materials,
+and agrees to indemnify Caltech and NASA for all third-party claims resulting
+from the actions of recipient in the use of the software.
diff --git a/vcpkg/ports/cspice/isatty.patch b/vcpkg/ports/cspice/isatty.patch
new file mode 100644
index 0000000..98624a3
--- /dev/null
+++ b/vcpkg/ports/cspice/isatty.patch
@@ -0,0 +1,19 @@
+--- a/src/cspice/fio.h 2019-11-01 20:51:53.198400000 +0300
++++ b/src/cspice/fio.h 2019-11-01 21:19:58.123200000 +0300
+@@ -1,3 +1,6 @@
++#ifdef _WIN32
++#include <io.h> /* for isatty() */
++#endif
+ #include "stdio.h"
+ #include "errno.h"
+ #ifndef NULL
+@@ -75,7 +76,9 @@
+ extern int (*f__donewrec)(void), t_putc(int), x_wSL(void);
+ extern void b_char(char*,char*,ftnlen), g_char(char*,ftnlen,char*);
+ extern int c_sfe(cilist*), z_rnew(void);
++#ifndef _WIN32
+ extern int isatty(int);
++#endif
+ extern int err__fl(int,int,char*);
+ extern int xrd_SL(void);
+ extern int f__putbuf(int);
diff --git a/vcpkg/ports/cspice/portfile.cmake b/vcpkg/ports/cspice/portfile.cmake
new file mode 100644
index 0000000..f009b94
--- /dev/null
+++ b/vcpkg/ports/cspice/portfile.cmake
@@ -0,0 +1,54 @@
+if (VCPKG_TARGET_IS_WINDOWS)
+ if (VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
+ set(SUBPATH "PC_Windows_VisualC_32bit/packages/cspice.zip")
+ set(SHA512 1949fd12b30ca0e42f53311a97d8571e68737f6a667a56946d3415ee715dda0a1adca9bfc985b9b9447084189c50d261f2c00960cbe2ddf6a1d1d92cf8fa17ab)
+ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
+ set(SUBPATH "PC_Windows_VisualC_64bit/packages/cspice.zip")
+ set(SHA512 5457f24279fb485b0ac92713dab026d1c1ed766a358fcf7d9ce3f70693e75da85a656e72b1ada4dc334e9e68d6c0eb42b2a31f3ad0c83b491dd3afc79e5cda98)
+ endif()
+elseif(VCPKG_TARGET_IS_OSX)
+ if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
+ set(SUBPATH "MacIntel_OSX_AppleC_64bit/packages/cspice.tar.Z")
+ set(SHA512 ea9a32c763cd54303de180b4895a195cd5ef6774051f18a1812f2fff39adc0ca9d5dd7878853af40e766882e79a0f542a45139656fb79fb4b436c4bc5bdecddc)
+ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
+ set(SUBPATH "MacM1_OSX_clang_64bit/packages/cspice.tar.Z")
+ set(SHA512 a64f028ec1935dbc7f8d03c903fbfa40cfff097ec4aa0ca4aa1d2ee08561833000e7caf99d6550b06d2a0874cbaf1767382e7a9aea6a39228f3eaa89c6c31a6d)
+ endif()
+else()
+ if ((VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") OR (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm"))
+ set(SUBPATH "PC_Linux_GCC_32bit/packages/cspice.tar.Z")
+ set(SHA512 22a6250376e9f98d75ecc8682c5432a07a89addc9812010ad97059491e2c19cab418d7aa3f591bded9df132fcfb6865686f0ecfe70821ad31061ae2f7b165f2b)
+ elseif((VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") OR (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64"))
+ set(SUBPATH "PC_Linux_GCC_64bit/packages/cspice.tar.Z")
+ set(SHA512 59946f628284cd31c75a23c152d725ae7e01b179f97c52b98518eceeda54bc38875b1dd93dc17574c0bf00e706e0ee35d06ecb5d7871d49633baa8f16eb6c7c8)
+ endif()
+endif()
+
+set(URL "https://naif.jpl.nasa.gov/pub/naif/misc/toolkit_N00${VERSION}/C/${SUBPATH}")
+get_filename_component(ext "${SUBPATH}" EXT)
+string(SUBSTRING "${SHA512}" 0 6 subsha)
+vcpkg_download_distfile(ARCHIVE URLS "${URL}" FILENAME "cspice-${subsha}${ext}" SHA512 "${SHA512}")
+
+vcpkg_extract_source_archive(
+ SOURCE_PATH
+ ARCHIVE "${ARCHIVE}"
+ PATCHES
+ isatty.patch
+)
+file(COPY "${CURRENT_PORT_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ "-DVERSION=${VERSION}"
+)
+vcpkg_cmake_install()
+vcpkg_copy_pdbs()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
+
+vcpkg_install_copyright(
+ COMMENT "The complete rules are available at https://naif.jpl.nasa.gov/naif/rules.html."
+ FILE_LIST "${CMAKE_CURRENT_LIST_DIR}/License.txt"
+)
diff --git a/vcpkg/ports/cspice/vcpkg.json b/vcpkg/ports/cspice/vcpkg.json
new file mode 100644
index 0000000..ca1ff02
--- /dev/null
+++ b/vcpkg/ports/cspice/vcpkg.json
@@ -0,0 +1,19 @@
+{
+ "name": "cspice",
+ "version": "67",
+ "port-version": 4,
+ "description": "NASA C SPICE toolkit",
+ "homepage": "https://naif.jpl.nasa.gov/naif/toolkit_C.html",
+ "license": null,
+ "supports": "!(arm & windows)",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}