diff --git a/.gitignore b/.gitignore index 065737d..bd178c5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ /scipoptsuite-*.tgz -/zimpl-*.tar.gz diff --git a/sources b/sources index e98ee2e..c253c94 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (zimpl-3.7.1.tar.gz) = a94eba1ec9d7947d30c948599092100f5f1d6be509967f947154141a7718e054e398860fbfba34bb2e0dd129f58fd168d1087023ffe3215f7d498e829e38afc9 +SHA512 (scipoptsuite-9.0.1.tgz) = 0068b433a5c168e46973d53c2df4121139d6efe13fe1d6d60a9e818bac97244403b54a1819ede06b28e6301cfc3c884c563d277fcb16e5fe740e4cbd2d472336 diff --git a/zimpl-shared.patch b/zimpl-shared.patch index 8183dbf..d3b69cd 100644 --- a/zimpl-shared.patch +++ b/zimpl-shared.patch @@ -1,6 +1,6 @@ ---- zimpl-3.7.1/CMakeLists.txt.orig 2026-03-31 18:33:37.000000000 -0600 -+++ zimpl-3.7.1/CMakeLists.txt 2026-04-03 09:07:34.324781686 -0600 -@@ -49,8 +49,6 @@ endif() +--- zimpl/CMakeLists.txt.orig 2023-08-08 06:33:21.000000000 -0600 ++++ zimpl/CMakeLists.txt 2023-11-15 21:04:39.935423110 -0700 +@@ -41,8 +41,6 @@ endif() # use C99 standard set(CMAKE_C_STANDARD 99) @@ -8,9 +8,9 @@ -set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) option(ZLIB "use ZLIB" ON) - option(SANITIZE "should sanitizers be enabled if available" OFF) ---- zimpl-3.7.1/src/CMakeLists.txt.orig 2026-03-31 18:33:37.000000000 -0600 -+++ zimpl-3.7.1/src/CMakeLists.txt 2026-04-03 09:10:52.288477757 -0600 + option(SANITIZE_ADDRESS "should the address sanitizer be enabled in debug mode if available" OFF) +--- zimpl/src/CMakeLists.txt.orig 2023-08-08 06:33:23.000000000 -0600 ++++ zimpl/src/CMakeLists.txt 2023-11-15 21:04:39.936423097 -0700 @@ -118,12 +118,10 @@ if(MSVC) endif() @@ -24,31 +24,27 @@ +add_library(libzimpl SHARED ${libsources}) +set_target_properties(libzimpl PROPERTIES + POSITION_INDEPENDENT_CODE on -+ VERSION 0.0.0 SOVERSION 0) ++ VERSION 0.0.0 SOVERSION 0) target_link_libraries(libzimpl ${libs}) #create zimpl binary -@@ -138,9 +136,6 @@ endif() +@@ -140,21 +138,18 @@ endif() set_target_properties(libzimpl PROPERTIES OUTPUT_NAME "zimpl") -set_target_properties(libzimpl-pic PROPERTIES - OUTPUT_NAME "zimpl-pic") - - include(GNUInstallDirs) - # install the header files of zimpl -@@ -150,7 +145,7 @@ if(MSVC) - endif() + install(FILES ${headers} DESTINATION include/zimpl) # install the binary and the library to appropriate locations and add them to an export group -install(TARGETS libzimpl zimpl libzimpl-pic EXPORT zimpl-targets +install(TARGETS libzimpl zimpl EXPORT zimpl-targets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -@@ -164,7 +159,7 @@ endif() - install(FILES ${PROJECT_SOURCE_DIR}/LICENSE DESTINATION ${CMAKE_INSTALL_DATADIR}/licenses/zimpl) + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + INCLUDES DESTINATION include) # Add library targets to the build-tree export set -export(TARGETS libzimpl libzimpl-pic @@ -56,9 +52,9 @@ FILE "${CMAKE_BINARY_DIR}/zimpl-targets.cmake") #configure the config file for the build tree ---- zimpl-3.7.1/src/zimpl/zimpllib.c.orig 2026-03-31 18:33:37.000000000 -0600 -+++ zimpl-3.7.1/src/zimpl/zimpllib.c 2026-04-03 09:07:34.325265327 -0600 -@@ -455,3 +455,66 @@ bool zpl_read_with_args(char** argv, int +--- zimpl/src/zimpl/zimpllib.c.orig 2023-08-08 06:33:23.000000000 -0600 ++++ zimpl/src/zimpl/zimpllib.c 2023-11-15 21:04:39.936423097 -0700 +@@ -456,3 +456,66 @@ bool zpl_read_with_args(char** argv, int return ret; } @@ -125,8 +121,8 @@ +{ + abort(); +} ---- zimpl-3.7.1/zimpl-config.cmake.in.orig 2026-03-31 18:33:37.000000000 -0600 -+++ zimpl-3.7.1/zimpl-config.cmake.in 2026-04-03 09:07:34.325434322 -0600 +--- zimpl/zimpl-config.cmake.in.orig 2023-08-08 06:33:23.000000000 -0600 ++++ zimpl/zimpl-config.cmake.in 2023-11-15 21:04:39.936423097 -0700 @@ -3,7 +3,7 @@ if(NOT TARGET libzimpl) endif() diff --git a/zimpl-test-bsearch.patch b/zimpl-test-bsearch.patch deleted file mode 100644 index 1d43a8d..0000000 --- a/zimpl-test-bsearch.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- zimpl-362/check/minlp.pip.ref.orig 2024-09-12 23:08:28.000000000 -0600 -+++ zimpl-362/check/minlp.pip.ref 2025-01-15 15:31:47.835678296 -0700 -@@ -31,7 +31,7 @@ Subject to - c1_1: - -1 x#1 +1 x#1^2 = 1 - c2_1: -- +30 x#1 * x#2 * x#3 <= 77 -+ +30 x#2 * x#3 * x#1 <= 77 - c3_1: - +1 y * z -4 y^2 * z^3 = 0 - c4_1: -@@ -40,7 +40,7 @@ Subject to - c5_1: - +2 y +5 z +1 y * z = -7 - c6_1: -- +4 x#1^2 +2.66666666666667 x#1 * x#2 +0.444444444444444 x#2^2 = 9 -+ +4 x#1^2 +2.66666666666667 x#2 * x#1 +0.444444444444444 x#2^2 = 9 - c7_1_a_0: - - __c7_1_t_0@d + a = 0 - c7_1_b_1: diff --git a/zimpl-zlib-ng.patch b/zimpl-zlib-ng.patch deleted file mode 100644 index 8d21795..0000000 --- a/zimpl-zlib-ng.patch +++ /dev/null @@ -1,77 +0,0 @@ ---- zimpl-362/CMakeLists.txt.orig 2024-09-17 19:44:17.589497126 -0600 -+++ zimpl-362/CMakeLists.txt 2024-09-17 19:55:30.619340046 -0600 -@@ -125,11 +125,11 @@ include_directories(${GMP_INCLUDE_DIRS}) - set(libs ${libs} ${GMP_LIBRARIES}) - - if(ZLIB) -- find_package(ZLIB) -+ find_package(ZLIB-NG) - endif() --if(ZLIB_FOUND) -- set(libs ${libs} ${ZLIB_LIBRARIES}) -- include_directories(${ZLIB_INCLUDE_DIRS}) -+if(ZLIB-NG_FOUND) -+ set(libs ${libs} -lz-ng) -+ include_directories(/usr/include) - else() - add_definitions(-DWITHOUT_ZLIB) - endif() ---- zimpl-362/src/zimpl/iread.c.orig 2024-09-17 19:44:29.886348077 -0600 -+++ zimpl-362/src/zimpl/iread.c 2024-09-17 19:50:15.407160377 -0600 -@@ -38,7 +38,7 @@ - #endif - - #ifndef WITHOUT_ZLIB --#include -+#include - #endif - - #include "zimpl/lint.h" ---- zimpl-362/src/zimpl/metaio.c.orig 2024-09-12 23:08:28.000000000 -0600 -+++ zimpl-362/src/zimpl/metaio.c 2024-09-17 19:49:03.368033502 -0600 -@@ -34,7 +34,8 @@ - #include - - #ifndef WITHOUT_ZLIB --#include -+#define WITH_GZFILEOP -+#include - #endif - - #include "zimpl/lint.h" -@@ -248,7 +249,7 @@ MFP* mio_open(char const* name, char con - { - mfp->type = MFP_ZLIB; - -- if (NULL == (mfp->fp.zlib = gzopen(filename, "r"))) -+ if (NULL == (mfp->fp.zlib = zng_gzopen(filename, "r"))) - { - perror(filename); - free(mfp); -@@ -300,7 +301,7 @@ void mio_close(MFP* mfp) - break; - #ifndef WITHOUT_ZLIB - case MFP_ZLIB : -- gzclose(mfp->fp.zlib); -+ zng_gzclose(mfp->fp.zlib); - break; - #endif /* ! WITHOUT_ZLIB */ - default : -@@ -328,7 +329,7 @@ int mio_getc(MFP const* mfp) - break; - #ifndef WITHOUT_ZLIB - case MFP_ZLIB : -- c = gzgetc(mfp->fp.zlib); -+ c = zng_gzgetc(mfp->fp.zlib); - break; - #endif /* ! WITHOUT_ZLIB */ - default : -@@ -354,7 +355,7 @@ char* mio_gets(MFP const* mfp, char* buf - break; - #ifndef WITHOUT_ZLIB - case MFP_ZLIB : -- s = gzgets(mfp->fp.zlib, buf, len); -+ s = zng_gzgets(mfp->fp.zlib, buf, len); - break; - #endif /* ! WITHOUT_ZLIB */ - default : diff --git a/zimpl.spec b/zimpl.spec index a530c0c..47e2184 100644 --- a/zimpl.spec +++ b/zimpl.spec @@ -1,10 +1,16 @@ -%global giturl https://github.com/scipopt/zimpl +# ZIMPL is only available in the scipoptsuite tarball, which is a collection of +# packages. Most of them can be downloaded separately, so we do not build the +# entire suite here. See https://github.com/scipopt/scip/issues/37. +# There is now a zimpl repository, but upstream has not tagged any releases yet. +%global scipoptsuitever 9.0.1 Name: zimpl -Version: 3.7.1 +Version: 3.6.0 Release: %autorelease Summary: Zuse Institut Mathematical Programming Language +%global upver %(sed 's/\\.//g' <<< %{version}) + # LGPL-3.0-or-later: the project as a whole # Other licenses are due to fonts embedded in the PDF manual: # OFL-1.1-RFN: AMS @@ -12,46 +18,42 @@ Summary: Zuse Institut Mathematical Programming Language # GPL-1.0-or-later: CM-Super License: LGPL-3.0-or-later AND OFL-1.1-RFN AND Knuth-CTAN AND GPL-1.0-or-later URL: https://zimpl.zib.de/ -VCS: git:%{giturl}.git -Source: %{giturl}/archive/v%{version}/%{name}-%{version}.tar.gz +VCS: https://github.com/scipopt/zimpl +Source0: https://scipopt.org/download/release/scipoptsuite-%{scipoptsuitever}.tgz # Build a shared library instead of a static library. ZIMPL leaves some symbols # undefined, namely those listed in src/zimpl/xlpglue.h. They take advantage of # the fact that linking with a static library only pulls in the referenced # symbols to avoid referring to the xlp symbols in certain cases, for example, # in the scip test suite. Since Fedora wants shared libraries, we have to give # those symbols weak dummy definitions to avoid unresolved symbols at link time. -Patch: %{name}-shared.patch +Patch0: %{name}-shared.patch # This package and cddlib both have C functions named set_copy and set_free. # This is a problem for polymake, which links both libraries. Rename the # zimpl functions to set_copy_zimpl and set_free_zimpl. -Patch: %{name}-cddlib-set-clash.patch -# Use zlib-ng directly, rather than via the compatibility interface -Patch: %{name}-zlib-ng.patch -# Fix a test failure that appears to be due to changes in bsearch behavior -# in newer glibc builds -Patch: %{name}-test-bsearch.patch +Patch1: %{name}-cddlib-set-clash.patch # See https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval ExcludeArch: %{ix86} -BuildSystem: cmake BuildRequires: bison +BuildRequires: cmake BuildRequires: flex BuildRequires: gcc BuildRequires: pkgconfig(gmp) -BuildRequires: pkgconfig(zlib-ng) +BuildRequires: pkgconfig(zlib) Requires: libzimpl%{?_isa} = %{version}-%{release} -%global _desc %{expand:Zimpl is a little language to translate the mathematical model of a problem -into a linear or nonlinear (mixed-) integer mathematical program expressed in -.lp or .mps file format which can be read and (hopefully) solved by a LP or -MIP solver.} +%global _desc %{expand: +Zimpl is a little language to translate the mathematical model of a +problem into a linear or nonlinear (mixed-) integer mathematical program +expressed in .lp or .mps file format which can be read and (hopefully) +solved by a LP or MIP solver.} -%description -%_desc +%description %_desc -This package contains a command-line tool to access ZIMPL functionality. +This package contains a command-line tool to access ZIMPL +functionality. %package -n libzimpl # LGPL-3.0-or-later: the project as a whole @@ -60,8 +62,7 @@ This package contains a command-line tool to access ZIMPL functionality. License: LGPL-3.0-or-later AND LGPL-2.0-or-later AND GPL-3.0-or-later WITH Bison-exception-2.2 Summary: Zuse Institut Mathematical Programming Language -%description -n libzimpl -%_desc +%description -n libzimpl %_desc This package contains a library interface to ZIMPL functionality. @@ -74,39 +75,36 @@ Requires: %{name}%{?_isa} = %{version}-%{release} Requires: libzimpl%{?_isa} = %{version}-%{release} %description -n libzimpl-devel -This package contains headers and library links for developing applications -that use libzimpl. +This package contains headers and library links for developing +applications that use libzimpl. %prep -%autosetup -p1 +%autosetup -n scipoptsuite-%{scipoptsuitever}/%{name} -p1 + +# Fix installation directories +if [ "%{_lib}" != "lib" ]; then + sed -i 's,\(DESTINATION \)lib,\1%{_lib},' src/CMakeLists.txt +fi # Avoid warnings about obsolete invocations of grep sed -i 's/fgrep/grep -F/' check/check.sh -%conf -p +%build export CFLAGS='%{build_cflags} -DFREEMEM -DNO_MSHELL' export CXXFLAGS='%{build_cxxflags} -DFREEMEM -DNO_MSHELL' +%cmake +%cmake_build -%install -a +%install +%cmake_install mkdir -p %{buildroot}%{_mandir}/man1 cp -p doc/zimpl.man %{buildroot}%{_mandir}/man1/zimpl.1 -# We do this in %%files with the %%license macro -rm -fr %{buildroot}%{_datadir}/licenses - -# Help the debuginfo generator find source files -mkdir -p %{_vpath_builddir}/zimpl -ln -s ../../src/zimpl/mmlscan.l %{_vpath_builddir}/zimpl -ln -s ../../src/zimpl/mmlparse2.y %{_vpath_builddir}/zimpl - %check -# FIXME: Test qubo.zpl (qbo: lp) fails on ppc64le -%ifnarch %{power64} export LD_LIBRARY_PATH=%{buildroot}%{_libdir} cd check sh check.sh ../%{_vpath_builddir}/bin/zimpl cd - -%endif %files %doc doc/zimpl.pdf @@ -116,7 +114,7 @@ cd - %files -n libzimpl %doc CHANGELOG README %license LICENSE -%{_libdir}/libzimpl.so.0{,.*} +%{_libdir}/libzimpl.so.0* %files -n libzimpl-devel %{_includedir}/zimpl/