1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-23 00:43:28 +00:00

math/lp_solve: respect TMPDIR environment variable

Some People (TM) are using non-executable /tmp on their machines.
The ccc utility from the port tries to run compiled executables
from /tmp, so this fails and port installation does not work.

It is always good to respect TMPDIR and this patch does just that.

PR: 154503
Feature safe: yes
Approved by: garga (mentor)
This commit is contained in:
Eygene Ryabinkin 2011-03-04 15:13:44 +00:00
parent a6a942e42e
commit 72f6d3c480
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=270300
2 changed files with 105 additions and 3 deletions

View File

@ -19,6 +19,10 @@ WRKSRC= ${WRKDIR}/${PORTNAME}_${PORTVERSION:R:R}
USE_LDCONFIG= yes
.if defined(TMPDIR)
BUILDENV= ${ENV} TMPDIR="${TMPDIR}"
.endif
.include <bsd.port.pre.mk>
.if ${ARCH} == "i386"
@ -39,9 +43,9 @@ post-patch:
s|-ldl||g"
do-build:
cd ${WRKSRC}/lp_solve ; ${SH} -x ccc
cd ${WRKSRC}/demo ; ${SH} -x ccc
cd ${WRKSRC}/lpsolve55 ; ${SH} -x ccc
cd ${WRKSRC}/lp_solve ; ${BUILDENV} ${SH} -x ccc
cd ${WRKSRC}/demo ; ${BUILDENV} ${SH} -x ccc
cd ${WRKSRC}/lpsolve55 ; ${BUILDENV} ${SH} -x ccc
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/lp_solve/bin/${LPSOLVE_ARCH}/lp_solve ${PREFIX}/bin

View File

@ -0,0 +1,98 @@
--- lp_solve/ccc.orig 2009-01-25 21:39:03.000000000 +0300
+++ lp_solve/ccc 2011-02-04 10:52:07.000000000 +0300
@@ -2,31 +2,33 @@
src='../lp_MDO.c ../shared/commonlib.c ../colamd/colamd.c ../shared/mmio.c ../shared/myblas.c ../ini.c ../fortify.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_solve.c ../lp_SOS.c ../lp_utils.c ../yacc_read.c'
c=cc
+tmp="${TMPDIR:-/tmp}"
+
#determine platform (32/64 bit)
->/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
-$c /tmp/platform.c -o /tmp/platform
-PLATFORM=`/tmp/platform`
-rm /tmp/platform /tmp/platform.c >/dev/null 2>&1
+>"${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
+$c "${tmp}"/platform.c -o "${tmp}"/platform
+PLATFORM=`"${tmp}"/platform`
+rm "${tmp}"/platform "${tmp}"/platform.c >/dev/null 2>&1
mkdir bin bin/$PLATFORM >/dev/null 2>&1
math=-lm
#check if this system has the isnan function
->/tmp/isnan.c
-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
-$c /tmp/isnan.c -o /tmp/isnan $math >/dev/null 2>&1
+>"${tmp}"/isnan.c
+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
+$c "${tmp}"/isnan.c -o "${tmp}"/isnan $math >/dev/null 2>&1
if [ $? = 0 ]
then NOISNAN=
else NOISNAN=-DNOISNAN
fi
-rm /tmp/isnan.c /tmp/isnan >/dev/null 2>&1
+rm "${tmp}"/isnan.c "${tmp}"/isnan >/dev/null 2>&1
opts='-O3'
--- lpsolve55/ccc.bak 2009-03-25 03:27:18.000000000 +0300
+++ lpsolve55/ccc 2011-02-04 11:00:40.000000000 +0300
@@ -2,29 +2,31 @@
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
+tmp="${TMPDIR:-/tmp}"
+
#determine platform (32/64 bit)
->/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
-$c /tmp/platform.c -o /tmp/platform
-PLATFORM=`/tmp/platform`
-rm /tmp/platform /tmp/platform.c >/dev/null 2>&1
+>"${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
+$c "${tmp}"/platform.c -o "${tmp}"/platform
+PLATFORM=`"${tmp}"/platform`
+rm "${tmp}"/platform "${tmp}"/platform.c >/dev/null 2>&1
mkdir bin bin/$PLATFORM >/dev/null 2>&1
#check if this system has the isnan function
->/tmp/isnan.c
-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
-$c /tmp/isnan.c -o /tmp/isnan $math >/dev/null 2>&1
+>"${tmp}"/isnan.c
+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
+$c "${tmp}"/isnan.c -o "${tmp}"/isnan $math >/dev/null 2>&1
if [ $? = 0 ]
then NOISNAN=
else NOISNAN=-DNOISNAN
fi
-rm /tmp/isnan.c /tmp/isnan >/dev/null 2>&1
+rm "${tmp}"/isnan.c "${tmp}"/isnan >/dev/null 2>&1
def=
so=