summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog24
-rw-r--r--debian/compat1
-rw-r--r--debian/control8
-rw-r--r--debian/copyright2
-rw-r--r--[-rwxr-xr-x]debian/liblbfgsb-dev.install4
-rw-r--r--[-rwxr-xr-x]debian/liblbfgsb0.install4
-rw-r--r--debian/patches/0003-Prevent-bound-violation.patch27
-rw-r--r--debian/patches/0004-Fix-NaN-propagation.patch26
-rw-r--r--debian/patches/0005-Disable-printing-of-time.patch23
-rw-r--r--debian/patches/0006-Stop-generating-iteration-log-files.patch214
-rw-r--r--debian/patches/replace-linpack-with-lapack.patch24
-rw-r--r--debian/patches/series4
-rw-r--r--debian/patches/silence.patch14
-rwxr-xr-xdebian/rules61
-rwxr-xr-xdebian/tests/tests.sh4
15 files changed, 389 insertions, 51 deletions
diff --git a/debian/changelog b/debian/changelog
index 06856f1..7047dd3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,29 @@
-lbfgsb (3.0+dfsg.3-7) UNRELEASED; urgency=medium
+lbfgsb (3.0+dfsg.3-9) unstable; urgency=medium
+
+ * New-style dh compat level.
+ * Add patch based on SciPy to prevent bounds violation. (Closes: #966448)
+ * Let gbp cosmetically reformat patches.
+ * Add patch based on SciPy to fix NaN propagation.
+ * Add patches based on SciPy to prevent time printing and log files.
+ * Move to Salsa.
+
+ -- Gard Spreemann <gspr@nonempty.org> Thu, 30 Jul 2020 11:01:06 +0200
+
+lbfgsb (3.0+dfsg.3-8) unstable; urgency=medium
+
+ * Relax compilation flags for tests to allow them to run on more
+ architectures.
+ * Standards-version 4.5.0. No changes needed.
+ * Avoid build-depending on dh-exec, requires dh 13.
+
+ -- Gard Spreemann <gspr@nonempty.org> Thu, 23 Apr 2020 23:21:49 +0200
+
+lbfgsb (3.0+dfsg.3-7) unstable; urgency=medium
* Man page stub for -examples package.
* Add superficial test that just checks that the upstream examples run.
- -- Gard Spreemann <gspr@nonempty.org> Mon, 26 Aug 2019 16:21:51 +0200
+ -- Gard Spreemann <gspr@nonempty.org> Mon, 26 Aug 2019 17:20:47 +0200
lbfgsb (3.0+dfsg.3-6) unstable; urgency=medium
diff --git a/debian/compat b/debian/compat
deleted file mode 100644
index 48082f7..0000000
--- a/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-12
diff --git a/debian/control b/debian/control
index 78b9b3e..b7e2fa2 100644
--- a/debian/control
+++ b/debian/control
@@ -2,12 +2,12 @@ Source: lbfgsb
Maintainer: Gard Spreemann <gspr@nonempty.org>
Section: math
Priority: optional
-Standards-Version: 4.4.0
-Build-Depends: debhelper (>= 12), dh-exec, gfortran, libblas-dev, liblapack-dev
+Standards-Version: 4.5.0
+Build-Depends: debhelper-compat (= 13), gfortran, libblas-dev, liblapack-dev
Rules-Requires-Root: no
Homepage: http://users.iems.northwestern.edu/~nocedal/lbfgsb.html
-Vcs-Browser: https://git.nonempty.org/debian-lbfgsb
-Vcs-Git: https://git.nonempty.org/debian-lbfgsb -b debian/sid
+Vcs-Browser: https://salsa.debian.org/gspr/lbfgsb
+Vcs-Git: https://salsa.debian.org/gspr/lbfgsb.git -b debian/sid
Package: liblbfgsb0
Section: libs
diff --git a/debian/copyright b/debian/copyright
index a05376b..55c28cd 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -10,7 +10,7 @@ Copyright: Ciyou Zhu, Richard Byrd, Jorge Nocedal, Jose Luis Morales
License: BSD-3-clause
Files: debian/*
-Copyright: 2013-2019 Gard Spreemann <gspr@nonempty.org>
+Copyright: 2013-2020 Gard Spreemann <gspr@nonempty.org>
License: BSD-3-clause
Files: debian/tests/*.f90
diff --git a/debian/liblbfgsb-dev.install b/debian/liblbfgsb-dev.install
index 15ec573..2d2db83 100755..100644
--- a/debian/liblbfgsb-dev.install
+++ b/debian/liblbfgsb-dev.install
@@ -1,6 +1,2 @@
-#!/usr/bin/dh-exec
-# We need a dynamic .install file for Multi-Arch.
-# See https://wiki.debian.org/Multiarch/Implementation
-
build/liblbfgsb.so usr/lib/${DEB_HOST_MULTIARCH}/
build/liblbfgsb.a usr/lib/${DEB_HOST_MULTIARCH}/
diff --git a/debian/liblbfgsb0.install b/debian/liblbfgsb0.install
index 68cdc0a..0d8cfeb 100755..100644
--- a/debian/liblbfgsb0.install
+++ b/debian/liblbfgsb0.install
@@ -1,5 +1 @@
-#!/usr/bin/dh-exec
-# We need a dynamic .install file for Multi-Arch.
-# See https://wiki.debian.org/Multiarch/Implementation
-
build/liblbfgsb.so.0 usr/lib/${DEB_HOST_MULTIARCH}/
diff --git a/debian/patches/0003-Prevent-bound-violation.patch b/debian/patches/0003-Prevent-bound-violation.patch
new file mode 100644
index 0000000..04a4acc
--- /dev/null
+++ b/debian/patches/0003-Prevent-bound-violation.patch
@@ -0,0 +1,27 @@
+From: Gard Spreemann <gspr@nonempty.org>
+Date: Thu, 30 Jul 2020 10:15:21 +0200
+Subject: Prevent bound violation.
+
+This is based on SciPy's commits
+ cb9ed45d1a25d77204c737a8e1489dfb9606241f
+ e5ffa787555a60caf2ed9d0046a9ab782457fea4
+---
+ lbfgsb.f | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/lbfgsb.f b/lbfgsb.f
+index 008370d..7c6b7fc 100644
+--- a/lbfgsb.f
++++ b/lbfgsb.f
+@@ -2569,8 +2569,11 @@ c Line search is impossible.
+ if (stp .eq. one) then
+ call dcopy(n,z,1,x,1)
+ else
++c take step and prevent rounding error beyond bound
+ do 41 i = 1, n
+ x(i) = stp*d(i) + t(i)
++ if (nbd(i).eq.1.or.nbd(i).eq.2) x(i) = max(x(i), l(i))
++ if (nbd(i).eq.2.or.nbd(i).eq.3) x(i) = min(x(i), u(i))
+ 41 continue
+ endif
+ else
diff --git a/debian/patches/0004-Fix-NaN-propagation.patch b/debian/patches/0004-Fix-NaN-propagation.patch
new file mode 100644
index 0000000..dae12ec
--- /dev/null
+++ b/debian/patches/0004-Fix-NaN-propagation.patch
@@ -0,0 +1,26 @@
+From: Gard Spreemann <gspr@nonempty.org>
+Date: Thu, 30 Jul 2020 10:25:38 +0200
+Subject: Fix NaN propagation.
+
+This is based on SciPy commit
+ 4eb242fabeef7d1871d21936bee275be4fda1844
+---
+ lbfgsb.f | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/lbfgsb.f b/lbfgsb.f
+index 7c6b7fc..501879b 100644
+--- a/lbfgsb.f
++++ b/lbfgsb.f
+@@ -2977,6 +2977,11 @@ c ************
+ sbgnrm = zero
+ do 15 i = 1, n
+ gi = g(i)
++ if (gi.ne.gi) then
++c NaN value in gradient: propagate it
++ sbgnrm = gi
++ return
++ endif
+ if (nbd(i) .ne. 0) then
+ if (gi .lt. zero) then
+ if (nbd(i) .ge. 2) gi = max((x(i)-u(i)),gi)
diff --git a/debian/patches/0005-Disable-printing-of-time.patch b/debian/patches/0005-Disable-printing-of-time.patch
new file mode 100644
index 0000000..9f84bf4
--- /dev/null
+++ b/debian/patches/0005-Disable-printing-of-time.patch
@@ -0,0 +1,23 @@
+From: Gard Spreemann <gspr@nonempty.org>
+Date: Thu, 30 Jul 2020 10:30:09 +0200
+Subject: Disable printing of time.
+
+Per SciPy commit
+ 04cd360b25c4bb1b831895f51b653ac282afc78c
+---
+ lbfgsb.f | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/lbfgsb.f b/lbfgsb.f
+index 501879b..59f0a97 100644
+--- a/lbfgsb.f
++++ b/lbfgsb.f
+@@ -2873,8 +2873,6 @@ c ************
+ if (info .eq. -8) write (6,9018)
+ if (info .eq. -9) write (6,9019)
+ endif
+- if (iprint .ge. 1) write (6,3007) cachyt,sbtime,lnscht
+- write (6,3008) time
+ if (iprint .ge. 1) then
+ if (info .eq. -4 .or. info .eq. -9) then
+ write (itfile,3002)
diff --git a/debian/patches/0006-Stop-generating-iteration-log-files.patch b/debian/patches/0006-Stop-generating-iteration-log-files.patch
new file mode 100644
index 0000000..aa31976
--- /dev/null
+++ b/debian/patches/0006-Stop-generating-iteration-log-files.patch
@@ -0,0 +1,214 @@
+From: Gard Spreemann <gspr@nonempty.org>
+Date: Thu, 30 Jul 2020 10:49:15 +0200
+Subject: Stop generating iteration log files.
+
+Based on SciPy commit
+ c3c54c15eafe7fa7a2b7a499cb64f38f1a7ee057
+---
+ lbfgsb.f | 61 +++++++++++--------------------------------------------------
+ 1 file changed, 11 insertions(+), 50 deletions(-)
+
+diff --git a/lbfgsb.f b/lbfgsb.f
+index 59f0a97..e30aff0 100644
+--- a/lbfgsb.f
++++ b/lbfgsb.f
+@@ -140,8 +140,6 @@ c 0<iprint<99 print also f and |proj g| every iprint iterations;
+ c iprint=99 print details of every iteration except n-vectors;
+ c iprint=100 print also the changes of active set and final x;
+ c iprint>100 print details of every iteration including x and g;
+-c When iprint > 0, the file iterate.dat will be created to
+-c summarize the iteration.
+ c
+ c csave is a working string of characters of length 60.
+ c
+@@ -426,8 +424,6 @@ c 0<iprint<99 print also f and |proj g| every iprint iterations;
+ c iprint=99 print details of every iteration except n-vectors;
+ c iprint=100 print also the changes of active set and final x;
+ c iprint>100 print details of every iteration including x and g;
+-c When iprint > 0, the file iterate.dat will be created to
+-c summarize the iteration.
+ c
+ c csave is a working string of characters of length 60.
+ c
+@@ -483,7 +479,7 @@ c ************
+
+ logical prjctd,cnstnd,boxed,updatd,wrk
+ character*3 word
+- integer i,k,nintol,itfile,iback,nskip,
++ integer i,k,nintol,iback,nskip,
+ + head,col,iter,itail,iupdat,
+ + nseg,nfgv,info,ifun,
+ + iword,nfree,nact,ileave,nenter
+@@ -546,24 +542,18 @@ c 'word' records the status of subspace solutions.
+ c 'info' records the termination information.
+ info = 0
+
+- itfile = 8
+- if (iprint .ge. 1) then
+-c open a summary file 'iterate.dat'
+- open (8, file = 'iterate.dat', status = 'unknown')
+- endif
+-
+ c Check the input arguments for errors.
+
+ call errclb(n,m,factr,l,u,nbd,task,info,k)
+ if (task(1:5) .eq. 'ERROR') then
+- call prn3lb(n,x,f,task,iprint,info,itfile,
++ call prn3lb(n,x,f,task,iprint,info,
+ + iter,nfgv,nintol,nskip,nact,sbgnrm,
+ + zero,nseg,word,iback,stp,xstep,k,
+ + cachyt,sbtime,lnscht)
+ return
+ endif
+
+- call prn1lb(n,m,l,u,x,iprint,itfile,epsmch)
++ call prn1lb(n,m,l,u,x,iprint,epsmch)
+
+ c Initialize iwhere & project x onto the feasible set.
+
+@@ -580,7 +570,6 @@ c restore local variables.
+ updatd = lsave(4)
+
+ nintol = isave(1)
+- itfile = isave(3)
+ iback = isave(4)
+ nskip = isave(5)
+ head = isave(6)
+@@ -646,7 +635,6 @@ c Compute the infinity norm of the (-) projected gradient.
+
+ if (iprint .ge. 1) then
+ write (6,1002) iter,f,sbgnrm
+- write (itfile,1003) iter,nfgv,sbgnrm,f
+ endif
+ if (sbgnrm .le. pgtol) then
+ c terminate the algorithm.
+@@ -834,7 +822,7 @@ c Compute the infinity norm of the projected (-)gradient.
+
+ c Print iteration information.
+
+- call prn2lb(n,x,f,g,iprint,itfile,iter,nfgv,nact,
++ call prn2lb(n,x,f,g,iprint,iter,nfgv,nact,
+ + sbgnrm,nseg,word,iword,iback,stp,xstep)
+ goto 1000
+ endif
+@@ -927,7 +915,7 @@ c -------------------- the end of the loop -----------------------------
+ 999 continue
+ call timer(time2)
+ time = time2 - time1
+- call prn3lb(n,x,f,task,iprint,info,itfile,
++ call prn3lb(n,x,f,task,iprint,info,
+ + iter,nfgv,nintol,nskip,nact,sbgnrm,
+ + time,nseg,word,iback,stp,xstep,k,
+ + cachyt,sbtime,lnscht)
+@@ -941,7 +929,6 @@ c Save local variables.
+ lsave(4) = updatd
+
+ isave(1) = nintol
+- isave(3) = itfile
+ isave(4) = iback
+ isave(5) = nskip
+ isave(6) = head
+@@ -1361,8 +1348,6 @@ c 0<iprint<99 print also f and |proj g| every iprint iterations;
+ c iprint=99 print details of every iteration except n-vectors;
+ c iprint=100 print also the changes of active set and final x;
+ c iprint>100 print details of every iteration including x and g;
+-c When iprint > 0, the file iterate.dat will be created to
+-c summarize the iteration.
+ c
+ c sbgnrm is a double precision variable.
+ c On entry sbgnrm is the norm of the projected gradient at x.
+@@ -2673,9 +2658,9 @@ c and the last column of SS:
+
+ c======================= The end of matupd =============================
+
+- subroutine prn1lb(n, m, l, u, x, iprint, itfile, epsmch)
++ subroutine prn1lb(n, m, l, u, x, iprint, epsmch)
+
+- integer n, m, iprint, itfile
++ integer n, m, iprint
+ double precision epsmch, x(n), l(n), u(n)
+
+ c ************
+@@ -2705,9 +2690,6 @@ c ************
+ write (6,7001) epsmch
+ write (6,*) 'N = ',n,' M = ',m
+ if (iprint .ge. 1) then
+- write (itfile,2001) epsmch
+- write (itfile,*)'N = ',n,' M = ',m
+- write (itfile,9001)
+ if (iprint .gt. 100) then
+ write (6,1004) 'L =',(l(i),i = 1,n)
+ write (6,1004) 'X0 =',(x(i),i = 1,n)
+@@ -2744,11 +2726,11 @@ c ************
+
+ c======================= The end of prn1lb =============================
+
+- subroutine prn2lb(n, x, f, g, iprint, itfile, iter, nfgv, nact,
++ subroutine prn2lb(n, x, f, g, iprint, iter, nfgv, nact,
+ + sbgnrm, nseg, word, iword, iback, stp, xstep)
+
+ character*3 word
+- integer n, iprint, itfile, iter, nfgv, nact, nseg,
++ integer n, iprint, iter, nfgv, nact, nseg,
+ + iword, iback
+ double precision f, sbgnrm, stp, xstep, x(n), g(n)
+
+@@ -2798,8 +2780,6 @@ c the truncated Newton step has been used.
+ imod = mod(iter,iprint)
+ if (imod .eq. 0) write (6,2001) iter,f,sbgnrm
+ endif
+- if (iprint .ge. 1) write (itfile,3001)
+- + iter,nfgv,nseg,nact,word,iback,stp,xstep,sbgnrm,f
+
+ 1004 format (/,a4, 1p, 6(1x,d11.4),/,(4x,1p,6(1x,d11.4)))
+ 2001 format
+@@ -2812,14 +2792,14 @@ c the truncated Newton step has been used.
+
+ c======================= The end of prn2lb =============================
+
+- subroutine prn3lb(n, x, f, task, iprint, info, itfile,
++ subroutine prn3lb(n, x, f, task, iprint, info,
+ + iter, nfgv, nintol, nskip, nact, sbgnrm,
+ + time, nseg, word, iback, stp, xstep, k,
+ + cachyt, sbtime, lnscht)
+
+ character*60 task
+ character*3 word
+- integer n, iprint, info, itfile, iter, nfgv, nintol,
++ integer n, iprint, info, iter, nfgv, nintol,
+ + nskip, nact, nseg, iback, k
+ double precision f, sbgnrm, time, stp, xstep, cachyt, sbtime,
+ + lnscht, x(n)
+@@ -2873,23 +2853,6 @@ c ************
+ if (info .eq. -8) write (6,9018)
+ if (info .eq. -9) write (6,9019)
+ endif
+- if (iprint .ge. 1) then
+- if (info .eq. -4 .or. info .eq. -9) then
+- write (itfile,3002)
+- + iter,nfgv,nseg,nact,word,iback,stp,xstep
+- endif
+- write (itfile,3009) task
+- if (info .ne. 0) then
+- if (info .eq. -1) write (itfile,9011)
+- if (info .eq. -2) write (itfile,9012)
+- if (info .eq. -3) write (itfile,9013)
+- if (info .eq. -4) write (itfile,9014)
+- if (info .eq. -5) write (itfile,9015)
+- if (info .eq. -8) write (itfile,9018)
+- if (info .eq. -9) write (itfile,9019)
+- endif
+- write (itfile,3008) time
+- endif
+ endif
+
+ 1004 format (/,a4, 1p, 6(1x,d11.4),/,(4x,1p,6(1x,d11.4)))
+@@ -3152,8 +3115,6 @@ c 0<iprint<99 print also f and |proj g| every iprint iterations;
+ c iprint=99 print details of every iteration except n-vectors;
+ c iprint=100 print also the changes of active set and final x;
+ c iprint>100 print details of every iteration including x and g;
+-c When iprint > 0, the file iterate.dat will be created to
+-c summarize the iteration.
+ c
+ c info is an integer variable.
+ c On entry info is unspecified.
diff --git a/debian/patches/replace-linpack-with-lapack.patch b/debian/patches/replace-linpack-with-lapack.patch
index 83e3261..a875ea2 100644
--- a/debian/patches/replace-linpack-with-lapack.patch
+++ b/debian/patches/replace-linpack-with-lapack.patch
@@ -1,11 +1,21 @@
+From: Gard Spreemann <gspr@nonempty.org>
+Date: Thu, 30 Jul 2020 09:57:45 +0200
+Subject: replace-linpack-with-lapack
+
The library code originally uses LINPACK (from an embedded
copy). Since LINPACK has largely been superseded by LAPACK, this patch
replaces calls to the former with equivalent calls to the
latter. Specifically, dpofa is replaced by dpotrf, and dtrsl is
replaced by dtrtrs.
+---
+ lbfgsb.f | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/lbfgsb.f b/lbfgsb.f
+index 9c9e7d9..54fd1f9 100644
--- a/lbfgsb.f
+++ b/lbfgsb.f
-@@ -1185,7 +1185,7 @@
+@@ -1185,7 +1185,7 @@ c solve Jp2=v2+LD^(-1)v1.
p(i2) = v(i2) + sum
20 continue
c Solve the triangular system
@@ -14,7 +24,7 @@ replaced by dtrtrs.
if (info .ne. 0) return
c solve D^(1/2)p1=v1.
-@@ -1197,7 +1197,7 @@
+@@ -1197,7 +1197,7 @@ c PART II: solve [ -D^(1/2) D^(-1/2)*L' ] [ p1 ] = [ p1 ]
c [ 0 J' ] [ p2 ] [ p2 ].
c solve J^Tp2=p2.
@@ -23,7 +33,7 @@ replaced by dtrtrs.
if (info .ne. 0) return
c compute p1=-D^(-1/2)(p1-D^(-1/2)L'p2)
-@@ -2135,7 +2135,7 @@
+@@ -2135,7 +2135,7 @@ c [(-L_a +R_z)L'^-1 S'AA'S*theta ]
c first Cholesky factor (1,1) block of wn to get LL'
c with L' stored in the upper triangle of wn.
@@ -32,7 +42,7 @@ replaced by dtrtrs.
if (info .ne. 0) then
info = -1
return
-@@ -2143,7 +2143,7 @@
+@@ -2143,7 +2143,7 @@ c with L' stored in the upper triangle of wn.
c then form L^-1(-L_a'+R_z') in the (1,2) block.
col2 = 2*col
do 71 js = col+1 ,col2
@@ -41,7 +51,7 @@ replaced by dtrtrs.
71 continue
c Form S'AA'S*theta + (L^-1(-L_a'+R_z'))'L^-1(-L_a'+R_z') in the
-@@ -2158,7 +2158,7 @@
+@@ -2158,7 +2158,7 @@ c upper triangle of (2,2) block of wn.
c Cholesky factorization of (2,2) block of wn.
@@ -50,7 +60,7 @@ replaced by dtrtrs.
if (info .ne. 0) then
info = -2
return
-@@ -2227,7 +2227,7 @@
+@@ -2227,7 +2227,7 @@ c store T in the upper triangle of the array wt.
c Cholesky factorize T to J*J' with
c J' stored in the upper triangle of wt.
@@ -59,7 +69,7 @@ replaced by dtrtrs.
if (info .ne. 0) then
info = -3
endif
-@@ -3208,12 +3208,12 @@
+@@ -3208,12 +3208,12 @@ c Compute wv:=K^(-1)wv.
m2 = 2*m
col2 = 2*col
diff --git a/debian/patches/series b/debian/patches/series
index 6d5db6c..cd4d11e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,6 @@
replace-linpack-with-lapack.patch
silence.patch
+0003-Prevent-bound-violation.patch
+0004-Fix-NaN-propagation.patch
+0005-Disable-printing-of-time.patch
+0006-Stop-generating-iteration-log-files.patch
diff --git a/debian/patches/silence.patch b/debian/patches/silence.patch
index 828b96c..7d34a63 100644
--- a/debian/patches/silence.patch
+++ b/debian/patches/silence.patch
@@ -1,3 +1,7 @@
+From: Gard Spreemann <gspr@nonempty.org>
+Date: Thu, 30 Jul 2020 09:57:45 +0200
+Subject: silence
+
The library's documentation indicates that it will only write out
messages when the iprint flag is greater than zero. There are two
places where writing still happens unconditionally, which this patch
@@ -5,9 +9,15 @@ fixes.
A similar patch was also applied by the SciPy project (see their issue
3238).
+---
+ lbfgsb.f | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/lbfgsb.f b/lbfgsb.f
+index 54fd1f9..008370d 100644
--- a/lbfgsb.f
+++ b/lbfgsb.f
-@@ -2550,7 +2550,9 @@
+@@ -2550,7 +2550,9 @@ c Determine the maximum step length.
if (gd .ge. zero) then
c the directional derivative >=0.
c Line search is impossible.
@@ -18,7 +28,7 @@ A similar patch was also applied by the SciPy project (see their issue
info = -4
return
endif
-@@ -3279,8 +3281,10 @@
+@@ -3279,8 +3281,10 @@ c
55 continue
if ( dd_p .gt.zero ) then
call dcopy( n, xp, 1, x, 1 )
diff --git a/debian/rules b/debian/rules
index 043b897..60d2ed6 100755
--- a/debian/rules
+++ b/debian/rules
@@ -16,32 +16,45 @@ LDFLAGS_EX:=$(shell DEB_BUILD_MAINT_OPTIONS=$(MAINTOPTS_EX) dpkg-buildflags --ge
%:
dh $@
-override_dh_auto_build:
- mkdir -p build
- gfortran $(FCFLAGS) -fPIC -o build/lbfgsb.o -c lbfgsb.f
- gfortran $(FCFLAGS) -fPIC -o build/timer.o -c timer.f
+build/%.o: %.f
+ gfortran $(FCFLAGS) -fPIC -o $@ -c $<
+
+build/liblbfgsb.so: build/lbfgsb.o build/timer.o
gfortran $(FCFLAGS) -shared $(LDFLAGS) -Wl,-soname,$(SONAME) \
- -o build/$(SONAME) build/lbfgsb.o build/timer.o \
- -lblas -llapack
- ar cr build/liblbfgsb.a build/lbfgsb.o build/timer.o
- ln -s $(SONAME) build/liblbfgsb.so
-
- gfortran $(FCFLAGS_EX) $(LDFLAGS_EX) \
- -o build/lbfgsb-examples_driver1_77 driver1.f -llbfgsb -Lbuild
- gfortran $(FCFLAGS_EX) $(LDFLAGS_EX) \
- -o build/lbfgsb-examples_driver1_90 driver1.f90 -llbfgsb -Lbuild
- gfortran $(FCFLAGS_EX) $(LDFLAGS_EX) \
- -o build/lbfgsb-examples_driver2_77 driver2.f -llbfgsb -Lbuild
- gfortran $(FCFLAGS_EX) $(LDFLAGS_EX) \
- -o build/lbfgsb-examples_driver2_90 driver2.f90 -llbfgsb -Lbuild
- gfortran $(FCFLAGS_EX) $(LDFLAGS_EX) \
- -o build/lbfgsb-examples_driver3_77 driver3.f -llbfgsb -Lbuild
- gfortran $(FCFLAGS_EX) $(LDFLAGS_EX) \
- -o build/lbfgsb-examples_driver3_90 driver3.f90 -llbfgsb -Lbuild
-
-override_dh_auto_clean:
+ -o build/$(SONAME) $^ -lblas -llapack
+ ln -s $(SONAME) $@
+
+build/liblbfgsb.a: build/lbfgsb.o build/timer.o
+ ar cr $@ $^
+
+build/lbfgsb-examples_driver1_77: driver1.f build/liblbfgsb.so
+ gfortran $(FCFLAGS_EX) $(LDFLAGS_EX) -o $@ $< -llbfgsb -Lbuild
+
+build/lbfgsb-examples_driver1_90: driver1.f90 build/liblbfgsb.so
+ gfortran $(FCFLAGS_EX) $(LDFLAGS_EX) -o $@ $< -llbfgsb -Lbuild
+
+build/lbfgsb-examples_driver2_77: driver2.f build/liblbfgsb.so
+ gfortran $(FCFLAGS_EX) $(LDFLAGS_EX) -o $@ $< -llbfgsb -Lbuild
+
+build/lbfgsb-examples_driver2_90: driver2.f90 build/liblbfgsb.so
+ gfortran $(FCFLAGS_EX) $(LDFLAGS_EX) -o $@ $< -llbfgsb -Lbuild
+
+build/lbfgsb-examples_driver3_77: driver3.f build/liblbfgsb.so
+ gfortran $(FCFLAGS_EX) $(LDFLAGS_EX) -o $@ $< -llbfgsb -Lbuild
+
+build/lbfgsb-examples_driver3_90: driver3.f90 build/liblbfgsb.so
+ gfortran $(FCFLAGS_EX) $(LDFLAGS_EX) -o $@ $< -llbfgsb -Lbuild
+
+execute_before_dh_auto_build:
+ mkdir -p build
+
+override_dh_auto_build: build/liblbfgsb.so build/liblbfgsb.a \
+ build/lbfgsb-examples_driver1_77 build/lbfgsb-examples_driver1_90 \
+ build/lbfgsb-examples_driver2_77 build/lbfgsb-examples_driver2_90 \
+ build/lbfgsb-examples_driver3_77 build/lbfgsb-examples_driver3_90
+
+execute_before_dh_auto_clean:
rm -rf build
- dh_auto_clean
override_dh_compress:
dh_compress -X.pdf -X.f -X.f90 -Xoutput_
diff --git a/debian/tests/tests.sh b/debian/tests/tests.sh
index 1e41496..9be2ae1 100755
--- a/debian/tests/tests.sh
+++ b/debian/tests/tests.sh
@@ -14,7 +14,7 @@ testSO() {
do
echo "Building."
set -x
- gfortran -O3 -march=native -o $name $name.f90 -llbfgsb
+ gfortran -O2 -o $name $name.f90 -llbfgsb
ret=$?
set +x
assertEquals 0 $ret
@@ -34,7 +34,7 @@ testStatic() {
do
echo "Building (statically linked)."
set -x
- gfortran $name.f90 -O3 -march=native -static -llbfgsb -llapack -lblas -lgfortran -o $name-static
+ gfortran $name.f90 -O2 -static -llbfgsb -llapack -lblas -lgfortran -o $name-static
ret=$?
set +x
assertEquals 0 $ret