From d6599a56e9e61a2c572b80d9dca926279ced798e Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Wed, 3 May 2017 11:25:35 -0700 Subject: [ms-gsl][gnusl][gsl] Rename gnusl->gsl, gsl->ms-gsl. --- ports/gnusl/0001-configure.patch | 165 ---------------------------------- ports/gnusl/0002-add-fp-control.patch | 97 -------------------- ports/gnusl/CMakeLists.txt | 66 -------------- ports/gnusl/CONTROL | 3 - ports/gnusl/portfile.cmake | 43 --------- ports/gsl/0001-configure.patch | 165 ++++++++++++++++++++++++++++++++++ ports/gsl/0002-add-fp-control.patch | 97 ++++++++++++++++++++ ports/gsl/CMakeLists.txt | 66 ++++++++++++++ ports/gsl/CONTROL | 4 +- ports/gsl/portfile.cmake | 47 +++++++--- ports/ms-gsl/CONTROL | 3 + ports/ms-gsl/portfile.cmake | 16 ++++ 12 files changed, 386 insertions(+), 386 deletions(-) delete mode 100644 ports/gnusl/0001-configure.patch delete mode 100644 ports/gnusl/0002-add-fp-control.patch delete mode 100644 ports/gnusl/CMakeLists.txt delete mode 100644 ports/gnusl/CONTROL delete mode 100644 ports/gnusl/portfile.cmake create mode 100644 ports/gsl/0001-configure.patch create mode 100644 ports/gsl/0002-add-fp-control.patch create mode 100644 ports/gsl/CMakeLists.txt create mode 100644 ports/ms-gsl/CONTROL create mode 100644 ports/ms-gsl/portfile.cmake diff --git a/ports/gnusl/0001-configure.patch b/ports/gnusl/0001-configure.patch deleted file mode 100644 index 7f80e2e55..000000000 --- a/ports/gnusl/0001-configure.patch +++ /dev/null @@ -1,165 +0,0 @@ ---- - config.h.in => config.h | 50 ++++++++++++++++++++++++------------------------- - 1 file changed, 25 insertions(+), 25 deletions(-) - rename config.h.in => config.h (92%) - -diff --git a/config.h.in b/config.h -similarity index 92% -rename from config.h.in -rename to config.h -index d39c766..c650f5b 100644 ---- a/config.h.in -+++ b/config.h -@@ -8,19 +8,19 @@ - - /* Define to 1 if you have the declaration of `acosh', and to 0 if you don't. - */ --#undef HAVE_DECL_ACOSH -+#define HAVE_DECL_ACOSH 1 - - /* Define to 1 if you have the declaration of `asinh', and to 0 if you don't. - */ --#undef HAVE_DECL_ASINH -+#define HAVE_DECL_ASINH 1 - - /* Define to 1 if you have the declaration of `atanh', and to 0 if you don't. - */ --#undef HAVE_DECL_ATANH -+#define HAVE_DECL_ATANH 1 - - /* Define to 1 if you have the declaration of `expm1', and to 0 if you don't. - */ --#undef HAVE_DECL_EXPM1 -+#define HAVE_DECL_EXPM1 1 - - /* Define to 1 if you have the declaration of `feenableexcept', and to 0 if - you don't. */ -@@ -40,31 +40,31 @@ - - /* Define to 1 if you have the declaration of `frexp', and to 0 if you don't. - */ --#undef HAVE_DECL_FREXP -+#define HAVE_DECL_FREXP 1 - - /* Define to 1 if you have the declaration of `hypot', and to 0 if you don't. - */ --#undef HAVE_DECL_HYPOT -+#define HAVE_DECL_HYPOT 1 - - /* Define to 1 if you have the declaration of `isfinite', and to 0 if you - don't. */ --#undef HAVE_DECL_ISFINITE -+#define HAVE_DECL_ISFINITE 1 - - /* Define to 1 if you have the declaration of `isinf', and to 0 if you don't. - */ --#undef HAVE_DECL_ISINF -+#define HAVE_DECL_ISINF 1 - - /* Define to 1 if you have the declaration of `isnan', and to 0 if you don't. - */ --#undef HAVE_DECL_ISNAN -+#define HAVE_DECL_ISNAN 1 - - /* Define to 1 if you have the declaration of `ldexp', and to 0 if you don't. - */ --#undef HAVE_DECL_LDEXP -+#define HAVE_DECL_LDEXP 1 - - /* Define to 1 if you have the declaration of `log1p', and to 0 if you don't. - */ --#undef HAVE_DECL_LOG1P -+#define HAVE_DECL_LOG1P 1 - - /* Define to 1 if you have the header file. */ - #undef HAVE_DLFCN_H -@@ -73,13 +73,13 @@ - #undef HAVE_DOPRNT - - /* Defined if you have ansi EXIT_SUCCESS and EXIT_FAILURE in stdlib.h */ --#undef HAVE_EXIT_SUCCESS_AND_FAILURE -+#define HAVE_EXIT_SUCCESS_AND_FAILURE 1 - - /* Defined on architectures with excess floating-point precision */ - #undef HAVE_EXTENDED_PRECISION_REGISTERS - - /* Define if x86 processor has sse extensions. */ --#undef HAVE_FPU_X86_SSE -+#define HAVE_FPU_X86_SSE 1 - - /* Define to 1 if you have the header file. */ - #undef HAVE_IEEEFP_H -@@ -94,43 +94,43 @@ - #undef HAVE_INLINE - - /* Define to 1 if you have the header file. */ --#undef HAVE_INTTYPES_H -+#define HAVE_INTTYPES_H 1 - - /* Define to 1 if you have the `m' library (-lm). */ - #undef HAVE_LIBM - - /* Define to 1 if you have the `memcpy' function. */ --#undef HAVE_MEMCPY -+#define HAVE_MEMCPY 1 - - /* Define to 1 if you have the `memmove' function. */ --#undef HAVE_MEMMOVE -+#define HAVE_MEMMOVE 1 - - /* Define to 1 if you have the header file. */ --#undef HAVE_MEMORY_H -+#define HAVE_MEMORY_H 1 - - /* Define this if printf can handle %Lf for long double */ - #undef HAVE_PRINTF_LONGDOUBLE - - /* Define to 1 if you have the header file. */ --#undef HAVE_STDINT_H -+#define HAVE_STDINT_H 1 - - /* Define to 1 if you have the header file. */ --#undef HAVE_STDLIB_H -+#define HAVE_STDLIB_H 1 - - /* Define to 1 if you have the `strdup' function. */ --#undef HAVE_STRDUP -+#define HAVE_STRDUP 1 - - /* Define to 1 if you have the header file. */ - #undef HAVE_STRINGS_H - - /* Define to 1 if you have the header file. */ --#undef HAVE_STRING_H -+#define HAVE_STRING_H 1 - - /* Define to 1 if you have the `strtol' function. */ --#undef HAVE_STRTOL -+#define HAVE_STRTOL 1 - - /* Define to 1 if you have the `strtoul' function. */ --#undef HAVE_STRTOUL -+#define HAVE_STRTOUL 1 - - /* Define to 1 if you have the header file. */ - #undef HAVE_SYS_STAT_H -@@ -142,7 +142,7 @@ - #undef HAVE_UNISTD_H - - /* Define to 1 if you have the `vprintf' function. */ --#undef HAVE_VPRINTF -+#define HAVE_VPRINTF 1 - - /* Define if you need to hide the static definitions of inline functions */ - #undef HIDE_INLINE_STATIC -@@ -176,7 +176,7 @@ - #undef RELEASED - - /* Define to 1 if you have the ANSI C header files. */ --#undef STDC_HEADERS -+#define STDC_HEADERS 1 - - /* Version number of package */ - #undef VERSION --- - diff --git a/ports/gnusl/0002-add-fp-control.patch b/ports/gnusl/0002-add-fp-control.patch deleted file mode 100644 index dceeb3881..000000000 --- a/ports/gnusl/0002-add-fp-control.patch +++ /dev/null @@ -1,97 +0,0 @@ ---- - ieee-utils/fp-win.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++ - ieee-utils/fp.c | 2 ++ - 2 files changed, 72 insertions(+) - create mode 100644 ieee-utils/fp-win.c - -diff --git a/ieee-utils/fp-win.c b/ieee-utils/fp-win.c -new file mode 100644 -index 0000000..e024eae ---- /dev/null -+++ b/ieee-utils/fp-win.c -@@ -0,0 +1,70 @@ -+/* fp-win.c -+ * -+ * Author: Brian Gladman -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or (at -+ * your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -+ */ -+ -+#include -+ -+#include -+#include -+#include -+ -+const char *fp_env_string = "round-to-nearest,double-precision,mask-all"; -+ -+int -+gsl_ieee_set_mode (int precision, int rounding, int exception_mask) -+{ -+ unsigned int old, mode = _DN_SAVE, mask = _MCW_DN | _MCW_RC | _MCW_EM; -+ -+ switch(precision) -+ { -+ case GSL_IEEE_SINGLE_PRECISION: mode |= _PC_24; break; -+ case GSL_IEEE_EXTENDED_PRECISION: mode |= _PC_64; break; -+ case GSL_IEEE_DOUBLE_PRECISION: -+ default: mode |= _PC_53; -+ } -+#ifndef _M_AMD64 -+ mask |= _MCW_PC; -+#endif -+ -+ switch(rounding) -+ { -+ case GSL_IEEE_ROUND_DOWN: mode |= _RC_DOWN; break; -+ case GSL_IEEE_ROUND_UP: mode |= _RC_UP; break; -+ case GSL_IEEE_ROUND_TO_ZERO: mode |= _RC_CHOP; break; -+ case GSL_IEEE_ROUND_TO_NEAREST: -+ default: mode |= _RC_NEAR; -+ } -+ -+ if(exception_mask & GSL_IEEE_MASK_INVALID) -+ mode |= _EM_INVALID; -+ if(exception_mask & GSL_IEEE_MASK_DENORMALIZED) -+ mode |= _EM_DENORMAL; -+ if(exception_mask & GSL_IEEE_MASK_DIVISION_BY_ZERO) -+ mode |= _EM_ZERODIVIDE; -+ if(exception_mask & GSL_IEEE_MASK_OVERFLOW) -+ mode |= _EM_OVERFLOW; -+ if(exception_mask & GSL_IEEE_MASK_UNDERFLOW) -+ mode |= _EM_UNDERFLOW; -+ if(exception_mask & GSL_IEEE_TRAP_INEXACT) -+ mode &= ~_EM_INEXACT; -+ else -+ mode |= _EM_INEXACT; -+ -+ _controlfp_s( &old, mode, mask); -+ return GSL_SUCCESS; -+} -diff --git a/ieee-utils/fp.c b/ieee-utils/fp.c -index 445a14f..b6ae5af 100644 ---- a/ieee-utils/fp.c -+++ b/ieee-utils/fp.c -@@ -45,6 +45,8 @@ - #endif - #elif HAVE_DECL_FEENABLEEXCEPT || HAVE_DECL_FESETTRAPENABLE - #include "fp-gnuc99.c" -+#elif _MSC_VER -+#include "fp-win.c" - #else - #include "fp-unknown.c" - #endif --- - diff --git a/ports/gnusl/CMakeLists.txt b/ports/gnusl/CMakeLists.txt deleted file mode 100644 index 704542035..000000000 --- a/ports/gnusl/CMakeLists.txt +++ /dev/null @@ -1,66 +0,0 @@ -cmake_minimum_required(VERSION 3.8) -project(libgsl C) - -option(INSTALL_HEADERS "Install public header files" ON) - -# Function to extract parameter from makefile. Space separated values are returned as lists -function(extract_from_makefile PATTERN RETURN FILEPATH) - file(READ ${FILEPATH} MAKEFILE_CONTENT) - string(REGEX MATCH "${PATTERN}" CONTENTS "${MAKEFILE_CONTENT}") - set(CONTENTS ${CMAKE_MATCH_1}) - # Split string into list - string(REGEX REPLACE "[ \t]+" ";" CONTENTS "${CONTENTS}") - if("${CONTENTS}" STREQUAL "") - message(AUTHOR_WARNING "No match for \"${PATTERN}\" found in file ${FILEPATH}") - endif() - # Return - set(${RETURN} ${CONTENTS} PARENT_SCOPE) -endfunction(extract_from_makefile) - -# Function to extract C sources from makefile -function(extract_sources SUBFOLDER ALLSOURCES) - extract_from_makefile("lib[a-zA-Z1-9_]*_la_SOURCES[ \t]*=[ \t]*([^\n]*)" SOURCEFILES "${SUBFOLDER}/Makefile.am") - # Add the folder in front of the file names - string(REGEX REPLACE "([^;]+)" "${SUBFOLDER}/\\1" SOURCEFILES "${SOURCEFILES}") - # Return - set(${ALLSOURCES} ${${ALLSOURCES}} ${SOURCEFILES} PARENT_SCOPE) -endfunction(extract_sources) - -set(SOURCES) -extract_from_makefile("SUBDIRS = ([^\n]*)" FOLDERS "./Makefile.am") -extract_sources("." SOURCES) -foreach(DIR IN LISTS FOLDERS) - extract_sources("${DIR}" SOURCES) -endforeach() - -file(READ gsl_types.h GSLTYPES_H) -string(REPLACE "#ifdef WIN32" "#if 1 /*WIN32*/" GSLTYPES_H "${GSLTYPES_H}") -if(BUILD_SHARED_LIBS) - string(REPLACE "# ifdef GSL_DLL" "# if 1 /*GSL_DLL*/" GSLTYPES_H "${GSLTYPES_H}") -endif() -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gsl_types.h "${GSLTYPES_H}") - -file(GLOB_RECURSE PUBLIC_HEADERS gsl*.h) -list(APPEND PUBLIC_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/gsl_types.h) - -add_library(libgsl ${SOURCES}) -set_target_properties(libgsl PROPERTIES DEFINE_SYMBOL DLL_EXPORT WINDOWS_EXPORT_ALL_SYMBOLS ON) - -if(INSTALL_HEADERS) - set_target_properties(libgsl PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}") -endif() -target_include_directories(libgsl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) -# For the build, we need to copy all headers to the gsl directory -file(COPY ${PUBLIC_HEADERS} DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/gsl") - -set(TARGET_INSTALL_OPTIONS) -if(INSTALL_HEADERS) - set(TARGET_INSTALL_OPTIONS PUBLIC_HEADER DESTINATION include/gsl) -endif() - -install(TARGETS libgsl - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - ${TARGET_INSTALL_OPTIONS} -) \ No newline at end of file diff --git a/ports/gnusl/CONTROL b/ports/gnusl/CONTROL deleted file mode 100644 index 9b752b4ae..000000000 --- a/ports/gnusl/CONTROL +++ /dev/null @@ -1,3 +0,0 @@ -Source: gnusl -Version: 2.3 -Description: The GNU Scientific Library (GSL) is a numerical library for C and C++ programmers diff --git a/ports/gnusl/portfile.cmake b/ports/gnusl/portfile.cmake deleted file mode 100644 index 765c8e815..000000000 --- a/ports/gnusl/portfile.cmake +++ /dev/null @@ -1,43 +0,0 @@ -# Common Ambient Variables: -# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} -# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} -# CURRENT_PORT DIR = ${VCPKG_ROOT_DIR}\ports\${PORT} -# PORT = current port name (zlib, etc) -# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc) -# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic) -# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic) -# VCPKG_ROOT_DIR = -# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm) -# - -include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/gsl-2.3) -vcpkg_download_distfile(ARCHIVE - URLS "ftp://ftp.gnu.org/gnu/gsl/gsl-2.3.tar.gz" - FILENAME "gsl-2.3.tar.gz" - SHA512 ada622079f4ac667d95f74b38aa368726fc1b18fd34555bcefe90920d3da93a9289ebff966be43325af806107001bc8973daf9f8418e6c97b866be2296b566ff -) -vcpkg_extract_source_archive(${ARCHIVE}) - -file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) - -vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} - PATCHES - ${CMAKE_CURRENT_LIST_DIR}/0001-configure.patch - ${CMAKE_CURRENT_LIST_DIR}/0002-add-fp-control.patch -) - -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA - OPTIONS_DEBUG -DINSTALL_HEADERS=OFF -) - -vcpkg_install_cmake() - -# Handle copyright -file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/gnusl) -file(RENAME ${CURRENT_PACKAGES_DIR}/share/gnusl/COPYING ${CURRENT_PACKAGES_DIR}/share/gnusl/copyright) - -vcpkg_copy_pdbs() diff --git a/ports/gsl/0001-configure.patch b/ports/gsl/0001-configure.patch new file mode 100644 index 000000000..7f80e2e55 --- /dev/null +++ b/ports/gsl/0001-configure.patch @@ -0,0 +1,165 @@ +--- + config.h.in => config.h | 50 ++++++++++++++++++++++++------------------------- + 1 file changed, 25 insertions(+), 25 deletions(-) + rename config.h.in => config.h (92%) + +diff --git a/config.h.in b/config.h +similarity index 92% +rename from config.h.in +rename to config.h +index d39c766..c650f5b 100644 +--- a/config.h.in ++++ b/config.h +@@ -8,19 +8,19 @@ + + /* Define to 1 if you have the declaration of `acosh', and to 0 if you don't. + */ +-#undef HAVE_DECL_ACOSH ++#define HAVE_DECL_ACOSH 1 + + /* Define to 1 if you have the declaration of `asinh', and to 0 if you don't. + */ +-#undef HAVE_DECL_ASINH ++#define HAVE_DECL_ASINH 1 + + /* Define to 1 if you have the declaration of `atanh', and to 0 if you don't. + */ +-#undef HAVE_DECL_ATANH ++#define HAVE_DECL_ATANH 1 + + /* Define to 1 if you have the declaration of `expm1', and to 0 if you don't. + */ +-#undef HAVE_DECL_EXPM1 ++#define HAVE_DECL_EXPM1 1 + + /* Define to 1 if you have the declaration of `feenableexcept', and to 0 if + you don't. */ +@@ -40,31 +40,31 @@ + + /* Define to 1 if you have the declaration of `frexp', and to 0 if you don't. + */ +-#undef HAVE_DECL_FREXP ++#define HAVE_DECL_FREXP 1 + + /* Define to 1 if you have the declaration of `hypot', and to 0 if you don't. + */ +-#undef HAVE_DECL_HYPOT ++#define HAVE_DECL_HYPOT 1 + + /* Define to 1 if you have the declaration of `isfinite', and to 0 if you + don't. */ +-#undef HAVE_DECL_ISFINITE ++#define HAVE_DECL_ISFINITE 1 + + /* Define to 1 if you have the declaration of `isinf', and to 0 if you don't. + */ +-#undef HAVE_DECL_ISINF ++#define HAVE_DECL_ISINF 1 + + /* Define to 1 if you have the declaration of `isnan', and to 0 if you don't. + */ +-#undef HAVE_DECL_ISNAN ++#define HAVE_DECL_ISNAN 1 + + /* Define to 1 if you have the declaration of `ldexp', and to 0 if you don't. + */ +-#undef HAVE_DECL_LDEXP ++#define HAVE_DECL_LDEXP 1 + + /* Define to 1 if you have the declaration of `log1p', and to 0 if you don't. + */ +-#undef HAVE_DECL_LOG1P ++#define HAVE_DECL_LOG1P 1 + + /* Define to 1 if you have the header file. */ + #undef HAVE_DLFCN_H +@@ -73,13 +73,13 @@ + #undef HAVE_DOPRNT + + /* Defined if you have ansi EXIT_SUCCESS and EXIT_FAILURE in stdlib.h */ +-#undef HAVE_EXIT_SUCCESS_AND_FAILURE ++#define HAVE_EXIT_SUCCESS_AND_FAILURE 1 + + /* Defined on architectures with excess floating-point precision */ + #undef HAVE_EXTENDED_PRECISION_REGISTERS + + /* Define if x86 processor has sse extensions. */ +-#undef HAVE_FPU_X86_SSE ++#define HAVE_FPU_X86_SSE 1 + + /* Define to 1 if you have the header file. */ + #undef HAVE_IEEEFP_H +@@ -94,43 +94,43 @@ + #undef HAVE_INLINE + + /* Define to 1 if you have the header file. */ +-#undef HAVE_INTTYPES_H ++#define HAVE_INTTYPES_H 1 + + /* Define to 1 if you have the `m' library (-lm). */ + #undef HAVE_LIBM + + /* Define to 1 if you have the `memcpy' function. */ +-#undef HAVE_MEMCPY ++#define HAVE_MEMCPY 1 + + /* Define to 1 if you have the `memmove' function. */ +-#undef HAVE_MEMMOVE ++#define HAVE_MEMMOVE 1 + + /* Define to 1 if you have the header file. */ +-#undef HAVE_MEMORY_H ++#define HAVE_MEMORY_H 1 + + /* Define this if printf can handle %Lf for long double */ + #undef HAVE_PRINTF_LONGDOUBLE + + /* Define to 1 if you have the header file. */ +-#undef HAVE_STDINT_H ++#define HAVE_STDINT_H 1 + + /* Define to 1 if you have the header file. */ +-#undef HAVE_STDLIB_H ++#define HAVE_STDLIB_H 1 + + /* Define to 1 if you have the `strdup' function. */ +-#undef HAVE_STRDUP ++#define HAVE_STRDUP 1 + + /* Define to 1 if you have the header file. */ + #undef HAVE_STRINGS_H + + /* Define to 1 if you have the header file. */ +-#undef HAVE_STRING_H ++#define HAVE_STRING_H 1 + + /* Define to 1 if you have the `strtol' function. */ +-#undef HAVE_STRTOL ++#define HAVE_STRTOL 1 + + /* Define to 1 if you have the `strtoul' function. */ +-#undef HAVE_STRTOUL ++#define HAVE_STRTOUL 1 + + /* Define to 1 if you have the header file. */ + #undef HAVE_SYS_STAT_H +@@ -142,7 +142,7 @@ + #undef HAVE_UNISTD_H + + /* Define to 1 if you have the `vprintf' function. */ +-#undef HAVE_VPRINTF ++#define HAVE_VPRINTF 1 + + /* Define if you need to hide the static definitions of inline functions */ + #undef HIDE_INLINE_STATIC +@@ -176,7 +176,7 @@ + #undef RELEASED + + /* Define to 1 if you have the ANSI C header files. */ +-#undef STDC_HEADERS ++#define STDC_HEADERS 1 + + /* Version number of package */ + #undef VERSION +-- + diff --git a/ports/gsl/0002-add-fp-control.patch b/ports/gsl/0002-add-fp-control.patch new file mode 100644 index 000000000..dceeb3881 --- /dev/null +++ b/ports/gsl/0002-add-fp-control.patch @@ -0,0 +1,97 @@ +--- + ieee-utils/fp-win.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++ + ieee-utils/fp.c | 2 ++ + 2 files changed, 72 insertions(+) + create mode 100644 ieee-utils/fp-win.c + +diff --git a/ieee-utils/fp-win.c b/ieee-utils/fp-win.c +new file mode 100644 +index 0000000..e024eae +--- /dev/null ++++ b/ieee-utils/fp-win.c +@@ -0,0 +1,70 @@ ++/* fp-win.c ++ * ++ * Author: Brian Gladman ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or (at ++ * your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ */ ++ ++#include ++ ++#include ++#include ++#include ++ ++const char *fp_env_string = "round-to-nearest,double-precision,mask-all"; ++ ++int ++gsl_ieee_set_mode (int precision, int rounding, int exception_mask) ++{ ++ unsigned int old, mode = _DN_SAVE, mask = _MCW_DN | _MCW_RC | _MCW_EM; ++ ++ switch(precision) ++ { ++ case GSL_IEEE_SINGLE_PRECISION: mode |= _PC_24; break; ++ case GSL_IEEE_EXTENDED_PRECISION: mode |= _PC_64; break; ++ case GSL_IEEE_DOUBLE_PRECISION: ++ default: mode |= _PC_53; ++ } ++#ifndef _M_AMD64 ++ mask |= _MCW_PC; ++#endif ++ ++ switch(rounding) ++ { ++ case GSL_IEEE_ROUND_DOWN: mode |= _RC_DOWN; break; ++ case GSL_IEEE_ROUND_UP: mode |= _RC_UP; break; ++ case GSL_IEEE_ROUND_TO_ZERO: mode |= _RC_CHOP; break; ++ case GSL_IEEE_ROUND_TO_NEAREST: ++ default: mode |= _RC_NEAR; ++ } ++ ++ if(exception_mask & GSL_IEEE_MASK_INVALID) ++ mode |= _EM_INVALID; ++ if(exception_mask & GSL_IEEE_MASK_DENORMALIZED) ++ mode |= _EM_DENORMAL; ++ if(exception_mask & GSL_IEEE_MASK_DIVISION_BY_ZERO) ++ mode |= _EM_ZERODIVIDE; ++ if(exception_mask & GSL_IEEE_MASK_OVERFLOW) ++ mode |= _EM_OVERFLOW; ++ if(exception_mask & GSL_IEEE_MASK_UNDERFLOW) ++ mode |= _EM_UNDERFLOW; ++ if(exception_mask & GSL_IEEE_TRAP_INEXACT) ++ mode &= ~_EM_INEXACT; ++ else ++ mode |= _EM_INEXACT; ++ ++ _controlfp_s( &old, mode, mask); ++ return GSL_SUCCESS; ++} +diff --git a/ieee-utils/fp.c b/ieee-utils/fp.c +index 445a14f..b6ae5af 100644 +--- a/ieee-utils/fp.c ++++ b/ieee-utils/fp.c +@@ -45,6 +45,8 @@ + #endif + #elif HAVE_DECL_FEENABLEEXCEPT || HAVE_DECL_FESETTRAPENABLE + #include "fp-gnuc99.c" ++#elif _MSC_VER ++#include "fp-win.c" + #else + #include "fp-unknown.c" + #endif +-- + diff --git a/ports/gsl/CMakeLists.txt b/ports/gsl/CMakeLists.txt new file mode 100644 index 000000000..704542035 --- /dev/null +++ b/ports/gsl/CMakeLists.txt @@ -0,0 +1,66 @@ +cmake_minimum_required(VERSION 3.8) +project(libgsl C) + +option(INSTALL_HEADERS "Install public header files" ON) + +# Function to extract parameter from makefile. Space separated values are returned as lists +function(extract_from_makefile PATTERN RETURN FILEPATH) + file(READ ${FILEPATH} MAKEFILE_CONTENT) + string(REGEX MATCH "${PATTERN}" CONTENTS "${MAKEFILE_CONTENT}") + set(CONTENTS ${CMAKE_MATCH_1}) + # Split string into list + string(REGEX REPLACE "[ \t]+" ";" CONTENTS "${CONTENTS}") + if("${CONTENTS}" STREQUAL "") + message(AUTHOR_WARNING "No match for \"${PATTERN}\" found in file ${FILEPATH}") + endif() + # Return + set(${RETURN} ${CONTENTS} PARENT_SCOPE) +endfunction(extract_from_makefile) + +# Function to extract C sources from makefile +function(extract_sources SUBFOLDER ALLSOURCES) + extract_from_makefile("lib[a-zA-Z1-9_]*_la_SOURCES[ \t]*=[ \t]*([^\n]*)" SOURCEFILES "${SUBFOLDER}/Makefile.am") + # Add the folder in front of the file names + string(REGEX REPLACE "([^;]+)" "${SUBFOLDER}/\\1" SOURCEFILES "${SOURCEFILES}") + # Return + set(${ALLSOURCES} ${${ALLSOURCES}} ${SOURCEFILES} PARENT_SCOPE) +endfunction(extract_sources) + +set(SOURCES) +extract_from_makefile("SUBDIRS = ([^\n]*)" FOLDERS "./Makefile.am") +extract_sources("." SOURCES) +foreach(DIR IN LISTS FOLDERS) + extract_sources("${DIR}" SOURCES) +endforeach() + +file(READ gsl_types.h GSLTYPES_H) +string(REPLACE "#ifdef WIN32" "#if 1 /*WIN32*/" GSLTYPES_H "${GSLTYPES_H}") +if(BUILD_SHARED_LIBS) + string(REPLACE "# ifdef GSL_DLL" "# if 1 /*GSL_DLL*/" GSLTYPES_H "${GSLTYPES_H}") +endif() +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gsl_types.h "${GSLTYPES_H}") + +file(GLOB_RECURSE PUBLIC_HEADERS gsl*.h) +list(APPEND PUBLIC_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/gsl_types.h) + +add_library(libgsl ${SOURCES}) +set_target_properties(libgsl PROPERTIES DEFINE_SYMBOL DLL_EXPORT WINDOWS_EXPORT_ALL_SYMBOLS ON) + +if(INSTALL_HEADERS) + set_target_properties(libgsl PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}") +endif() +target_include_directories(libgsl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) +# For the build, we need to copy all headers to the gsl directory +file(COPY ${PUBLIC_HEADERS} DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/gsl") + +set(TARGET_INSTALL_OPTIONS) +if(INSTALL_HEADERS) + set(TARGET_INSTALL_OPTIONS PUBLIC_HEADER DESTINATION include/gsl) +endif() + +install(TARGETS libgsl + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + ${TARGET_INSTALL_OPTIONS} +) \ No newline at end of file diff --git a/ports/gsl/CONTROL b/ports/gsl/CONTROL index 3a50432d3..8970dca69 100644 --- a/ports/gsl/CONTROL +++ b/ports/gsl/CONTROL @@ -1,3 +1,3 @@ Source: gsl -Version: 20170425-8b320e3f5d016f953e55dfc7ec8694c1349d3fe4 -Description: Guideline Support Library \ No newline at end of file +Version: 2.3 +Description: The GNU Scientific Library is a numerical library for C and C++ programmers diff --git a/ports/gsl/portfile.cmake b/ports/gsl/portfile.cmake index 34a1bb77e..76ab1582b 100644 --- a/ports/gsl/portfile.cmake +++ b/ports/gsl/portfile.cmake @@ -1,16 +1,43 @@ -#header-only library +# Common Ambient Variables: +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# CURRENT_PORT DIR = ${VCPKG_ROOT_DIR}\ports\${PORT} +# PORT = current port name (zlib, etc) +# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc) +# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic) +# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic) +# VCPKG_ROOT_DIR = +# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm) +# + include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/gsl-2.3) +vcpkg_download_distfile(ARCHIVE + URLS "ftp://ftp.gnu.org/gnu/gsl/gsl-2.3.tar.gz" + FILENAME "gsl-2.3.tar.gz" + SHA512 ada622079f4ac667d95f74b38aa368726fc1b18fd34555bcefe90920d3da93a9289ebff966be43325af806107001bc8973daf9f8418e6c97b866be2296b566ff +) +vcpkg_extract_source_archive(${ARCHIVE}) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) -vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO Microsoft/GSL - REF 8b320e3f5d016f953e55dfc7ec8694c1349d3fe4 - SHA512 79d4ecc937cdce2acf79620f12c6d4592159f17aa23c0fd1e978cc571e84ee11d91bd9a45f975546447e1ba20878244312609396a52a76f18872b97ea024aa00 - HEAD_REF master +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/0001-configure.patch + ${CMAKE_CURRENT_LIST_DIR}/0002-add-fp-control.patch ) -file(INSTALL ${SOURCE_PATH}/include/ DESTINATION ${CURRENT_PACKAGES_DIR}/include FILES_MATCHING PATTERN "*") +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS_DEBUG -DINSTALL_HEADERS=OFF +) + +vcpkg_install_cmake() # Handle copyright -file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/gsl) -file(RENAME ${CURRENT_PACKAGES_DIR}/share/gsl/LICENSE ${CURRENT_PACKAGES_DIR}/share/gsl/copyright) +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/gsl) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/gsl/COPYING ${CURRENT_PACKAGES_DIR}/share/gsl/copyright) + +vcpkg_copy_pdbs() diff --git a/ports/ms-gsl/CONTROL b/ports/ms-gsl/CONTROL new file mode 100644 index 000000000..c485497e3 --- /dev/null +++ b/ports/ms-gsl/CONTROL @@ -0,0 +1,3 @@ +Source: ms-gsl +Version: 20170425-8b320e3f5d016f953e55dfc7ec8694c1349d3fe4 +Description: Microsoft implementation of the Guidelines Support Library \ No newline at end of file diff --git a/ports/ms-gsl/portfile.cmake b/ports/ms-gsl/portfile.cmake new file mode 100644 index 000000000..a5353e666 --- /dev/null +++ b/ports/ms-gsl/portfile.cmake @@ -0,0 +1,16 @@ +#header-only library +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO Microsoft/GSL + REF 8b320e3f5d016f953e55dfc7ec8694c1349d3fe4 + SHA512 79d4ecc937cdce2acf79620f12c6d4592159f17aa23c0fd1e978cc571e84ee11d91bd9a45f975546447e1ba20878244312609396a52a76f18872b97ea024aa00 + HEAD_REF master +) + +file(INSTALL ${SOURCE_PATH}/include/ DESTINATION ${CURRENT_PACKAGES_DIR}/include FILES_MATCHING PATTERN "*") + +# Handle copyright +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/ms-gsl) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/ms-gsl/LICENSE ${CURRENT_PACKAGES_DIR}/share/ms-gsl/copyright) -- cgit v1.2.3