media-libs/netpbm: handle more test failures when USE flags are disabled #600998
authorMike Frysinger <vapier@gentoo.org>
Sun, 27 Nov 2016 17:53:11 +0000 (12:53 -0500)
committerMike Frysinger <vapier@gentoo.org>
Sun, 27 Nov 2016 17:54:27 +0000 (12:54 -0500)
media-libs/netpbm/files/netpbm-10.76.00-misc-deps.patch [new file with mode: 0644]
media-libs/netpbm/files/netpbm-10.76.00-test.patch
media-libs/netpbm/netpbm-10.76.00.ebuild

diff --git a/media-libs/netpbm/files/netpbm-10.76.00-misc-deps.patch b/media-libs/netpbm/files/netpbm-10.76.00-misc-deps.patch
new file mode 100644 (file)
index 0000000..392eae0
--- /dev/null
@@ -0,0 +1,68 @@
+do not autoprobe deps when we disabled them
+
+--- GNUmakefile
++++ GNUmakefile
+@@ -74,7 +74,10 @@ include $(BUILDDIR)/config.mk
+ PROG_SUBDIRS = converter analyzer editor generator other
+ PRODUCT_SUBDIRS = lib $(PROG_SUBDIRS)
+-SUPPORT_SUBDIRS = urt icon buildtools test
++SUPPORT_SUBDIRS = icon buildtools test
++ifeq ($(URTLIB),$(BUNDLED_URTLIB))
++SUPPORT_SUBDIRS += urt
++endif
+ SUBDIRS = $(PRODUCT_SUBDIRS) $(SUPPORT_SUBDIRS)
+--- converter/other/Makefile
++++ converter/other/Makefile
+@@ -7,6 +7,7 @@ VPATH=.:$(SRCDIR)/$(SUBDIR)
+ include $(BUILDDIR)/config.mk
++ifneq ($(XML2_LIBS),NONE)
+ TEST_PKGCONFIG_LIBXML2 = if pkg-config libxml-2.0; then echo exists; fi
+ ifneq ($(shell $(TEST_PKGCONFIG_LIBXML2)),)
+@@ -22,6 +23,7 @@ else
+     XML2_CFLAGS=$(shell xml2-config --cflags)
+   endif
+ endif
++endif
+ SUBDIRS = jbig pnmtopalm jpeg2000 cameratopam pamtosvg
+ ifneq ($(BUILD_FIASCO), N)
+@@ -34,6 +36,7 @@ ifneq ($(TIFFLIB),NONE)
+   endif
+ endif
++ifneq ($(PNGLIB),NONE)
+ TEST_PKGCONFIG_LIBPNG = if pkg-config libpng$(PNGVER); then echo exists; fi
+ ifneq ($(shell $(TEST_PKGCONFIG_LIBPNG)),)
+@@ -58,6 +61,7 @@ else
+     endif
+   endif
+ endif
++endif
+ ifneq ($(JPEGLIB),NONE)
+   ifneq ($(JPEGHDR_DIR)x,x)
+--- other/pamx/Makefile
++++ other/pamx/Makefile
+@@ -9,6 +9,7 @@ include $(BUILDDIR)/config.mk
+ EXTERN_INCLUDE =
++ifneq ($(X11LIB),NONE)
+ ifeq ($(shell pkg-config x11 --modversion --silence-errors),)
+   # Pkg-config has never heard of X11, or doesn't even exist
+@@ -23,6 +24,7 @@ else
+   X11LIB = $(shell pkg-config x11 --libs)
+   EXTERN_INCLUDES += $(shell pkg-config x11 --cflags)
+ endif
++endif
+ ifeq ($(HAVE_X11LIB),Y)
+   PORTBINARIES += pamx
index 868358cc1a3de5adf623290824a55d2c2144e784..870998bc98a8af46add8978659fa815a93a4f22b 100644 (file)
@@ -2,7 +2,7 @@ automatically skip tests of disabled tools
 
 --- GNUmakefile
 +++ GNUmakefile
-@@ -455,6 +455,17 @@ deb:
+@@ -455,6 +458,21 @@ deb:
  .PHONY: check-package
  .PHONY: check-install
  
