science/voro++: Add shared library

Consolidated build changes into patch files.

Kept static lib as well as some dependencies may specify it explicitly
(this is common in scientific software for better or worse) and the library
is very small.

PR:             232876
Reported by:    yuri
Approved by:    jrm (mentor, implicit)
This commit is contained in:
Jason W. Bacon 2018-11-04 15:52:42 +00:00
parent 43d7f7eb1d
commit 73141b230f
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=484101
6 changed files with 164 additions and 17 deletions

View File

@ -1,7 +1,8 @@
# $FreeBSD$
PORTNAME= voro++
PORTVERSION= 0.4.6
DISTVERSION= 0.4.6
PORTREVISION= 1
CATEGORIES= science
MASTER_SITES= http://math.lbl.gov/voro++/download/dir/
@ -12,18 +13,11 @@ LICENSE= BSD3CLAUSE
LICENSE_FILE= ${WRKSRC}/LICENSE
USES= gmake
USE_LDCONFIG= yes
post-patch:
${REINPLACE_CMD} \
-e 's|CXX=|CXX?=|g' \
-e 's|CFLAGS=|CFLAGS?=|g' \
-e 's|PREFIX=.*|PREFIX?=|g' \
${WRKSRC}/config.mk
${REINPLACE_CMD} \
-e 's|$$(PREFIX)|$$(DESTDIR)$$(PREFIX)|g' \
${WRKSRC}/Makefile
CFLAGS+= -fPIC
post-install:
${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/voro++
@${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/voro++
.include <bsd.port.mk>

View File

@ -0,0 +1,101 @@
--- Makefile.orig 2013-10-17 17:54:13 UTC
+++ Makefile
@@ -12,7 +12,7 @@ include config.mk
# Build all of the executable files
all:
$(MAKE) -C src
- $(MAKE) -C examples
+ #$(MAKE) -C examples
# Build the help files (with Doxygen)
help:
@@ -26,47 +26,48 @@ clean:
# Install the executable, man page, and shared library
install:
$(MAKE) -C src
- $(INSTALL) -d $(IFLAGS_EXEC) $(PREFIX)/bin
- $(INSTALL) -d $(IFLAGS_EXEC) $(PREFIX)/lib
- $(INSTALL) -d $(IFLAGS_EXEC) $(PREFIX)/man
- $(INSTALL) -d $(IFLAGS_EXEC) $(PREFIX)/man/man1
- $(INSTALL) -d $(IFLAGS_EXEC) $(PREFIX)/include
- $(INSTALL) -d $(IFLAGS_EXEC) $(PREFIX)/include/voro++
- $(INSTALL) $(IFLAGS_EXEC) src/voro++ $(PREFIX)/bin
- $(INSTALL) $(IFLAGS) man/voro++.1 $(PREFIX)/man/man1
- $(INSTALL) $(IFLAGS) src/libvoro++.a $(PREFIX)/lib
- $(INSTALL) $(IFLAGS) src/voro++.hh $(PREFIX)/include/voro++
- $(INSTALL) $(IFLAGS) src/c_loops.hh $(PREFIX)/include/voro++
- $(INSTALL) $(IFLAGS) src/cell.hh $(PREFIX)/include/voro++
- $(INSTALL) $(IFLAGS) src/common.hh $(PREFIX)/include/voro++
- $(INSTALL) $(IFLAGS) src/config.hh $(PREFIX)/include/voro++
- $(INSTALL) $(IFLAGS) src/container.hh $(PREFIX)/include/voro++
- $(INSTALL) $(IFLAGS) src/container_prd.hh $(PREFIX)/include/voro++
- $(INSTALL) $(IFLAGS) src/rad_option.hh $(PREFIX)/include/voro++
- $(INSTALL) $(IFLAGS) src/pre_container.hh $(PREFIX)/include/voro++
- $(INSTALL) $(IFLAGS) src/unitcell.hh $(PREFIX)/include/voro++
- $(INSTALL) $(IFLAGS) src/v_base.hh $(PREFIX)/include/voro++
- $(INSTALL) $(IFLAGS) src/v_compute.hh $(PREFIX)/include/voro++
- $(INSTALL) $(IFLAGS) src/wall.hh $(PREFIX)/include/voro++
- $(INSTALL) $(IFLAGS) src/worklist.hh $(PREFIX)/include/voro++
+ $(INSTALL) -d $(IFLAGS_EXEC) $(DESTDIR)$(PREFIX)/bin
+ $(INSTALL) -d $(IFLAGS_EXEC) $(DESTDIR)$(PREFIX)/lib
+ $(INSTALL) -d $(IFLAGS_EXEC) $(DESTDIR)$(PREFIX)/man
+ $(INSTALL) -d $(IFLAGS_EXEC) $(DESTDIR)$(PREFIX)/man/man1
+ $(INSTALL) -d $(IFLAGS_EXEC) $(DESTDIR)$(PREFIX)/include
+ $(INSTALL) -d $(IFLAGS_EXEC) $(DESTDIR)$(PREFIX)/include/voro++
+ $(INSTALL) $(IFLAGS_EXEC) src/voro++ $(DESTDIR)$(PREFIX)/bin
+ $(INSTALL) $(IFLAGS) man/voro++.1 $(DESTDIR)$(PREFIX)/man/man1
+ $(INSTALL) $(IFLAGS) src/libvoro++.a $(DESTDIR)$(PREFIX)/lib
+ $(INSTALL) $(IFLAGS) src/libvoro++.so $(DESTDIR)$(PREFIX)/lib
+ $(INSTALL) $(IFLAGS) src/voro++.hh $(DESTDIR)$(PREFIX)/include/voro++
+ $(INSTALL) $(IFLAGS) src/c_loops.hh $(DESTDIR)$(PREFIX)/include/voro++
+ $(INSTALL) $(IFLAGS) src/cell.hh $(DESTDIR)$(PREFIX)/include/voro++
+ $(INSTALL) $(IFLAGS) src/common.hh $(DESTDIR)$(PREFIX)/include/voro++
+ $(INSTALL) $(IFLAGS) src/config.hh $(DESTDIR)$(PREFIX)/include/voro++
+ $(INSTALL) $(IFLAGS) src/container.hh $(DESTDIR)$(PREFIX)/include/voro++
+ $(INSTALL) $(IFLAGS) src/container_prd.hh $(DESTDIR)$(PREFIX)/include/voro++
+ $(INSTALL) $(IFLAGS) src/rad_option.hh $(DESTDIR)$(PREFIX)/include/voro++
+ $(INSTALL) $(IFLAGS) src/pre_container.hh $(DESTDIR)$(PREFIX)/include/voro++
+ $(INSTALL) $(IFLAGS) src/unitcell.hh $(DESTDIR)$(PREFIX)/include/voro++
+ $(INSTALL) $(IFLAGS) src/v_base.hh $(DESTDIR)$(PREFIX)/include/voro++
+ $(INSTALL) $(IFLAGS) src/v_compute.hh $(DESTDIR)$(PREFIX)/include/voro++
+ $(INSTALL) $(IFLAGS) src/wall.hh $(DESTDIR)$(PREFIX)/include/voro++
+ $(INSTALL) $(IFLAGS) src/worklist.hh $(DESTDIR)$(PREFIX)/include/voro++
# Uninstall the executable, man page, and shared library
uninstall:
- rm -f $(PREFIX)/bin/voro++
- rm -f $(PREFIX)/man/man1/voro++.1
- rm -f $(PREFIX)/lib/libvoro++.a
- rm -f $(PREFIX)/include/voro++/voro++.hh
- rm -f $(PREFIX)/include/voro++/c_loops.hh
- rm -f $(PREFIX)/include/voro++/cell.hh
- rm -f $(PREFIX)/include/voro++/common.hh
- rm -f $(PREFIX)/include/voro++/config.hh
- rm -f $(PREFIX)/include/voro++/container.hh
- rm -f $(PREFIX)/include/voro++/container_prd.hh
- rm -f $(PREFIX)/include/voro++/pre_container.hh
- rm -f $(PREFIX)/include/voro++/rad_option.hh
- rm -f $(PREFIX)/include/voro++/unitcell.hh
- rm -f $(PREFIX)/include/voro++/v_base.hh
- rm -f $(PREFIX)/include/voro++/v_compute.hh
- rm -f $(PREFIX)/include/voro++/wall.hh
- rm -f $(PREFIX)/include/voro++/worklist.hh
- rmdir $(PREFIX)/include/voro++
+ rm -f $(DESTDIR)$(PREFIX)/bin/voro++
+ rm -f $(DESTDIR)$(PREFIX)/man/man1/voro++.1
+ rm -f $(DESTDIR)$(PREFIX)/lib/libvoro++.a
+ rm -f $(DESTDIR)$(PREFIX)/include/voro++/voro++.hh
+ rm -f $(DESTDIR)$(PREFIX)/include/voro++/c_loops.hh
+ rm -f $(DESTDIR)$(PREFIX)/include/voro++/cell.hh
+ rm -f $(DESTDIR)$(PREFIX)/include/voro++/common.hh
+ rm -f $(DESTDIR)$(PREFIX)/include/voro++/config.hh
+ rm -f $(DESTDIR)$(PREFIX)/include/voro++/container.hh
+ rm -f $(DESTDIR)$(PREFIX)/include/voro++/container_prd.hh
+ rm -f $(DESTDIR)$(PREFIX)/include/voro++/pre_container.hh
+ rm -f $(DESTDIR)$(PREFIX)/include/voro++/rad_option.hh
+ rm -f $(DESTDIR)$(PREFIX)/include/voro++/unitcell.hh
+ rm -f $(DESTDIR)$(PREFIX)/include/voro++/v_base.hh
+ rm -f $(DESTDIR)$(PREFIX)/include/voro++/v_compute.hh
+ rm -f $(DESTDIR)$(PREFIX)/include/voro++/wall.hh
+ rm -f $(DESTDIR)$(PREFIX)/include/voro++/worklist.hh
+ rmdir $(DESTDIR)$(PREFIX)/include/voro++

View File

@ -0,0 +1,27 @@
--- config.mk.orig 2013-10-17 17:54:13 UTC
+++ config.mk
@@ -8,20 +8,20 @@
# the Makefiles.
# C++ compiler
-CXX=g++
+CXX?=g++
# Flags for the C++ compiler
-CFLAGS=-Wall -ansi -pedantic -O3
+CFLAGS?=-Wall -ansi -pedantic -O3
# Relative include and library paths for compilation of the examples
E_INC=-I../../src
E_LIB=-L../../src
# Installation directory
-PREFIX=/usr/local
+PREFIX?=/usr/local
# Install command
-INSTALL=install
+INSTALL?=install
# Flags for install command for executable
IFLAGS_EXEC=-m 0755

View File

@ -0,0 +1,24 @@
--- src/Makefile.orig 2013-10-17 17:54:13 UTC
+++ src/Makefile
@@ -13,7 +13,7 @@ objs=cell.o common.o container.o unitcel
src=$(patsubst %.o,%.cc,$(objs))
# Makefile rules
-all: libvoro++.a voro++
+all: libvoro++.a libvoro++.so voro++
depend:
$(CXX) -MM $(src) >Makefile.dep
@@ -24,7 +24,11 @@ libvoro++.a: $(objs)
rm -f libvoro++.a
ar rs libvoro++.a $^
-voro++: libvoro++.a cmd_line.cc
+libvoro++.so: $(objs)
+ rm -f libvoro++.so
+ $(CXX) -shared $(LDFLAGS) -o libvoro++.so -Wl,-soname,libvoro++.so $^
+
+voro++: libvoro++.so cmd_line.cc
$(CXX) $(CFLAGS) -L. -o voro++ cmd_line.cc -lvoro++
%.o: %.cc

View File

@ -1,9 +1,9 @@
Voro++ is a software library for carrying out three-dimensional computations
of the Voronoi tessellation. A distinguishing feature of the Voro++ library
is that it carries out cell-based calculations, computing the Voronoi cell
for each particle individually. It is particularly well-suited for
applications that rely on cell-based statistics, where features of Voronoi
cells (eg. volume, centroid, number of faces) can be used to analyze a
system of particles.
of the Voronoi tessellation. A distinguishing feature of the Voro++ library is
that it carries out cell-based calculations, computing the Voronoi cell for
each particle individually. It is particularly well-suited for applications
that rely on cell-based statistics, where features of Voronoi cells (eg.
volume, centroid, number of faces) can be used to analyze a system of
particles.
WWW: http://math.lbl.gov/voro++/

View File

@ -14,4 +14,5 @@ include/voro++/voro++.hh
include/voro++/wall.hh
include/voro++/worklist.hh
lib/libvoro++.a
lib/libvoro++.so
man/man1/voro++.1.gz