Skip to content

Commit

Permalink
new package: lpsolve
Browse files Browse the repository at this point in the history
  • Loading branch information
knyipab authored and licy183 committed Sep 15, 2024
1 parent 882839d commit dda4112
Show file tree
Hide file tree
Showing 3 changed files with 413 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tur-on-device/lpsolve/0001-timeb.h.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
diff --git a/lp_utils.c b/lp_utils.c
index 418f7c8..fa7480d 100644
--- a/lp_utils.c
+++ b/lp_utils.c
@@ -5,7 +5,9 @@
#include "lp_lib.h"
#include "lp_utils.h"
#include <time.h>
+#ifndef __ANDROID__
#include <sys/timeb.h>
+#endif
#include "lp_bit.h"

#ifdef FORTIFY
diff --git a/shared/commonlib.c b/shared/commonlib.c
index 5ab4f12..137eb3a 100644
--- a/shared/commonlib.c
+++ b/shared/commonlib.c
@@ -5,6 +5,8 @@
# include <time.h>
#elif defined EnhTime
# include <windows.h>
+#elif defined(__ANDROID__)
+#include <sys/time.h>
#else
#include <sys/timeb.h>
#endif
@@ -843,6 +845,12 @@
timeBase = clockNow() - (double) now.QuadPart/(double) freq.QuadPart;
}
return( timeBase + (double) now.QuadPart/(double) freq.QuadPart );
+#elif defined(__ANDROID__)
+ struct timeval tv;
+ struct timezone tz;
+
+ gettimeofday(&tv, &tz);
+ return((double)tv.tv_sec+((double)tv.tv_usec)/1000000.0);
#else
struct timeb buf;

38 changes: 38 additions & 0 deletions tur-on-device/lpsolve/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
TERMUX_PKG_HOMEPAGE=http://lpsolve.sourceforge.net/
TERMUX_PKG_DESCRIPTION="a Mixed Integer Linear Programming (MILP) solver"
TERMUX_PKG_LICENSE="LGPL-2.1"
TERMUX_PKG_MAINTAINER="@termux-user-repository"
TERMUX_PKG_VERSION=5.5.2.11
TERMUX_PKG_SRCURL=https://downloads.sourceforge.net/project/lpsolve/lpsolve/${TERMUX_PKG_VERSION}/lp_solve_${TERMUX_PKG_VERSION}_source.tar.gz
TERMUX_PKG_SHA256=6d4abff5cc6aaa933ae8e6c17a226df0fc0b671c438f69715d41d09fe81f902f
TERMUX_PKG_BUILD_IN_SRC=true

termux_step_pre_configure() {
if [ "${TERMUX_ON_DEVICE_BUILD}" = false ]; then
termux_error_exit "This package doesn't support cross-compiling."
fi
}

termux_step_configure() {
:
}

termux_step_make() {
cd lpsolve55
sh -x ccc
rm bin/ux*/liblpsolve55.a

cd ../lp_solve
sh -x ccc
cd .
}


termux_step_make_install() {
install -dm755 "$TERMUX_PREFIX"/{bin,lib,include/lpsolve}
install -m755 lp_solve/bin/ux*/lp_solve "$TERMUX_PREFIX"/bin/
install -m755 lpsolve55/bin/ux*/liblpsolve55.so "$TERMUX_PREFIX"/lib/
install -m644 lp*.h "$TERMUX_PREFIX"/include/lpsolve/

install -D -m644 README.txt -t "$TERMUX_PREFIX/share/licenses/$TERMUX_PKG_NAME/"
}
Loading

0 comments on commit dda4112

Please sign in to comment.