@@ -14,13 +14,17 @@ automatically skip tests of disabled tools
 +      JASPERLIB="$(JASPERLIB)" \
 +      JBIGLIB="$(JBIGLIB)" \
 +      JPEGLIB="$(JPEGLIB)" \
++      PNGLIB="$(PNGLIB)" \
 +      TIFFLIB="$(TIFFLIB)" \
-+      URTLIB="$(URTLIB)"
++      URTLIB="$(URTLIB)" \
++      X11LIB="$(X11LIB)" \
++      XML2_LIBS="$(XML2_LIBS)" \
++      ZLIB="$(ZLIB)"
 +
  # Test files in source tree.
  
  check-tree : BUILDBINDIRS :=./analyzer \
-@@ -525,10 +536,10 @@ resultdir-backup: FORCE
+@@ -525,10 +543,10 @@ resultdir-backup: FORCE
  
  check-tree: $(TESTRANDOM) resultdir-backup
        cd $(RESULTDIR); \
@@ -33,7 +37,7 @@ automatically skip tests of disabled tools
          $(SRCDIR)/test/Execute-Tests 2>&1
  
  # Execute-Tests needs to know BUILDDIR in order to locate testrandom.
-@@ -545,19 +556,18 @@ check: check-package
+@@ -545,19 +563,18 @@ check: check-package
  
  check-package: $(TESTRANDOM) resultdir-backup
        cd $(RESULTDIR); \
@@ -58,7 +62,7 @@ automatically skip tests of disabled tools
  
 --- test/all-in-place.test
 +++ test/all-in-place.test
-@@ -367,11 +367,49 @@ ordinary_testprogs="\
+@@ -367,11 +367,62 @@ ordinary_testprogs="\
    zeisstopnm \
  "
  
@@ -81,6 +85,16 @@ automatically skip tests of disabled tools
 +      ppmtojpeg)
 +        [ "${JPEGLIB}" = "NONE" ] && return 1 ;;
 +
++      pamtopng|\
++      pngtopam|\
++      pnmtopng)
++        [ "${PNGLIB}" = "NONE" ] && return 1 ;;
++
++      svgtopam)
++        [ "${PNGLIB}" = "NONE" ] && return 1
++        [ "${XML2_LIBS}" = "NONE" ] && return 1
++        ;;
++
 +      pamtotiff|\
 +      pnmtotiffcmyk|\
 +      tifftopnm)
@@ -89,6 +103,9 @@ automatically skip tests of disabled tools
 +      pnmtorle|\
 +      rletopnm)
 +        [ "${URTLIB}" = "NONE" ] && return 1 ;;
++
++      pamx)
++        [ "${X11LIB}" = "NONE" ] && return 1 ;;
 +    esac
 +
 +    return 0
@@ -133,6 +150,78 @@ automatically skip tests of disabled tools
  
  # Test 1.  Should print 2425386270 41
  pnmtojbig testgrid.pbm | jbigtopnm | cksum
+--- test/legacy-names.test
++++ test/legacy-names.test
+@@ -94,8 +94,30 @@ ordinary_testprogs="\
+   ppmtouil \
+ "
++enabled_testprog() {
++    case $1 in
++      ppmtojpeg)
++        [ "${JPEGLIB}" = "NONE" ] && return 1 ;;
++
++      pamrgbatopng|\
++      pngtopnm)
++        [ "${PNGLIB}" = "NONE" ] && return 1 ;;
++
++      pnmtotiff)
++        [ "${TIFFLIB}" = "NONE" ] && return 1 ;;
++    esac
++
++    return 0
++}
++
+ for i in $ordinary_testprogs
+   do
++    # Stub out programs that aren't built.
++    if ! enabled_testprog "$i"; then
++      echo "$i: ok"
++      continue
++    fi
++
+     $i --version  2>&1 | \
+     egrep -v \
+     "(Using libnetpbm|Compiled|(BSD|SYSV|MSDOS|AMIGA) defined|RGB_?ENV=)" \
+--- test/png-roundtrip.test
++++ test/png-roundtrip.test
+@@ -6,6 +6,10 @@
+ ## If this test fails and pnm-roundtrip2.test succeeds, it indicates
+ ## some problem with pnmtopng.
++if [ "${PNGLIB}" = "NONE" ]; then
++  exit 80
++fi
++
+ # Test 1.  Should print 1926073387 101484 18 times
+ for flags in "" -interlace \
+   -gamma=.45 \
+--- test/png-roundtrip2.test
++++ test/png-roundtrip2.test
+@@ -9,6 +9,10 @@
+ ## If both tests fail, the likely cause is a problem with pngtopam.
+ ## It is also possible that there is some problem in libpng.
++if [ "${PNGLIB}" = "NONE" ]; then
++  exit 80
++fi
++
+ # Test 1.  Should print 1926073387 101484 twice
+ for flags in "" -gamma=.45
+   do
+--- test/ps-roundtrip.test
++++ test/ps-roundtrip.test
+@@ -8,6 +8,10 @@
+ ## (1) zlib was not linked.
+ ## (2) ghostscript is not available.
++if [ "${ZLIB}" = "NONE" ]; then
++  exit 80
++fi
++
+ tmpdir=${tmpdir:-/tmp}
+ # pstopnm does not use libnetpbm functions for output.
 --- test/tiff-roundtrip.test
 +++ test/tiff-roundtrip.test
 @@ -2,6 +2,9 @@
