From 2ac8af6d7013ce2a1f9118248695c5ad88cf2bf1 Mon Sep 17 00:00:00 2001 From: "Fabio A. Correa" Date: Thu, 29 Dec 2022 13:28:12 -0500 Subject: [PATCH] [glpk] Add new port (#28364) * Create portfile.cmake * Add manifest and patches for glpk-5.0 * Shrink portfile.cmake Removed some comments * Update ci.baseline.txt to list glpk:x86-windows * Addressing some reviewer comments and suggestions * Addressing comments from microsoft/vcpkg#28364 * Trying out x86-windows again * Updating the version database * x-add-version glpk * Addressing reviews * Update version database: x-add-version glpk * More compact code thanks to PR reviews * format-manifest ports/glpk/vcpkg.json * Update version database: x-add-version glpk * No default features * Update version database: x-add-version glpk --- ports/glpk/configure.ac.patch | 23 ++++++++++++++ ports/glpk/portfile.cmake | 60 +++++++++++++++++++++++++++++++++++ ports/glpk/vcpkg.json | 56 ++++++++++++++++++++++++++++++++ versions/baseline.json | 4 +++ versions/g-/glpk.json | 9 ++++++ 5 files changed, 152 insertions(+) create mode 100644 ports/glpk/configure.ac.patch create mode 100644 ports/glpk/portfile.cmake create mode 100644 ports/glpk/vcpkg.json create mode 100644 versions/g-/glpk.json diff --git a/ports/glpk/configure.ac.patch b/ports/glpk/configure.ac.patch new file mode 100644 index 0000000000..e05600ad82 --- /dev/null +++ b/ports/glpk/configure.ac.patch @@ -0,0 +1,23 @@ +--- configure.ac.original 2022-12-15 13:46:24.222223600 -0500 ++++ configure.ac 2022-12-28 09:30:59.301984700 -0500 +@@ -114,6 +114,12 @@ + LIBODBC="libodbc.dylib" + LIBMYSQL="libmysqlclient.dylib" + ;; ++ cygwin* | mingw*) ++ LIBIODBC="odbc32.dll" ++ LIBODBC="odbc32.dll" ++ LIBMYSQL="libmysql.dll" ++ AC_DEFINE([__WOE__], [1], [N/A]) ++ ;; + *) + LIBIODBC="libiodbc.so" + LIBODBC="libodbc.so" +@@ -145,7 +151,6 @@ + AC_MSG_ERROR([--enable-mysql requires --enable-dl]) + fi + AC_MSG_RESULT([yes]) +- CPPFLAGS="-I/usr/include/mysql $CPPFLAGS" + AC_DEFINE_UNQUOTED([MYSQL_DLNAME], ["$LIBMYSQL"], [N/A]) + else + AC_MSG_RESULT([no]) diff --git a/ports/glpk/portfile.cmake b/ports/glpk/portfile.cmake new file mode 100644 index 0000000000..b0b6e97d95 --- /dev/null +++ b/ports/glpk/portfile.cmake @@ -0,0 +1,60 @@ +vcpkg_minimum_required(VERSION 2022-10-12) +set(DISTFILE_SHA512_HASH 4e92195fa058c707146f2690f3a38b46c33add948c852f67659ca005a6aa980bbf97be96528b0f8391690facb880ac2126cd60198c6c175e7f3f06cca7e29f9d) + +vcpkg_download_distfile( + DISTFILE + FILENAME "glpk.tar.gz" + URLS "https://ftpmirror.gnu.org/gnu/glpk/glpk-${VERSION}.tar.gz" "https://ftp.gnu.org/gnu/glpk/glpk-${VERSION}.tar.gz" + SHA512 ${DISTFILE_SHA512_HASH} +) + +vcpkg_extract_source_archive( + SOURCE_PATH + ARCHIVE "${DISTFILE}" + PATCHES + configure.ac.patch +) + +vcpkg_list(SET CONFIGURE_OPTIONS) +if("dl" IN_LIST FEATURES) + vcpkg_list(APPEND CONFIGURE_OPTIONS --enable-dl=dlfcn "LIBS=-ldl \$LIBS") +else() + vcpkg_list(APPEND CONFIGURE_OPTIONS --disable-dl) +endif() + +if("gmp" IN_LIST FEATURES) + vcpkg_list(APPEND CONFIGURE_OPTIONS --with-gmp) +else() + vcpkg_list(APPEND CONFIGURE_OPTIONS --without-gmp) +endif() + +if("mysql" IN_LIST FEATURES) + vcpkg_list(APPEND CONFIGURE_OPTIONS + --enable-mysql + "CPPFLAGS=-I${CURRENT_INSTALLED_DIR}/include/mysql \$CPPFLAGS" + ) +else() + vcpkg_list(APPEND CONFIGURE_OPTIONS --disable-mysql) +endif() + +if("odbc" IN_LIST FEATURES) + vcpkg_list(APPEND CONFIGURE_OPTIONS --enable-odbc) +else() + vcpkg_list(APPEND CONFIGURE_OPTIONS --disable-odbc) +endif() + +vcpkg_configure_make( + SOURCE_PATH "${SOURCE_PATH}" + AUTOCONFIG + NO_ADDITIONAL_PATHS + DETERMINE_BUILD_TRIPLET + OPTIONS + ${CONFIGURE_OPTIONS} +) + +vcpkg_install_make() +vcpkg_fixup_pkgconfig() +vcpkg_copy_pdbs() +vcpkg_copy_tools(TOOL_NAMES glpsol AUTO_CLEAN) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/glpk/vcpkg.json b/ports/glpk/vcpkg.json new file mode 100644 index 0000000000..e253cb0cb0 --- /dev/null +++ b/ports/glpk/vcpkg.json @@ -0,0 +1,56 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", + "name": "glpk", + "version": "5.0", + "maintainers": "Fabio A. Correa Duran", + "description": [ + "The GNU Linear Programming Kit (GLPK) solves large-scale linear programming (LP), mixed integer programming (MIP), and related problems.", + "GLPK includes the following main components:", + "Primal and dual simplex methods", + "Primal-dual interior-point method", + "Branch-and-cut method", + "Translator for GNU MathProg", + "Application program interface (API)", + "Stand-alone LP/MIP solver " + ], + "homepage": "https://www.gnu.org/software/glpk/", + "documentation": "https://www.gnu.org/software/glpk/#documentation", + "license": "GPL-3.0-or-later", + "features": { + "dl": { + "description": "Enable shared library support", + "dependencies": [ + "dlfcn-win32" + ] + }, + "gmp": { + "description": "Use the GNU Multiple Precision Arithmetic Library", + "dependencies": [ + "gmp" + ] + }, + "mysql": { + "description": "Sharing between MathProg objects and MySQL databases (libmysql)", + "dependencies": [ + { + "name": "glpk", + "features": [ + "dl" + ] + }, + "libmysql" + ] + }, + "odbc": { + "description": "Sharing between MathProg objects and databases through ODBC (libiodbc)", + "dependencies": [ + { + "name": "glpk", + "features": [ + "dl" + ] + } + ] + } + } +} diff --git a/versions/baseline.json b/versions/baseline.json index 9c3bbe0e38..20db432329 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2700,6 +2700,10 @@ "baseline": "20201203", "port-version": 0 }, + "glpk": { + "baseline": "5.0", + "port-version": 0 + }, "glslang": { "baseline": "11.13.0", "port-version": 0 diff --git a/versions/g-/glpk.json b/versions/g-/glpk.json new file mode 100644 index 0000000000..8ddae89856 --- /dev/null +++ b/versions/g-/glpk.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "e1346a1f1cdf3d0b7aa46517ae0f8f0006ac6903", + "version": "5.0", + "port-version": 0 + } + ] +}