commit:     bcaa18be3312e4871f31b3b20656027fdb9b5c54
Author:     Viorel Munteanu <ceamac.paragon <AT> gmail <DOT> com>
AuthorDate: Sat Mar 27 13:03:28 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Mar 27 16:42:36 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bcaa18be

media-gfx/xpaint: fix compiling in gentoo prefix

Package-Manager: Portage-3.0.13, Repoman-3.0.2
Signed-off-by: Viorel Munteanu <ceamac.paragon <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/20036
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../xpaint/files/xpaint-3.1.3-gentoo-prefix.patch  | 103 +++++++++++++++++++++
 ...gs-strip.patch => xpaint-3.1.3-gentoo-qa.patch} |   8 +-
 .../xpaint/files/xpaint-3.1.3-libtool-clang.patch  |  26 ++++++
 media-gfx/xpaint/xpaint-3.1.3.ebuild               |  16 +++-
 4 files changed, 147 insertions(+), 6 deletions(-)

diff --git a/media-gfx/xpaint/files/xpaint-3.1.3-gentoo-prefix.patch 
b/media-gfx/xpaint/files/xpaint-3.1.3-gentoo-prefix.patch
new file mode 100644
index 00000000000..cf02a14725f
--- /dev/null
+++ b/media-gfx/xpaint/files/xpaint-3.1.3-gentoo-prefix.patch
@@ -0,0 +1,103 @@
+This patch fixes compiling xpaint inside a gentoo prefix.
+There are multiple issues:
+       search paths hardcoded to /usr/include,
+       install paths outside prefix,
+       X resources in app-defaults with path hardcoded to /usr/share/xpaint
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -3,7 +3,7 @@
+ ## Local Configuration arguments
+ BINDIR = $(prefix)/bin
+ SHAREDIR = $(prefix)/share/xpaint
+-XAPPLOADDIR = /etc/X11/app-defaults
++XAPPLOADDIR = $(sysconfdir)/X11/app-defaults
+ 
+ ## Enable/disable PRINTCAP (for older BSD style printing configuration)
+ ## PRINTCAP = -DPRINTCAP
+@@ -85,7 +85,7 @@
+ .PHONY:
+ 
+ version.h:
+-      rm -f xaw_incdir ; ln -s /usr/include/X11/Xaw3dxft xaw_incdir
++      rm -f xaw_incdir ; ln -s @includedir@/X11/Xaw3dxft xaw_incdir
+       echo "#define XPAINT_VERSION \"$(PACKAGE_VERSION)\"" > version.h
+ 
+ substads: substads.c
+@@ -149,8 +149,7 @@
+       mkdir -p $(DESTDIR)$(SHAREDIR)/messages
+       cd share/messages ; $(RM) -f *~ ; cp -f Messages* 
$(DESTDIR)$(SHAREDIR)/messages
+       chmod -R a+r $(DESTDIR)$(SHAREDIR)/
+-      cd util ; make install
+-      cd vxp2ps ; make install
++      cd vxp2ps ; make BINDIR=$(BINDIR) install
+ 
+ clean-local:
+       rm -f xaw_incdir
+--- a/util/Makefile
++++ b/util/Makefile
+@@ -17,9 +17,9 @@
+ 
+ ifneq ($(WITH_PGF),no)
+ pgf2pnm: main.cpp pnm.cpp
+-      @if [ -x /usr/include/libpgf ] ; then \
+-      $(CXX) $(CXXFLAGS) -fpermissive -c main.cpp -o main.o 
-I/usr/include/libpgf ; \
+-      $(CXX) $(CXXFLAGS) -fpermissive -c pnm.cpp -o pnm.o 
-I/usr/include/libpgf ; \
++      @if [ -x $(includedir)/libpgf ] ; then \
++      $(CXX) $(CXXFLAGS) -fpermissive -c main.cpp -o main.o 
-I$(includedir)/libpgf ; \
++      $(CXX) $(CXXFLAGS) -fpermissive -c pnm.cpp -o pnm.o 
-I$(includedir)/libpgf ; \
+       $(CXX) $(CXXFLAGS) -fpermissive -o pgf2pnm main.o pnm.o $(LDFLAGS) 
-lpgf ; \
+       else \
+       echo "libpgf not installed !!" ; \
+--- a/configure.ac
++++ b/configure.ac
+@@ -32,7 +32,7 @@
+ AC_TYPE_UINT32_T
+ AC_TYPE_UINT64_T
+ 
+-CFLAGS="$CFLAGS -I/usr/include -I/usr/include/X11 -I/usr/include/X11/Xaw3dxft"
++CFLAGS="$CFLAGS -I${prefix}/include -I${prefix}/include/X11 
-I${prefix}/include/X11/Xaw3dxft"
+ LIBS="$LIBS -lm"
+ echo "VERSION = $VERSION" > .version
+ 
+@@ -40,7 +40,7 @@
+ AC_CHECK_LIB([X11], [XOpenDisplay], have_x11="yes")
+ if test x"$have_x11" = xyes; then
+   AC_SUBST([X_LIBS], ["-lXmu -lXt -lSM -lICE -lXext -lX11 -lXpm -ldl 
-rdynamic"])
+-  AC_SUBST([X_CFLAGS], ["-I/usr/include/X11"])
++  AC_SUBST([X_CFLAGS], ["-I${prefix}/include/X11"])
+ else
+   echo "X11 libraries not installed !"
+   exit 1
+@@ -291,7 +291,7 @@
+ fi
+ 
+ if test x$enable_libopenjp2 = xyes; then
+-  CFLAGS="$CFLAGS -I/usr/include/openjpeg-2.3"
++  CFLAGS="$CFLAGS -I${prefix}/include/openjpeg-2.3"
+   LIBS="$LIBS -lopenjp2"
+   AC_SUBST(LIBOPENJP2_LIBS)
+   AC_DEFINE(HAVE_OPENJP2)
+@@ -323,9 +323,9 @@
+   [AC_LANG_PROGRAM([[#include <freetype2/config/ftheader.h>]])],
+   [AC_MSG_RESULT([already in path])],
+   [AC_PREPROC_IFELSE(
+-    [AC_LANG_PROGRAM([[#include 
</usr/include/freetype2/freetype/config/ftheader.h>]])],
+-    [AC_MSG_RESULT([/usr/include/freetype2])
+-     AC_SUBST([SPECIAL_CFLAGS], ["-I/usr/include/freetype2"])],
++    [AC_LANG_PROGRAM([[#include 
<${prefix}/include/freetype2/freetype/config/ftheader.h>]])],
++    [AC_MSG_RESULT([${prefix}/include/freetype2])
++     AC_SUBST([SPECIAL_CFLAGS], ["-I${prefix}/include/freetype2"])],
+     [AC_MSG_ERROR([cannot find freetype2 headers; try setting CFLAGS.])]
+   )]
+ )
+--- a/xpaintrw/Makefile.am
++++ b/xpaintrw/Makefile.am
+@@ -13,7 +13,7 @@
+ ARCH_DEFINES = -fPIC
+ 
+ ## PBM_DEFINES = -DNETPBM10
+-PBM_DEFINES = -I/usr/include/netpbm -DNETPBM11
++PBM_DEFINES = -I@includedir@/netpbm -DNETPBM11
+ 
+ ## 
+ ## Specific xpaint options

diff --git a/media-gfx/xpaint/files/xpaint-3.1.3-cflags-ldflags-strip.patch 
b/media-gfx/xpaint/files/xpaint-3.1.3-gentoo-qa.patch
similarity index 84%
rename from media-gfx/xpaint/files/xpaint-3.1.3-cflags-ldflags-strip.patch
rename to media-gfx/xpaint/files/xpaint-3.1.3-gentoo-qa.patch
index f0677c0d713..cc7d70de6f3 100644
--- a/media-gfx/xpaint/files/xpaint-3.1.3-cflags-ldflags-strip.patch
+++ b/media-gfx/xpaint/files/xpaint-3.1.3-gentoo-qa.patch
@@ -1,6 +1,6 @@
-The original Makefiles did not pass CFLAGS and LDFLAGS, causing QA warnings
-See also bug https://bugs.gentoo.org/727632
-Also remove -O3 and stripping, leave portage control that
+The original Makefile did not pass CFLAGS and LDFLAGS
+See bug https://bugs.gentoo.org/727632
+Also remove -O3 and stripping
 --- a/vxp2ps/Makefile
 +++ b/vxp2ps/Makefile
 @@ -3,16 +3,16 @@
@@ -20,7 +20,7 @@ Also remove -O3 and stripping, leave portage control that
  
  install: all
 -      install -c -s vxp2ps vxp2tex vxp2dkw "$(DESTDIR)"/usr/bin
-+      install -c vxp2ps vxp2tex vxp2dkw "$(DESTDIR)"/usr/bin
++      install -c vxp2ps vxp2tex vxp2dkw "$(DESTDIR)$(BINDIR)"
  
  clean:
        rm -f core *~ vxp2ps vxp2tex vxp2dkw

diff --git a/media-gfx/xpaint/files/xpaint-3.1.3-libtool-clang.patch 
b/media-gfx/xpaint/files/xpaint-3.1.3-libtool-clang.patch
new file mode 100644
index 00000000000..92ccb899ce1
--- /dev/null
+++ b/media-gfx/xpaint/files/xpaint-3.1.3-libtool-clang.patch
@@ -0,0 +1,26 @@
+libtool doesn't work if compiling with clang.  Need to add --tag=CC
+Also don't hardcode /usr/bin/tool in gentoo prefix
+See bug https://bugs.gentoo.org/731010
+--- a/configure.ac
++++ b/configure.ac
+@@ -17,6 +17,9 @@
+ AC_LANG_C
+ AM_PROG_AR
+ 
++dnl search libtool
++AC_PATH_PROG([PROGLIBTOOL], [libtool])
++
+ ## basic types
+ 
+ AC_TYPE_INT8_T
+--- a/xpaintrw/Makefile.am
++++ b/xpaintrw/Makefile.am
+@@ -28,7 +28,7 @@
+ 
+ xpaint_DEFINES = $(ARCH_DEFINES) $(EXTRA_DEFINES) $(XAWLIB_DEFINES)
+ 
+-LIBTOOL = /usr/bin/libtool
++LIBTOOL = @PROGLIBTOOL@ --tag=CC
+ AM_CFLAGS   = @X_CFLAGS@ @SPECIAL_CFLAGS@ $(xpaint_DEFINES)
+ AM_YFLAGS     = -d
+ CLEANFILES    = 

diff --git a/media-gfx/xpaint/xpaint-3.1.3.ebuild 
b/media-gfx/xpaint/xpaint-3.1.3.ebuild
index a853557cf49..131d8059027 100644
--- a/media-gfx/xpaint/xpaint-3.1.3.ebuild
+++ b/media-gfx/xpaint/xpaint-3.1.3.ebuild
@@ -42,11 +42,13 @@ BDEPEND="
        sys-devel/flex
        sys-devel/libtool
        virtual/pkgconfig
+       x11-misc/imake
 "
 
 PATCHES=(
-       "${FILESDIR}"/${PN}-2.10.2-libtool-clang.patch
-       "${FILESDIR}"/${P}-cflags-ldflags-strip.patch
+       "${FILESDIR}"/${P}-libtool-clang.patch
+       "${FILESDIR}"/${P}-gentoo-qa.patch
+       "${FILESDIR}"/${P}-gentoo-prefix.patch
 )
 
 src_prepare() {
@@ -55,6 +57,12 @@ src_prepare() {
 }
 
 src_configure() {
+       # regenerate resources in app-defaults
+       # Local.xawdefs is missing and imake was complaining about it, so use 
it to redefine SHAREDIR
+       echo "SHAREDIR = \"${EPREFIX}\"/usr/share/xpaint" > Local.xawdefs || die
+       xmkmf || die
+       mv Makefile Makefile.resources || die
+
        econf \
                $(use_enable tiff) \
                --disable-libdvipgm \
@@ -75,7 +83,11 @@ src_compile() {
                WITH_PGF="$(usex pgf "yes" "no")" \
                CC="$(tc-getCC)" \
                CXX="$(tc-getCXX)" \
+               includedir="${EPREFIX}"/usr/include \
                -C util
+
+       # regenerate resources in app-defaults
+       (rm XPaint.ad && emake -f Makefile.resources XPaint.ad) || die
 }
 
 src_install() {

Reply via email to