summaryrefslogtreecommitdiffstats
path: root/external/lpsolve
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--external/lpsolve/ExternalPackage_lpsolve.mk24
-rw-r--r--external/lpsolve/ExternalProject_lpsolve.mk37
-rw-r--r--external/lpsolve/Makefile7
-rw-r--r--external/lpsolve/Module_lpsolve.mk18
-rw-r--r--external/lpsolve/README1
-rw-r--r--external/lpsolve/UnpackedTarball_lpsolve.mk37
-rw-r--r--external/lpsolve/ccc.static11
-rw-r--r--external/lpsolve/lp_solve-aix.patch39
-rw-r--r--external/lpsolve/lp_solve-fixed-warn.patch84
-rw-r--r--external/lpsolve/lp_solve_5.5-windows.patch60
-rw-r--r--external/lpsolve/lp_solve_5.5.patch95
-rw-r--r--external/lpsolve/lpsolve-ubsan.patch.022
12 files changed, 435 insertions, 0 deletions
diff --git a/external/lpsolve/ExternalPackage_lpsolve.mk b/external/lpsolve/ExternalPackage_lpsolve.mk
new file mode 100644
index 000000000..23c2c5abf
--- /dev/null
+++ b/external/lpsolve/ExternalPackage_lpsolve.mk
@@ -0,0 +1,24 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalPackage_ExternalPackage,lpsolve,lpsolve))
+
+$(eval $(call gb_ExternalPackage_use_external_project,lpsolve,lpsolve))
+
+ifneq ($(DISABLE_DYNLOADING),TRUE)
+ifeq ($(OS),WNT)
+$(eval $(call gb_ExternalPackage_add_file,lpsolve,$(LIBO_LIB_FOLDER)/lpsolve55.dll,lpsolve55/lpsolve55.dll))
+else ifeq ($(OS),MACOSX)
+$(eval $(call gb_ExternalPackage_add_file,lpsolve,$(LIBO_LIB_FOLDER)/liblpsolve55.dylib,lpsolve55/liblpsolve55.dylib))
+else # $(OS) != WNT/MACOSX
+$(eval $(call gb_ExternalPackage_add_file,lpsolve,$(LIBO_LIB_FOLDER)/liblpsolve55.so,lpsolve55/liblpsolve55.so))
+endif # $(OS)
+endif # $(DISABLE_DYNLOADING)
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/lpsolve/ExternalProject_lpsolve.mk b/external/lpsolve/ExternalProject_lpsolve.mk
new file mode 100644
index 000000000..7b5338b24
--- /dev/null
+++ b/external/lpsolve/ExternalProject_lpsolve.mk
@@ -0,0 +1,37 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalProject_ExternalProject,lpsolve))
+
+$(eval $(call gb_ExternalProject_register_targets,lpsolve,\
+ build \
+))
+
+ifeq ($(OS),WNT)
+$(call gb_ExternalProject_get_state_target,lpsolve,build):
+ $(call gb_Trace_StartRange,lpsolve,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ LIB="$(ILIB)" RUNTIME_FLAG="$(if $(MSVC_USE_DEBUG_RUNTIME),/MDd,/MD)" \
+ cmd /c cvc6.bat \
+ ,lpsolve55)
+ $(call gb_Trace_EndRange,lpsolve,EXTERNAL)
+else # $(OS)!=WNT
+$(call gb_ExternalProject_get_state_target,lpsolve,build):
+ $(call gb_Trace_StartRange,lpsolve,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ CC="$(CC) $(call gb_ExternalProject_get_build_flags,lpsolve)" \
+ $(if $(filter MACOSX,$(OS)),EXTRA_LINKFLAGS='-install_name @__________________________________________________OOO/liblpsolve55.dylib') \
+ sh -e $(if $(filter MACOSX,$(OS)),ccc.osx, \
+ $(if $(filter TRUE,$(DISABLE_DYNLOADING)),ccc.static, \
+ $(if $(filter AIXGCC,$(OS)$(COM)),ccc.aix.gcc, \
+ ccc))) \
+ ,lpsolve55)
+ $(call gb_Trace_EndRange,lpsolve,EXTERNAL)
+endif # $(OS)
+# vim: set noet sw=4 ts=4:
diff --git a/external/lpsolve/Makefile b/external/lpsolve/Makefile
new file mode 100644
index 000000000..e4968cf85
--- /dev/null
+++ b/external/lpsolve/Makefile
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/lpsolve/Module_lpsolve.mk b/external/lpsolve/Module_lpsolve.mk
new file mode 100644
index 000000000..e0094f609
--- /dev/null
+++ b/external/lpsolve/Module_lpsolve.mk
@@ -0,0 +1,18 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Module_Module,lpsolve))
+
+$(eval $(call gb_Module_add_targets,lpsolve,\
+ UnpackedTarball_lpsolve \
+ ExternalPackage_lpsolve \
+ ExternalProject_lpsolve \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/lpsolve/README b/external/lpsolve/README
new file mode 100644
index 000000000..3ef9db3e1
--- /dev/null
+++ b/external/lpsolve/README
@@ -0,0 +1 @@
+A mixed Integer Linear Programming (MILP) solver from [http://lpsolve.sourceforge.net/].
diff --git a/external/lpsolve/UnpackedTarball_lpsolve.mk b/external/lpsolve/UnpackedTarball_lpsolve.mk
new file mode 100644
index 000000000..3d17c0e9b
--- /dev/null
+++ b/external/lpsolve/UnpackedTarball_lpsolve.mk
@@ -0,0 +1,37 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_UnpackedTarball_UnpackedTarball,lpsolve))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,lpsolve,$(LPSOLVE_TARBALL)))
+
+$(eval $(call gb_UnpackedTarball_set_patchlevel,lpsolve,3))
+
+ifeq ($(OS_FOR_BUILD),WNT)
+
+$(eval $(call gb_UnpackedTarball_set_patchflags,lpsolve,--binary))
+$(eval $(call gb_UnpackedTarball_add_patches,lpsolve,\
+ external/lpsolve/lp_solve_5.5-windows.patch \
+))
+
+else
+
+$(eval $(call gb_UnpackedTarball_add_patches,lpsolve,\
+ external/lpsolve/lp_solve-aix.patch \
+ external/lpsolve/lp_solve-fixed-warn.patch \
+ external/lpsolve/lp_solve_5.5.patch \
+ external/lpsolve/lpsolve-ubsan.patch.0 \
+))
+
+$(eval $(call gb_UnpackedTarball_add_file,lpsolve,lpsolve55/ccc.static,external/lpsolve/ccc.static))
+
+endif
+# vim: set noet sw=4 ts=4:
+
+
diff --git a/external/lpsolve/ccc.static b/external/lpsolve/ccc.static
new file mode 100644
index 000000000..6911c4b2c
--- /dev/null
+++ b/external/lpsolve/ccc.static
@@ -0,0 +1,11 @@
+src='../lp_MDO.c ../shared/commonlib.c ../shared/mmio.c ../shared/myblas.c ../ini.c ../fortify.c ../colamd/colamd.c ../lp_rlp.c ../lp_crash.c ../bfp/bfp_LUSOL/lp_LUSOL.c ../bfp/bfp_LUSOL/LUSOL/lusol.c ../lp_Hash.c ../lp_lib.c ../lp_wlp.c ../lp_matrix.c ../lp_mipbb.c ../lp_MPS.c ../lp_params.c ../lp_presolve.c ../lp_price.c ../lp_pricePSE.c ../lp_report.c ../lp_scale.c ../lp_simplex.c ../lp_SOS.c ../lp_utils.c ../yacc_read.c'
+obj=`echo $src|sed -e 's/\.c/.o/g' -e 's!\([^ ]*/\)*!!g'`
+
+opts='-O3'
+
+def=
+
+$CC -I.. -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd -I../shared $opts $def -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c $src
+
+$AR -r liblpsolve55.a $obj
+rm $obj
diff --git a/external/lpsolve/lp_solve-aix.patch b/external/lpsolve/lp_solve-aix.patch
new file mode 100644
index 000000000..6ad5877ca
--- /dev/null
+++ b/external/lpsolve/lp_solve-aix.patch
@@ -0,0 +1,39 @@
+--- /dev/null 2010-07-28 04:47:47.000000000 -0500
++++ misc/build/lp_solve_5.5/lpsolve55/ccc.aix.gcc 2010-06-29 17:44:53.000000000 -0500
+@@ -0,0 +1,25 @@
++src='../lp_MDO.c ../shared/commonlib.c ../shared/mmio.c ../shared/myblas.c ../ini.c ../fortify.c ../colamd/colamd.c ../lp_rlp.c ../lp_crash.c ../bfp/bfp_LUSOL/lp_LUSOL.c ../bfp/bfp_LUSOL/LUSOL/lusol.c ../lp_Hash.c ../lp_lib.c ../lp_wlp.c ../lp_matrix.c ../lp_mipbb.c ../lp_MPS.c ../lp_params.c ../lp_presolve.c ../lp_price.c ../lp_pricePSE.c ../lp_report.c ../lp_scale.c ../lp_simplex.c ../lp_SOS.c ../lp_utils.c ../yacc_read.c'
++c=$CC
++
++def=
++so=
++if [ "$PLATFORM" = "SCO_UNIX" ]
++then def='-dy -K PIC -DNOLONGLONG'
++ dl=-lc
++else dl=-ldl
++ 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 -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
++ar rv liblpsolve55.a `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'`
++ranlib 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 -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
++ $c -shared $lpsolve_LDFLAGS -o liblpsolve55.so `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'` -lc -lm -ldl
++fi
++
++rm *.o 2>/dev/null
+--- misc/lp_solve_5.5/lp_lib.h 2010-07-28 05:15:10.000000000 -0500
++++ misc/build/lp_solve_5.5/lp_lib.h 2010-07-28 05:15:55.000000000 -0500
+@@ -56,7 +56,7 @@
+ /* Define user program feature option switches */
+ /* ------------------------------------------------------------------------- */
+
+-#if !defined _WINDOWS && !defined _WIN32 && !defined WIN32
++#if !defined _WINDOWS && !defined _WIN32 && !defined WIN32 && !defined(_AIX)
+ # define _isnan(x) FALSE
+ #endif
+
diff --git a/external/lpsolve/lp_solve-fixed-warn.patch b/external/lpsolve/lp_solve-fixed-warn.patch
new file mode 100644
index 000000000..46742887a
--- /dev/null
+++ b/external/lpsolve/lp_solve-fixed-warn.patch
@@ -0,0 +1,84 @@
+--- misc/build/lp_solve_5.5/lp_report.c 2007-01-14 10:31:34.000000000 -0800
++++ misc/build/lp_solve_5.5/lp_report.c 2007-01-14 10:31:34.000000000 -0800
+@@ -160,7 +160,7 @@
+ {
+ int i, k = 0;
+
+- fprintf(output, label);
++ fputs(label, output);
+ fprintf(output, "\n");
+ for(i = first; i <= last; i++) {
+ fprintf(output, " %18g", vector[i]);
+@@ -189,7 +189,7 @@
+ if(last < 0)
+ last = lp->rows;
+
+- fprintf(output, label);
++ fputs(label, output);
+ fprintf(output, "\n");
+
+ if(first == 0) {
+@@ -254,7 +254,7 @@
+ if(last < 0)
+ last = lp->rows;
+
+- fprintf(output, label);
++ fputs(label, output);
+ fprintf(output, "\n");
+
+ for(i = first; i <= last; i++) {
+--- misc/build/lp_solve_5.5/lp_rlp.h 2007-01-14 10:31:52.000000000 -0800
++++ misc/build/lp_solve_5.5/lp_rlp.h 2007-01-14 10:31:52.000000000 -0800
+@@ -615,7 +615,7 @@
+ /* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+-#define ECHO (void) fwrite( lp_yytext, lp_yyleng, 1, lp_yyout )
++#define ECHO if(fwrite( lp_yytext, lp_yyleng, 1, lp_yyout ) != 1) YY_FATAL_ERROR( "can't write into lp_yytext" )
+ #endif
+
+ /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+--- misc/build/lp_solve_5.5/shared/commonlib.c 2007-01-14 10:33:14.000000000 -0800
++++ misc/build/lp_solve_5.5/shared/commonlib.c 2007-01-14 10:33:14.000000000 -0800
+@@ -715,7 +715,7 @@
+ {
+ int i, k = 0;
+
+- fprintf(output, label);
++ fputs(label, output);
+ fprintf(output, "\n");
+ for(i = first; i <= last; i++) {
+ fprintf(output, " %5d", myvector[i]);
+@@ -734,7 +734,7 @@
+ {
+ int i, k = 0;
+
+- fprintf(output, label);
++ fputs(label, output);
+ fprintf(output, "\n");
+ for(i = first; i <= last; i++) {
+ if(asRaw)
+@@ -756,7 +756,7 @@
+ {
+ int i, k = 0;
+
+- fprintf(output, label);
++ fputs(label, output);
+ fprintf(output, "\n");
+ for(i = first; i <= last; i++) {
+ fprintf(output, " %18g", myvector[i]);
+--- misc/build/lp_solve_5.5/shared/mmio.c 2007-01-14 10:33:14.000000000 -0800
++++ misc/build/lp_solve_5.5/shared/mmio.c 2007-01-14 10:33:14.000000000 -0800
+@@ -74,7 +74,11 @@
+
+ for (i=0; i<nz; i++)
+ {
+- fscanf(f, "%d %d %lg\n", &I[i], &J[i], &val[i]);
++ if(fscanf(f, "%d %d %lg\n", &I[i], &J[i], &val[i]) != 3)
++ {
++ fprintf(stderr, "read_unsymmetric_sparse(): could not parse values.\n");
++ return -1;
++ }
+ I[i]--; /* adjust from 1-based to 0-based */
+ J[i]--;
+ }
diff --git a/external/lpsolve/lp_solve_5.5-windows.patch b/external/lpsolve/lp_solve_5.5-windows.patch
new file mode 100644
index 000000000..16d5261c7
--- /dev/null
+++ b/external/lpsolve/lp_solve_5.5-windows.patch
@@ -0,0 +1,60 @@
+*** misc/lp_solve_5.5/lpsolve55/cgcc.bat Sun Jun 12 04:27:28 2005
+--- misc/build/lp_solve_5.5/lpsolve55/cgcc.bat Sun Dec 14 07:55:19 2008
+***************
+*** 7,14 ****
+
+ set c=gcc
+
+! rem rc lpsolve.rc
+! %c% -DINLINE=static -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd -s -O3 -shared -mno-cygwin -enable-stdcall-fixup -D_USRDLL -DWIN32 -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine %src% ..\lp_solve.def -o lpsolve55.dll
+
+ %c% -DINLINE=static -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd -s -O3 -shared -D_USRDLL -DWIN32 -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine %src% -o liblpsolve55.so
+
+--- 7,14 ----
+
+ set c=gcc
+
+! windres lpsolve.rc lpsolve_res.obj
+! %c% -DINLINE=static -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd -s -O3 -shared -mno-cygwin -enable-stdcall-fixup -mthreads %lpsolve_LDFLAGS% -D_USRDLL -DWIN32 -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine %src% lpsolve_res.obj ..\lp_solve.def %lpsolve_LIBS% -o lpsolve55.dll
+
+ %c% -DINLINE=static -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd -s -O3 -shared -D_USRDLL -DWIN32 -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine %src% -o liblpsolve55.so
+
+*** misc/lp_solve_5.5/lpsolve55/lpsolve.rc Sun Jun 4 00:15:24 2006
+--- misc/build/lp_solve_5.5/lpsolve55/lpsolve.rc Fri Nov 23 16:34:22 2007
+***************
+*** 7,13 ****
+ //
+ // Generated from the TEXTINCLUDE 2 resource.
+ //
+! #include "afxres.h"
+
+ /////////////////////////////////////////////////////////////////////////////
+ #undef APSTUDIO_READONLY_SYMBOLS
+--- 7,13 ----
+ //
+ // Generated from the TEXTINCLUDE 2 resource.
+ //
+! #include "winresrc.h"
+
+ /////////////////////////////////////////////////////////////////////////////
+ #undef APSTUDIO_READONLY_SYMBOLS
+--- misc/lp_solve_5.5/lpsolve55/cvc6.bat
++++ misc/build/lp_solve_5.5/lpsolve55/cvc6.bat
+@@ -14,15 +14,4 @@
+ set c=cl
+
+-rc lpsolve.rc
++rc %SOLARINC% lpsolve.rc
+-%c% -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd /LD /MD /O1 /Zp8 /Gz -D_WINDLL -D_USRDLL -DWIN32 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine %src% lpsolve.res ..\lp_solve.def -o lpsolve55.dll
++%c% -Zi -FS -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd %SOLARINC% /LD %RUNTIME_FLAG% /O1 /Zp8 /Gz -D_WINDLL -D_USRDLL -DWIN32 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine %src% lpsolve.res ..\lp_solve.def -Felpsolve55.dll
+-rem /link /LINK50COMPAT
+-
+-if exist a.obj del a.obj
+-%c% -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd /MT /O1 /Zp8 /Gd /c -DWIN32 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine %src%
+-lib *.obj /OUT:liblpsolve55.lib
+-
+-if exist a.obj del a.obj
+-%c% -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd /MTd /O1 /Zp8 /Gd /c -DWIN32 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine %src%
+-lib *.obj /OUT:liblpsolve55d.lib
+-
+-if exist *.obj del *.obj
diff --git a/external/lpsolve/lp_solve_5.5.patch b/external/lpsolve/lp_solve_5.5.patch
new file mode 100644
index 000000000..2b2588a9f
--- /dev/null
+++ b/external/lpsolve/lp_solve_5.5.patch
@@ -0,0 +1,95 @@
+--- misc/build/lp_solve_5.5/lpsolve55/ccc.orig Sat Jun 11 21:27:18 2005
++++ misc/build/lp_solve_5.5/lpsolve55/ccc Sun May 22 11:20:19 2011
+@@ -1,25 +1,42 @@
+ src='../lp_MDO.c ../shared/commonlib.c ../shared/mmio.c ../shared/myblas.c ../ini.c ../fortify.c ../colamd/colamd.c ../lp_rlp.c ../lp_crash.c ../bfp/bfp_LUSOL/lp_LUSOL.c ../bfp/bfp_LUSOL/LUSOL/lusol.c ../lp_Hash.c ../lp_lib.c ../lp_wlp.c ../lp_matrix.c ../lp_mipbb.c ../lp_MPS.c ../lp_params.c ../lp_presolve.c ../lp_price.c ../lp_pricePSE.c ../lp_report.c ../lp_scale.c ../lp_simplex.c ../lp_SOS.c ../lp_utils.c ../yacc_read.c'
+-c=cc
++ar=$AR
++c=$CC
++ranlib=$RANLIB
+
+ def=
+ so=
+-if [ "$PLATFORM" = "SCO_UNIX" ]
+-then def='-dy -K PIC -DNOLONGLONG'
+- dl=-lc
+-else dl=-ldl
+- so=y
++soprefix=
++libs=
++pic=
++ldflags=
++inline=
++if [ "$OS" = "WNT" -a "$COM" = "GCC" ]; then
++ so=dll
++ a=dll.a
++ inline=-DINLINE=static
++else
++ so=so
++ a=a
++ soprefix=lib
++ libs="-lm"
++ pic=-fpic
++ ldflags="-Wl,-Bsymbolic -Wl,-soname,liblpsolve55.$so"
+ fi
+
++if [ "$OS" = "LINUX" ]; then
++ libs="$libs -ldl"
++fi
++
+ opts='-O3'
+
+-$c -s -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd $opts $def -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
++$c -s $inline -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd $opts $def -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
+-ar rv liblpsolve55.a `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'`
+-ranlib liblpsolve55.a
++$ar rv liblpsolve55.$a `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'`
++$ranlib 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 -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
+- $c -shared -Wl,-Bsymbolic -Wl,-soname,liblpsolve55.so -o liblpsolve55.so `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'` -lc -lm -ldl
++ $c $pic -s $inline -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd -I. $opts -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
++ $c -shared $ldflags -o ${soprefix}lpsolve55.$so `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'` $libs
+ fi
+
+ rm *.o 2>/dev/null
+--- misc/build/lp_solve_5.5/lpsolve55/ccc.osx.orig Thu Jun 23 22:53:08 2005
++++ misc/build/lp_solve_5.5/lpsolve55/ccc.osx
+@@ -1,23 +1,30 @@
+ src='../lp_MDO.c ../shared/commonlib.c ../shared/mmio.c ../shared/myblas.c ../ini.c ../fortify.c ../colamd/colamd.c ../lp_rlp.c ../lp_crash.c ../bfp/bfp_LUSOL/lp_LUSOL.c ../bfp/bfp_LUSOL/LUSOL/lusol.c ../lp_Hash.c ../lp_lib.c ../lp_wlp.c ../lp_matrix.c ../lp_mipbb.c ../lp_MPS.c ../lp_params.c ../lp_presolve.c ../lp_price.c ../lp_pricePSE.c ../lp_report.c ../lp_scale.c ../lp_simplex.c ../lp_SOS.c ../lp_utils.c ../yacc_read.c'
+-c=cc
++c=$CC
+
++if test -n "$verbose"; then
++ set -x
++fi
++
+ def=
+ so=
++# EXTRA_LINKFLAGS is set in the ExternalProject_lpsolve.mk
++extra_linkflags=$EXTRA_LINKFLAGS
++
+ if [ "$PLATFORM" = "SCO_UNIX" ]
+ then def='-DLoadInverseLib=0 -DLoadLanguageLib=0 -D__HYPER=long'
+ else dl=-ldl
+ so=y
+ fi
+
+-opts='-idirafter /usr/include/sys -O3 -DINTEGERTIME -Wno-long-double'
++opts='-idirafter /usr/include/sys -O3 -DINTEGERTIME'
+
+-$c -s -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd $opts $def -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
++$c -s -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd $opts $def -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
+-libtool -static -o liblpsolve55.a `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'`
++$LIBTOOL -static -o liblpsolve55.a `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'`
+
+ if [ "$so" != "" ]
+ then
+- $c -fPIC -fno-common -s -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd -I. $opts -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
+- $c -dynamiclib liblpsolve55.a -compatibility_version 5.5.0 -current_version 5.5.0 -o liblpsolve55.dylib `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'` -lc
++ $c -fPIC -fno-common -s -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd -I. $opts -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
++ $c $extra_linkflags -dynamiclib liblpsolve55.a -compatibility_version 5.5.0 -current_version 5.5.0 -o liblpsolve55.dylib `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'` -lc
+ fi
+
+ rm *.o 2>/dev/null
diff --git a/external/lpsolve/lpsolve-ubsan.patch.0 b/external/lpsolve/lpsolve-ubsan.patch.0
new file mode 100644
index 000000000..7a5e308c6
--- /dev/null
+++ b/external/lpsolve/lpsolve-ubsan.patch.0
@@ -0,0 +1,22 @@
+--- lp_presolve.c
++++ lp_presolve.c
+@@ -168,7 +168,7 @@
+ if(isprimal) {
+ if(psdata->primalundo != NULL)
+ mat = psdata->primalundo->tracker;
+- solution = lp->full_solution + lp->presolve_undo->orig_rows;
++ solution = lp->full_solution == NULL ? NULL : lp->full_solution + lp->presolve_undo->orig_rows;
+ slacks = lp->full_solution;
+ }
+ else {
+--- lp_pricePSE.c
++++ lp_pricePSE.c
+@@ -145,7 +147,7 @@
+
+ /* Store the active/current pricing type */
+ if(isdual == AUTOMATIC)
+- isdual = (MYBOOL) lp->edgeVector[0];
++ isdual = lp->edgeVector[0] != 0.0;
+ else
+ lp->edgeVector[0] = isdual;
+