summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--lpsolve-5.5.0.11.cflags.patch39
-rw-r--r--lpsolve-5.5.2.0.defines.patch22
-rw-r--r--lpsolve-ccc-c99.patch51
-rw-r--r--lpsolve.spec70
-rw-r--r--sources1
6 files changed, 184 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..a596e73 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/lp_solve_5.5.2.0_source.tar.gz
diff --git a/lpsolve-5.5.0.11.cflags.patch b/lpsolve-5.5.0.11.cflags.patch
new file mode 100644
index 0000000..2471733
--- /dev/null
+++ b/lpsolve-5.5.0.11.cflags.patch
@@ -0,0 +1,39 @@
+--- lp_solve_5.5/lpsolve55/ccc 2018-02-26 09:27:51.074682302 +0000
++++ lp_solve_5.5/lpsolve55/ccc 2018-02-26 09:36:36.329990782 +0000
+@@ -35,16 +35,14 @@
+ so=y
+ fi
+
+-opts='-O3'
+-
+-$c -s -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd $opts $def $NOISNAN -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
++$c $CFLAGS -fPIC -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd $def $NOISNAN -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
+ ar rv bin/$PLATFORM/liblpsolve55.a `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'`
+ ranlib bin/$PLATFORM/liblpsolve55.a
+
+ if [ "$so" != "" ]
+ then
+- $c -fpic -s -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd -I. $opts $NOISNAN -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
+- $c -shared -Wl,-Bsymbolic -Wl,-soname,liblpsolve55.so -o bin/$PLATFORM/liblpsolve55.so `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'` -lc -lm -ldl
++ $c $CFLAGS -fPIC -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd -I. $NOISNAN -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
++ $c $LDFLAGS -shared -Wl,-Bsymbolic -Wl,-soname,liblpsolve55.so -o bin/$PLATFORM/liblpsolve55.so `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'` -lc -lm -ldl
+ fi
+
+ rm *.o 2>/dev/null
+--- lp_solve_5.5/lp_solve/ccc 2018-02-26 14:32:54.304981484 +0000
++++ lp_solve_5.5/lp_solve/ccc 2018-02-26 14:34:03.524750992 +0000
+@@ -28,8 +28,6 @@
+ fi
+ rm /tmp/isnan.c /tmp/isnan >/dev/null 2>&1
+
+-opts='-O3'
+-
+ def=
+ if [ "$PLATFORM" = "SCO_UNIX" ]
+ then opts='-O0'
+@@ -38,4 +36,4 @@
+ else dl=-ldl
+ fi
+
+-$c -I.. -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd -I../shared $opts $def $NOISNAN -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src -o bin/$PLATFORM/lp_solve $math $dl
++$c $CFLAGS $LDFLAGS -I.. -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd -I../shared $def $NOISNAN -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src -o bin/$PLATFORM/lp_solve $math $dl
diff --git a/lpsolve-5.5.2.0.defines.patch b/lpsolve-5.5.2.0.defines.patch
new file mode 100644
index 0000000..a325c13
--- /dev/null
+++ b/lpsolve-5.5.2.0.defines.patch
@@ -0,0 +1,22 @@
+--- lp_solve_5.5/lpsolve55/ccc
++++ lp_solve_5.5/lpsolve55/ccc
+@@ -18,7 +18,7 @@
+ echo '#include <stdio.h>'>>/tmp/isnan.c
+ echo '#include <stdlib.h>'>>/tmp/isnan.c
+ echo '#include <math.h>'>>/tmp/isnan.c
+-echo 'main(){isnan(0);}'>>/tmp/isnan.c
++echo 'main(){isnan(0.0);}'>>/tmp/isnan.c
+ $c /tmp/isnan.c -o /tmp/isnan $math >/dev/null 2>&1
+ if [ $? = 0 ]
+ then NOISNAN=
+--- lp_solve_5.5/lp_solve/ccc
++++ lp_solve_5.5/lp_solve/ccc
+@@ -20,7 +20,7 @@
+ echo '#include <stdio.h>'>>/tmp/isnan.c
+ echo '#include <stdlib.h>'>>/tmp/isnan.c
+ echo '#include <math.h>'>>/tmp/isnan.c
+-echo 'main(){isnan(0);}'>>/tmp/isnan.c
++echo 'main(){isnan(0.0);}'>>/tmp/isnan.c
+ $c /tmp/isnan.c -o /tmp/isnan $math >/dev/null 2>&1
+ if [ $? = 0 ]
+ then NOISNAN=
diff --git a/lpsolve-ccc-c99.patch b/lpsolve-ccc-c99.patch
new file mode 100644
index 0000000..929138b
--- /dev/null
+++ b/lpsolve-ccc-c99.patch
@@ -0,0 +1,51 @@
+Port the ccc build configuration detection tool to C99 by
+specifying the return type of main as int.
+
+Submitted upstream:
+
+ <https://groups.google.com/g/lp_solve/c/WjVf0dxrwfQ/m/rKMwf57tAwAJ>
+
+diff --git a/lp_solve/ccc b/lp_solve/ccc
+index 9b79cea7ee71536c..b1f761aab33345d4 100644
+--- a/lp_solve/ccc
++++ b/lp_solve/ccc
+@@ -6,7 +6,7 @@ c=$CC
+ >/tmp/platform.c
+ echo '#include <stdlib.h>'>>/tmp/platform.c
+ echo '#include <stdio.h>'>>/tmp/platform.c
+-echo 'main(){printf("ux%d", (int) (sizeof(void *)*8));}'>>/tmp/platform.c
++echo 'int main(){printf("ux%d", (int) (sizeof(void *)*8));}'>>/tmp/platform.c
+ $c /tmp/platform.c -o /tmp/platform
+ PLATFORM=`/tmp/platform`
+ rm /tmp/platform /tmp/platform.c >/dev/null 2>&1
+@@ -20,7 +20,7 @@ math=-lm
+ echo '#include <stdio.h>'>>/tmp/isnan.c
+ echo '#include <stdlib.h>'>>/tmp/isnan.c
+ echo '#include <math.h>'>>/tmp/isnan.c
+-echo 'main(){isnan(0.0);}'>>/tmp/isnan.c
++echo 'int main(){isnan(0.0);}'>>/tmp/isnan.c
+ $c /tmp/isnan.c -o /tmp/isnan $math >/dev/null 2>&1
+ if [ $? = 0 ]
+ then NOISNAN=
+diff --git a/lpsolve55/ccc b/lpsolve55/ccc
+index 0470611bc45a851c..ca350f257add7730 100644
+--- a/lpsolve55/ccc
++++ b/lpsolve55/ccc
+@@ -6,7 +6,7 @@ c=$CC
+ >/tmp/platform.c
+ echo '#include <stdlib.h>'>>/tmp/platform.c
+ echo '#include <stdio.h>'>>/tmp/platform.c
+-echo 'main(){printf("ux%d", (int) (sizeof(void *)*8));}'>>/tmp/platform.c
++echo 'int main(){printf("ux%d", (int) (sizeof(void *)*8));}'>>/tmp/platform.c
+ $c /tmp/platform.c -o /tmp/platform
+ PLATFORM=`/tmp/platform`
+ rm /tmp/platform /tmp/platform.c >/dev/null 2>&1
+@@ -18,7 +18,7 @@ mkdir bin bin/$PLATFORM >/dev/null 2>&1
+ echo '#include <stdio.h>'>>/tmp/isnan.c
+ echo '#include <stdlib.h>'>>/tmp/isnan.c
+ echo '#include <math.h>'>>/tmp/isnan.c
+-echo 'main(){isnan(0.0);}'>>/tmp/isnan.c
++echo 'int main(){isnan(0.0);}'>>/tmp/isnan.c
+ $c /tmp/isnan.c -o /tmp/isnan $math >/dev/null 2>&1
+ if [ $? = 0 ]
+ then NOISNAN=
diff --git a/lpsolve.spec b/lpsolve.spec
new file mode 100644
index 0000000..a4f1d17
--- /dev/null
+++ b/lpsolve.spec
@@ -0,0 +1,70 @@
+Name: lpsolve
+Summary: A Mixed Integer Linear Programming (MILP) solver
+Version: 5.5.2.0
+Release: 1
+Source: http://downloads.sourceforge.net/lpsolve/lp_solve_%{version}_source.tar.gz
+URL: http://sourceforge.net/projects/lpsolve
+License: LGPLv2+
+
+BuildRequires: gcc-c++
+
+Patch0: lpsolve-5.5.0.11.cflags.patch
+Patch1: lpsolve-5.5.2.0.defines.patch
+Patch2: lpsolve-ccc-c99.patch
+
+%description
+Mixed Integer Linear Programming (MILP) solver lpsolve solves pure linear,
+(mixed) integer/binary, semi-continuous and special ordered sets (SOS) models.
+
+%package devel
+Requires: %{name}%{?_isa} = %{version}-%{release}
+Summary: Files for developing with lpsolve
+
+%description devel
+Includes and definitions for developing with lpsolve
+
+%prep
+%setup -q -n lp_solve_5.5
+%patch0 -p1 -b .cflags.patch
+%patch1 -p1 -b .defines.patch
+%patch2 -p1 -b .ccc-c99.patch
+
+%build
+%set_build_flags
+cd lpsolve55
+# fix for obs
+mkdir -p tmp
+sed -i "s#/tmp#tmp#g" ccc
+# end fix for obs
+sh -x ccc
+rm bin/ux*/liblpsolve55.a
+cd ../lp_solve
+# fix for obs
+mkdir -p tmp
+sed -i "s#/tmp#tmp#g" ccc
+# end fix for obs
+sh -x ccc
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT%{_bindir} $RPM_BUILD_ROOT%{_libdir} $RPM_BUILD_ROOT%{_includedir}/lpsolve
+install -p -m 755 \
+ lp_solve/bin/ux*/lp_solve $RPM_BUILD_ROOT%{_bindir}
+install -p -m 755 \
+ lpsolve55/bin/ux*/liblpsolve55.so $RPM_BUILD_ROOT%{_libdir}
+install -p -m 644 \
+ lp*.h $RPM_BUILD_ROOT%{_includedir}/lpsolve
+
+%ldconfig_scriptlets
+
+%files
+%doc README.txt ./bfp/bfp_LUSOL/LUSOL/LUSOL_LGPL.txt ./bfp/bfp_LUSOL/LUSOL/LUSOL_README.txt ./bfp/bfp_LUSOL/LUSOL/LUSOL-overview.txt
+%{_bindir}/lp_solve
+%{_libdir}/*.so
+
+%files devel
+%{_includedir}/lpsolve
+
+%changelog
+* Wed Sep 06 2023 Darssin <2020303249@mail.nwpu.edu.cn> - 5.5.2.0-1
+- Package init
diff --git a/sources b/sources
new file mode 100644
index 0000000..0df0a76
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+167c0fb4ab178e0b7ab50bf0a635a836 lp_solve_5.5.2.0_source.tar.gz