# Work around a qmake bug where, in some cases, it will add an
# extraneous '-arch' flag. In other ports (and in previous versions of
# this one), this was handled with reinplace in the post-configure
# step. Unfortunately, Makefile.qmake doesn't exist at post-configure
# so this patch modifies the Makefile rule which creates
# Makefile.qmake to remove the '-arch' flag.

--- src/Makefile.am.orig	2015-03-14 13:56:11.000000000 -0400
+++ src/Makefile.am	2015-03-14 14:26:15.000000000 -0400
@@ -68,7 +68,8 @@
 		QMAKE_CPPFLAGS+='$(CPPFLAGS) $(qmake_allflags)' \
 		LIBS+='$(QMAKELIBS)' \
 		VPATH='$(srcdir)' -o - djview.pro |\
-	  $(AWK) -f $(top_srcdir)/config/qmsilent.awk > $@
+	  $(AWK) -f $(top_srcdir)/config/qmsilent.awk |\
#+	  $(SED) 's/-arch *-/-/g' > $@
+	  $(SED) -e 's/-arch *-/-/g' -e 's/-arch *\$//g' > $@
 
 # cleaning
 
--- src/Makefile.in.orig	2015-03-14 13:56:20.000000000 -0400
+++ src/Makefile.in	2015-03-14 14:26:46.000000000 -0400
@@ -677,7 +677,8 @@
 		QMAKE_CPPFLAGS+='$(CPPFLAGS) $(qmake_allflags)' \
 		LIBS+='$(QMAKELIBS)' \
 		VPATH='$(srcdir)' -o - djview.pro |\
-	  $(AWK) -f $(top_srcdir)/config/qmsilent.awk > $@
+	  $(AWK) -f $(top_srcdir)/config/qmsilent.awk |\
#+	  $(SED) 's/-arch *-/-/g' > $@
+	  $(SED) -e 's/-arch *-/-/g' -e 's/-arch *\$//g' > $@
 
 # cleaning
 
