aboutsummaryrefslogtreecommitdiffstats
path: root/math
diff options
context:
space:
mode:
authorbf <bf@FreeBSD.org>2012-07-11 05:28:22 +0800
committerbf <bf@FreeBSD.org>2012-07-11 05:28:22 +0800
commit90de10d5f5d048f8e7832c201981661c0dd0ae48 (patch)
treec147d11fff1f08e8694b016fadc6767f3a4d4e6a /math
parent1b6781ad5a932da6f0827b41c97b6ea419af2b8b (diff)
downloadfreebsd-ports-gnome-90de10d5f5d048f8e7832c201981661c0dd0ae48.tar.gz
freebsd-ports-gnome-90de10d5f5d048f8e7832c201981661c0dd0ae48.tar.zst
freebsd-ports-gnome-90de10d5f5d048f8e7832c201981661c0dd0ae48.zip
fix library search paths and switch from the legacy ftime() to
gettimeofday() in order to solve problems with the construction of shared libraries [1] ; configure only once; build only those (dynamically-linked) executables that will be installed; set USE_LDCONFIG; remove an unnecessary patch; don't mix toolchains; make flags more uniform and remove obsolete flags; add test targets PR: 159189 [1] Submitted by: stephen (different version) [1]
Diffstat (limited to 'math')
-rw-r--r--math/taucs/Makefile95
-rw-r--r--math/taucs/files/extra-patch-build-FreeBSD-makefile11
-rw-r--r--math/taucs/files/patch-config+FreeBSD.mk36
-rw-r--r--math/taucs/files/patch-src__taucs_timer.c50
-rw-r--r--math/taucs/pkg-plist1
5 files changed, 132 insertions, 61 deletions
diff --git a/math/taucs/Makefile b/math/taucs/Makefile
index e107f36b9643..2499ea0bf59f 100644
--- a/math/taucs/Makefile
+++ b/math/taucs/Makefile
@@ -7,9 +7,10 @@
PORTNAME= taucs
PORTVERSION= 2.2
-PORTREVISION= 8
+PORTREVISION= 9
CATEGORIES= math
-MASTER_SITES= http://www.tau.ac.il/~stoledo/taucs/${PORTVERSION}/
+MASTER_SITES= http://www.tau.ac.il/~stoledo/taucs/${PORTVERSION}/ \
+ LOCAL/bf
DISTNAME= ${PORTNAME}
EXTRACT_SUFX= .tgz
@@ -20,11 +21,19 @@ LIB_DEPENDS= metis.1:${PORTSDIR}/math/metis4
HAS_CONFIGURE= yes
USE_FORTRAN= yes
+USE_LDCONFIG= yes
WRKSRC= ${WRKDIR}/${PORTNAME}
.include <bsd.port.pre.mk>
+LDFLAGS+= -L${LOCALBASE}/lib
+LIBMETIS?= -lmetis
+MAKE_ENV+= LIBBLAS="${BLAS}" LIBLAPACK="${LAPACK}" LIBMETIS="${LIBMETIS}"
+
+BINS?= direct iter taucs_run
+TESTS ?= complex stack timer linsolve memory
+
.if exists(${LOCALBASE}/lib/libatlas.so)
WITH_BLAS?= atlas
.else
@@ -32,12 +41,12 @@ WITH_BLAS?= reference
.endif
.if ${WITH_BLAS} == atlas
-LIB_DEPENDS+= atlas.2:${PORTSDIR}/math/atlas
+LIB_DEPENDS+= atlas:${PORTSDIR}/math/atlas
BLAS= -lf77blas
LAPACK= -lalapack -lcblas
.elif ${WITH_BLAS} == reference
-LIB_DEPENDS+= lapack.4:${PORTSDIR}/math/lapack
-LIB_DEPENDS+= blas.2:${PORTSDIR}/math/blas
+LIB_DEPENDS+= lapack:${PORTSDIR}/math/lapack
+LIB_DEPENDS+= blas:${PORTSDIR}/math/blas
BLAS= -lblas
LAPACK= -llapack
.endif
@@ -54,35 +63,42 @@ do-extract:
${EXTRACT_AFTER_ARGS}
post-patch:
- @${CP} -r ${WRKSRC} ${WRKSRC}_SHARED
+ @${REINPLACE_CMD} -e 's/succedd/succeed/' \
+ ${WRKSRC}/progs/taucs_blas_underscore_test.c
+ @${REINPLACE_CMD} -e 's/SUCCEDD/SUCCEED/' \
+ ${WRKSRC}/progs/test_linsolve.c
do-configure:
- @cd ${WRKSRC}; ./configure
- @cd ${WRKSRC}_SHARED; ./configure
+ @cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${SH} ./configure
post-configure:
- @cd ${WRKSRC}; ${PATCH} <${FILESDIR}/extra-patch-build-FreeBSD-makefile
- @cd ${WRKSRC}_SHARED; ${PATCH} <${FILESDIR}/extra-patch-build-FreeBSD-makefile
- @${REINPLACE_CMD} \
- -e 's+%%LOCALBASE%%+${LOCALBASE}+g;' -e 's+%%FC%%+${FC}+g;' \
- -e 's+%%BLAS%%+${BLAS}+g;' -e 's+%%LAPACK%%+${LAPACK}+g;' \
- -e 's+%%CC%%+${CC}+g;' -e 's+%%CFLAGS%%+${CFLAGS}+g;' \
- -e 's+%%FFLAGS%%+${FFLAGS}+g;' \
- ${WRKSRC}/config/FreeBSD.mk
- @${REINPLACE_CMD} \
- -e 's+%%LOCALBASE%%+${LOCALBASE}+g;' -e 's+%%FC%%+${FC}+g;' \
- -e 's+%%BLAS%%+${BLAS}+g;' -e 's+%%LAPACK%%+${LAPACK}+g;' \
- -e 's+%%CC%%+${CC}+g;' -e 's+%%CFLAGS%%+${CFLAGS} ${PICFLAG}+g;' \
- -e 's+%%FFLAGS%%+${FFLAGS} ${PICFLAG}+g;' \
- ${WRKSRC}_SHARED/config/FreeBSD.mk
-
-do-build:
- @cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${_MAKE_JOBS} ${MAKE_ARGS}
- @cd ${WRKSRC}_SHARED; ${SETENV} ${MAKE_ENV} ${MAKE} ${_MAKE_JOBS} \
- ${MAKE_ARGS}
+ @${CP} -r ${WRKSRC} ${WRKSRC}_SHARED
+
+archives: configure
+ @${PRINTF} "\n\n%s\n\n\n" "Building libtaucs archives:"
+ @cd ${WRKSRC} ; ${SETENV} ${MAKE_ENV} \
+ ${MAKE} ${_MAKE_JOBS} ${MAKE_ARGS} lib/FreeBSD/libtaucs.a
+ @cd ${WRKSRC}_SHARED ; ${SETENV} ${MAKE_ENV} \
+ PICFLAG="${PICFLAG}" \
+ ${MAKE} ${_MAKE_JOBS} ${MAKE_ARGS} lib/FreeBSD/libtaucs.a
+
+lib: archives
+ @${PRINTF} "\n\n%s\n\n\n" "Building shared library:"
cd ${WRKSRC}_SHARED/lib/FreeBSD ; ${FC} ${FFLAGS} ${PICFLAG} ${LDFLAGS} \
-shared -o libtaucs.so.1 -Wl,-x -Wl,-soname,libtaucs.so.1 -Wl,--whole-archive \
libtaucs.a -Wl,--no-whole-archive
+ @${LN} -sf libtaucs.so.1 ${WRKSRC}_SHARED/lib/FreeBSD/libtaucs.so
+
+bins: lib
+ @${PRINTF} "\n\n%s\n\n\n" "Building (dynamically-linked) executables:"
+#for the second pass through WRKSRC_SHARED, use a nonexistent MAKEOBJDIR to
+#prevent make from entering the obj subdirectories and breaking the build (see,
+#for example, the description of .OBJDIR in make(1)):
+ @cd ${WRKSRC}_SHARED ; ${SETENV} ${MAKE_ENV} \
+ MAKEOBJDIR="${NONEXISTENT}" \
+ ${MAKE} ${_MAKE_JOBS} ${MAKE_ARGS} ${BINS:S|^|bin/FreeBSD/|}
+
+do-build: bins
do-install:
@${INSTALL_DATA} ${WRKSRC}/lib/FreeBSD/libtaucs.a ${PREFIX}/lib
@@ -90,11 +106,30 @@ do-install:
@${LN} -sf libtaucs.so.1 ${PREFIX}/lib/libtaucs.so
@${INSTALL_DATA} ${WRKSRC}/build/FreeBSD/*.h ${PREFIX}/include
@${INSTALL_DATA} ${WRKSRC}/src/*.h ${PREFIX}/include
- @${INSTALL_PROGRAM} ${WRKSRC}/bin/FreeBSD/direct ${PREFIX}/bin
- @${INSTALL_PROGRAM} ${WRKSRC}/bin/FreeBSD/iter ${PREFIX}/bin
-.if !defined(NOPORTDOCS)
+ @cd ${WRKSRC}_SHARED/bin/FreeBSD; ${INSTALL_PROGRAM} ${BINS} ${PREFIX}/bin
+.if ${PORT_OPTIONS:MDOCS}
@${MKDIR} ${DOCSDIR}
@${INSTALL_DATA} ${WRKSRC}/doc/*.pdf ${DOCSDIR}
.endif
+check test: build
+.for t in ${TESTS}
+ @${PRINTF} "\n%s\n" "Building test_${t}"
+ @cd ${WRKSRC}_SHARED ; ${FC} ${FFLAGS} -Llib/FreeBSD -L./ \
+ ${LDFLAGS} -o bin/FreeBSD/test_${t} \
+ `${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_ARGS} -V STDDEFS` \
+ `${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_ARGS} -V STDINCS` \
+ progs/test_${t}.c -ltaucs ${LAPACK} ${BLAS} ${LIBMETIS}
+ @${PRINTF} "\n%s\n\n\n" "Running test_${t}:"
+ -@cd ${WRKSRC}_SHARED ; \
+ ${SETENV} LD_LIBRARY_PATH="lib/FreeBSD:/lib:/usr/lib:${LOCALBASE}/lib" \
+ bin/FreeBSD/test_${t}
+.endfor
+
+#be conservative, and expose a regression test target for amd64 builds only, because
+#some of the tests run amok during i386 tinderbox builds on amd64 hosts
+.if ${ARCH} == "amd64"
+regression-test: check
+.endif
+
.include <bsd.port.post.mk>
diff --git a/math/taucs/files/extra-patch-build-FreeBSD-makefile b/math/taucs/files/extra-patch-build-FreeBSD-makefile
deleted file mode 100644
index 8fa385f9ceda..000000000000
--- a/math/taucs/files/extra-patch-build-FreeBSD-makefile
+++ /dev/null
@@ -1,11 +0,0 @@
---- build/FreeBSD/makefile.orig Mon May 3 20:08:53 2004
-+++ build/FreeBSD/makefile Mon May 3 20:09:20 2004
-@@ -42,7 +42,7 @@
- - $(DIROBJ)taucs_c99_complex_test$(EXEEXT) build/FreeBSD/taucs_config_tests.h
- - $(CILKC) -c $(CILKFLAGS) $(STDDEFS) $(STDINCS) \
- $(DIRPROGS)taucs_cilk_test.c \
-- $(CILKOUTFLG)$(DIROBJ)taucs_cilk_test$(OBJEXT)
-+ $(CILKOUTFLG)$(DIROBJ)taucs_cilk_test$(OBJEXT) || rm $(DIROBJ)taucs_cilk_test$(OBJEXT)
- - $(LD) $(LDFLAGS) \
- $(LOUTFLG)$(DIROBJ)taucs_cilk_test$(EXEEXT) \
- $(DIROBJ)taucs_cilk_test$(OBJEXT) $(LIBS)
diff --git a/math/taucs/files/patch-config+FreeBSD.mk b/math/taucs/files/patch-config+FreeBSD.mk
index 20cb3ac7c3ee..cc925a60ce4d 100644
--- a/math/taucs/files/patch-config+FreeBSD.mk
+++ b/math/taucs/files/patch-config+FreeBSD.mk
@@ -1,42 +1,38 @@
---- config/FreeBSD.mk.orig Fri Aug 29 00:13:38 2003
-+++ config/FreeBSD.mk Tue Jan 9 14:18:49 2007
-@@ -8,16 +8,16 @@
- PATHSEP=/
+--- config/FreeBSD.mk.orig 2003-08-28 11:13:38.000000000 -0400
++++ config/FreeBSD.mk 2012-07-10 07:43:24.000000000 -0400
+@@ -9,30 +9,24 @@
DEFFLG=-D
--FC ?= f77
+ FC ?= f77
-FFLAGS += -Os -fno-second-underscore
-+FC = %%FC%%
-+FFLAGS += -fno-second-underscore %%FFLAGS%%
++FFLAGS += $(PICFLAG)
FOUTFLG =-o
--#CC = cc
+ #CC = cc
-CFLAGS += -Os -D_POSIX_C_SOURCE=199506L -fPIC
-+CC = %%CC%%
-+CFLAGS += -D_POSIX_C_SOURCE=199506L %%CFLAGS%%
++CFLAGS += $(PICFLAG)
COUTFLG = -o
-LD = $(CC)
-LDFLAGS = $(CFLAGS) -static
-+LD = %%FC%%
-+LDFLAGS = -L%%LOCALBASE%%/lib -L./
++LD = $(FC)
++LDFLAGS := -L$(DIRLIB) -L./ $(LDFLAGS)
LOUTFLG = $(COUTFLG)
- AR = ar cr
-@@ -26,12 +26,12 @@
- RANLIB = ranlib
+-AR = ar cr
++AR += cr
+ #AOUTFLG =
+
+-RANLIB = ranlib
RM = rm -rf
-LIBBLAS = -L/usr/local/lib -lf77blas -lcblas -latlas -lg2c
-LIBLAPACK = -L/usr/local/lib -llapack
-+LIBBLAS = %%BLAS%%
-+LIBLAPACK = %%LAPACK%%
-LIBMETIS = -L/usr/local/lib -lmetis
-+LIBMETIS = -lmetis
-LIBF77 = -lg2c
-+LIBF77 =
#compat is required for ftime()
- LIBC = -lm -lcompat
+-LIBC = -lm -lcompat
+ #########################################################
diff --git a/math/taucs/files/patch-src__taucs_timer.c b/math/taucs/files/patch-src__taucs_timer.c
new file mode 100644
index 000000000000..468b8e3f03a2
--- /dev/null
+++ b/math/taucs/files/patch-src__taucs_timer.c
@@ -0,0 +1,50 @@
+--- src/taucs_timer.c.orig 2003-09-01 06:28:54.000000000 -0400
++++ src/taucs_timer.c 2012-07-10 07:24:08.000000000 -0400
+@@ -245,36 +245,35 @@
+ #include <sys/time.h>
+ #include <sys/resource.h>
+ #include <sys/types.h>
+-#include <sys/timeb.h>
+
+ double taucs_wtime()
+ {
+- struct timeb T;
++ struct timeval T;
+ /*static int first_time = 1;*/
+ /* static time_t start_time, time_diff;
+- static time_t start_mill, mill_diff;
++ static time_t start_micro, micro_diff;
+ */
+
+ static time_t time_diff;
+- static time_t mill_diff;
++ static time_t micro_diff;
+ /*int rc;*/
+ double dt;
+
+- (void) ftime( &T );
++ (void) gettimeofday( &T,NULL );
+ /*
+ if (first_time) {
+ first_time = 0;
+- start_time = T.time;
+- start_mill = T.millitm;
++ start_time = T.tv_sec;
++ start_micro = T.tv_usec;
+ }
+
+- time_diff = T.time - start_time;
+- mill_diff = T.millitm - start_mill;
++ time_diff = T.tv_sec - start_time;
++ micro_diff = T.tv_usec - start_micro;
+ */
+- time_diff = T.time;
+- mill_diff = T.millitm;
++ time_diff = T.tv_sec;
++ micro_diff = T.tv_usec;
+
+- dt = ((double) time_diff) + (1e-3) * ((double) mill_diff);
++ dt = ((double) time_diff) + (1e-6) * ((double) micro_diff);
+
+ return dt;
+ }
diff --git a/math/taucs/pkg-plist b/math/taucs/pkg-plist
index b9f88ae39c1e..24b988964392 100644
--- a/math/taucs/pkg-plist
+++ b/math/taucs/pkg-plist
@@ -1,5 +1,6 @@
bin/direct
bin/iter
+bin/taucs_run
lib/libtaucs.a
lib/libtaucs.so
lib/libtaucs.so.1