index a63466ff1253ec65a925165a26739bc3c5622212..5be50fe5e35d2f1983fc771963f750e0df842b6d 100644 (file)
@@ -12,12 +12,13 @@ SRC_URI="mirror://gentoo/${P}.tar.xz"
 LICENSE="GPL-2"
 SLOT="0"
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
-IUSE="doc jbig jpeg jpeg2k png rle cpu_flags_x86_sse2 static-libs svga tiff X xml zlib"
+IUSE="doc jbig jpeg jpeg2k png postscript rle cpu_flags_x86_sse2 static-libs svga tiff X xml zlib"
 
 RDEPEND="jbig? ( media-libs/jbigkit )
        jpeg? ( virtual/jpeg:0 )
        jpeg2k? ( media-libs/jasper )
        png? ( >=media-libs/libpng-1.4:0 )
+       postscript? ( app-text/ghostscript-gpl )
        rle? ( media-libs/urt )
        svga? ( media-libs/svgalib )
        tiff? ( >=media-libs/tiff-3.5.5:0 )
@@ -55,6 +56,7 @@ netpbm_config() {
 src_prepare() {
        epatch "${FILESDIR}"/netpbm-10.76.00-build.patch
        epatch "${FILESDIR}"/netpbm-10.76.00-test.patch #450530
+       epatch "${FILESDIR}"/netpbm-10.76.00-misc-deps.patch
 
        # make sure we use system libs
        sed -i '/SUPPORT_SUBDIRS/s:urt::' GNUmakefile || die
@@ -69,6 +71,21 @@ src_prepare() {
        sed -i \
                -e '/%.c/s: importinc$::' \
                common.mk lib/Makefile lib/util/Makefile || die
+       sed -i \
+               -e 's:pkg-config:$(PKG_CONFIG):' \
+               GNUmakefile converter/other/Makefile other/pamx/Makefile || die
+
+       # The postscript knob is currently bound up with a fork test.
+       if ! use postscript ; then
+               sed -i \
+                       -e 's:$(DONT_HAVE_PROCESS_MGMT):Y:' \
+                       converter/other/Makefile generator/Makefile || die
+               sed -i -r \
+                       -e 's:(pbmtextps|pnmtops|pstopnm).*::' \
+                       test/all-in-place.{ok,test} || die
+               sed -i -e '/^$/d' test/all-in-place.ok || die
+               sed -i '2iexit 80' test/ps-{alt-,}roundtrip.test || die
+       fi
 
        # avoid ugly depend.mk warnings
        touch $(find . -name Makefile | sed s:Makefile:depend.mk:g)
@@ -91,6 +108,7 @@ src_configure() {
        LD_FOR_BUILD = \$(CC_FOR_BUILD)
        AR = $(tc-getAR)
        RANLIB = $(tc-getRANLIB)
+       PKG_CONFIG = $(tc-getPKG_CONFIG)
 
        STRIPFLAG =
        CFLAGS_SHLIB = -fPIC