[macports-ports] 05/11: triangle: fix universal build

Ryan Schmidt ryandesign at macports.org
Sat Sep 16 23:43:06 UTC 2017


> On Sep 16, 2017, at 17:47, Marcus Calhoun-Lopez <mcalhoun at macports.org> wrote:
> 
> Marcus Calhoun-Lopez (MarcusCalhoun-Lopez) pushed a commit to branch master
> in repository macports-ports.
> 
> 
> https://github.com/macports/macports-ports/commit/e9b61886655093d37a0691342924c20587495a8a
> 
> commit e9b61886655093d37a0691342924c20587495a8a
> 
> Author: Marcus Calhoun-Lopez <marcuscalhounlopez at gmail.com>
> AuthorDate: Sat Sep 16 14:39:34 2017 -0700
> 
> 
>     triangle: fix universal build
> 
> ---
>  science/triangle/Portfile                  | 21 ++++++++++++++-------
>  science/triangle/files/patch-makefile.diff | 28 ++++++++++++++++++++++++++++
>  2 files changed, 42 insertions(+), 7 deletions(-)
> 
> 
> diff --git a/science/triangle/Portfile b/science/triangle/Portfile

> +post-patch  {
> +    reinplace "s|__MACPORTS_CC__|${configure.cc}|g" ${worksrcpath}/makefile
> +    reinplace "s|__MACPORTS_PREFIX__|${prefix}|g" ${worksrcpath}/makefile
> +    if {[variant_isset universal]} {
> +        reinplace "s|__MACPORTS_CFLAGS__|${configure.cflags} ${configure.universal_cflags}|g" ${worksrcpath}/makefile
> +    } else {
> +        reinplace "s|__MACPORTS_CFLAGS__|${configure.cflags} ${configure.cc_archflags}|g"     ${worksrcpath}/makefile
> +    }
> +    reinplace "s|__MACPORTS_LDFLAGS__|${configure.ldflags}|g" ${worksrcpath}/makefile
>  }

It's simpler to use [get_canonical_archflags cc] than to write a conditional about the universal variant. The LDFLAGS probably also need [get_canonical_archflags ld].


> diff --git a/science/triangle/files/patch-makefile.diff b/science/triangle/files/patch-makefile.diff
> new file mode 100644
> index 0000000..15433ef
> --- /dev/null
> +++ b/science/triangle/files/patch-makefile.diff
> @@ -0,0 +1,28 @@
> +--- makefile.orig	2005-07-27 17:22:01.000000000 -0700
> ++++ makefile	2017-09-10 00:15:00.000000000 -0700
> +@@ -18,7 +18,7 @@
> + 
> + # CC should be set to the name of your favorite C compiler.
> + 
> +-CC = cc
> ++CC = /usr/bin/clang
> + 
> + # CSWITCHES is a list of all switches passed to the C compiler.  I strongly
> + #   recommend using the best level of optimization.  I also strongly
> +@@ -73,7 +73,7 @@
> + #
> + #   CSWITCHES = -O -DNO_TIMER -DLINUX -I/usr/X11R6/include -L/usr/X11R6/lib
> + 
> +-CSWITCHES = -O -DLINUX -I/usr/X11R6/include -L/usr/X11R6/lib
> ++CSWITCHES = -Os -arch x86_64 -arch i386
> + 
> + # TRILIBDEFS is a list of definitions used to compile an object code version
> + #   of Triangle (triangle.o) to be called by another program.  The file
> +@@ -97,6 +97,7 @@
> + all: $(BIN)triangle $(BIN)showme
> + 
> + trilibrary: $(BIN)triangle.o $(BIN)tricall
> ++	$(CC) -dynamiclib -L/opt/local/lib -Wl,-headerpad_max_install_names -install_name /opt/local/lib/libtriangle.dylib -o libtriangle.dylib triangle.o
> + 
> + $(BIN)triangle: $(SRC)triangle.c
> + 	$(CC) $(CSWITCHES) -o $(BIN)triangle $(SRC)triangle.c -lm

I think you've inadvertently committed this file with your placeholders expanded.




More information about the macports-dev mailing list