distributable:
  url: https://downloads.sourceforge.net/project/netpbm/super_stable/{{version}}/netpbm-{{version}}.tgz
  strip-components: 1
versions:
  url: https://sourceforge.net/projects/netpbm/files/super_stable/
  match: /super_stable\/\d+\.\d+\.\d+\//
  strip:
    - /^super_stable\//
    - /\//
dependencies:
  github.com/jasper-software/jasper: '*'
  libjpeg-turbo.org: '*'
  libpng.org: '*'
  simplesystems.org/libtiff: '*'
  gnome.org/libxml2: '*'
  zlib.net: '*'
runtime:
  env:
    RGBDEF: "{{prefix}}/misc/rgb.txt"
build:
  dependencies:
    gnu.org/make: '*'
    github.com/westes/flex: '*'
    linux:
      perl.org: '*'
  script:
    - run: |
        sed -e 's|TIFFLIB = NONE|TIFFLIB = -ltiff|g' \
            -e 's|JPEGLIB = NONE|JPEGLIB = -ljpeg|g' \
            -e 's|PNGLIB = NONE|PNGLIB = -lpng|g' \
            -e 's|ZLIB = NONE|ZLIB = -lz|g' \
            -e 's|JASPERLIB = NONE|JASPERLIB = -ljasper|g' \
            config.mk.in >config.mk
    - run: |
        sed -i.bak \
            -e 's|CFLAGS_SHLIB = |CFLAGS_SHLIB = -fno-common|g' \
            -e 's|NETPBMLIBTYPE = unixshared|NETPBMLIBTYPE = dylib|g' \
            -e 's|NETPBMLIBSUFFIX = so|NETPBMLIBSUFFIX = dylib|g' \
            -e 's|LDSHLIB = -shared -Wl,-soname,$(SONAME)|LDSHLIB = --shared -o $(SONAME)|g' \
            config.mk
      if: darwin
    - run: sed -i.bak 's|CFLAGS_SHLIB = |CFLAGS_SHLIB = -fPIC|g' config.mk
      if: linux
    - rm config.mk.bak
    
    - make --jobs {{hw.concurrency}}
    - make --jobs {{hw.concurrency}} package pkgdir=$SRCROOT/stage
    - run: |
        mkdir -p {{prefix}}
        mv bin include lib misc {{prefix}}/
        
        mkdir -p {{prefix}}/lib/pkgconfig
        cp $PROP {{prefix}}/lib/pkgconfig/netpbm.pc
      working-directory: stage
      prop: |
        prefix=\${pcfiledir}/../..
        exec_prefix=\${prefix}
        libdir=\${exec_prefix}/lib
        includedir=\${prefix}/include/netpbm

        Name: Netpbm
        Description: Graphics utilities
        Version: {{version}}
        Libs: -L\${libdir} -lmylibrary
        Cflags: -I\${includedir}
  env:
    CFLAGS: "-Wno-implicit-function-declaration $CFLAGS"
provides:
  - bin/411toppm
  - bin/asciitopgm
  - bin/atktopbm
  - bin/avstopam
  - bin/bioradtopgm
  - bin/bmptopnm
  - bin/brushtopbm
  - bin/cameratopam
  - bin/cistopbm
  - bin/cmuwmtopbm
  - bin/ddbugtopbm
  - bin/escp2topbm
  - bin/eyuvtoppm
  - bin/fiascotopnm
  - bin/fitstopnm
  - bin/fstopgm
  - bin/gemtopnm
  - bin/giftopnm
  - bin/gouldtoppm
  - bin/hdifftopam
  - bin/hipstopgm
  - bin/ilbmtoppm
  - bin/imgtoppm
  - bin/infotopam
  - bin/jbigtopnm
  - bin/jpeg2ktopam
  - bin/jpegtopnm
  - bin/leaftoppm
  - bin/lispmtopgm
  - bin/macptopbm
  - bin/mdatopbm
  - bin/mgrtopbm
  - bin/mrftopbm
  - bin/mtvtoppm
  - bin/neotoppm
  - bin/palmtopnm
  - bin/pamaddnoise
  - bin/pamarith
  - bin/pambackground
  - bin/pambayer
  - bin/pamchannel
  - bin/pamcomp
  - bin/pamcrater
  - bin/pamcut
  - bin/pamdeinterlace
  - bin/pamdepth
  - bin/pamdice
  - bin/pamditherbw
  - bin/pamedge
  - bin/pamendian
  - bin/pamenlarge
  - bin/pamexec
  - bin/pamfile
  - bin/pamfix
  - bin/pamflip
  - bin/pamfunc
  - bin/pamgauss
  - bin/pamgradient
  - bin/pamlookup
  - bin/pammasksharpen
  - bin/pammixinterlace
  - bin/pammosaicknit
  - bin/pamoil
  - bin/pampaintspill
  - bin/pamperspective
  - bin/pampick
  - bin/pampop9
  - bin/pamrecolor
  - bin/pamrubber
  - bin/pamscale
  - bin/pamseq
  - bin/pamshadedrelief
  - bin/pamsharpmap
  - bin/pamsharpness
  - bin/pamsistoaglyph
  - bin/pamslice
  - bin/pamsplit
  - bin/pamstack
  - bin/pamstereogram
  - bin/pamstretch
  - bin/pamsumm
  - bin/pamsummcol
  - bin/pamthreshold
  - bin/pamtilt
  - bin/pamtoavs
  - bin/pamtodjvurle
  - bin/pamtofits
  - bin/pamtogif
  - bin/pamtohdiff
  - bin/pamtohtmltbl
  - bin/pamtojpeg2k
  - bin/pamtompfont
  - bin/pamtooctaveimg
  - bin/pamtopam
  - bin/pamtopdbimg
  - bin/pamtopfm
  - bin/pamtopng
  - bin/pamtopnm
  - bin/pamtosrf
  - bin/pamtosvg
  - bin/pamtotga
  - bin/pamtotiff
  - bin/pamtouil
  - bin/pamtowinicon
  - bin/pamtoxvmini
  - bin/pamundice
  - bin/pamunlookup
  - bin/pamvalidate
  - bin/pamwipeout
  - bin/pbmclean
  - bin/pbmlife
  - bin/pbmmake
  - bin/pbmmask
  - bin/pbmminkowski
  - bin/pbmpage
  - bin/pbmpscale
  - bin/pbmreduce
  - bin/pbmtext
  - bin/pbmtextps
  - bin/pbmto10x
  - bin/pbmto4425
  - bin/pbmtoascii
  - bin/pbmtoatk
  - bin/pbmtobbnbg
  - bin/pbmtocis
  - bin/pbmtocmuwm
  - bin/pbmtodjvurle
  - bin/pbmtoepsi
  - bin/pbmtoepson
  - bin/pbmtoescp2
  - bin/pbmtog3
  - bin/pbmtogem
  - bin/pbmtogo
  - bin/pbmtoibm23xx
  - bin/pbmtolj
  - bin/pbmtoln03
  - bin/pbmtolps
  - bin/pbmtomacp
  - bin/pbmtomatrixorbital
  - bin/pbmtomda
  - bin/pbmtomgr
  - bin/pbmtomrf
  - bin/pbmtonokia
  - bin/pbmtopgm
  - bin/pbmtopi3
  - bin/pbmtopk
  - bin/pbmtoplot
  - bin/pbmtoppa
  - bin/pbmtopsg3
  - bin/pbmtoptx
  - bin/pbmtosunicon
  - bin/pbmtowbmp
  - bin/pbmtoxbm
  - bin/pbmtoybm
  - bin/pbmtozinc
  - bin/pc1toppm
  - bin/pcxtoppm
  - bin/pdbimgtopam
  - bin/pfmtopam
  - bin/pgmabel
  - bin/pgmbentley
  - bin/pgmdeshadow
  - bin/pgmenhance
  - bin/pgmhist
  - bin/pgmkernel
  - bin/pgmmake
  - bin/pgmmedian
  - bin/pgmminkowski
  - bin/pgmmorphconv
  - bin/pgmnoise
  - bin/pgmramp
  - bin/pgmtexture
  - bin/pgmtofs
  - bin/pgmtolispm
  - bin/pgmtopbm
  - bin/pgmtopgm
  - bin/pgmtoppm
  - bin/pgmtosbig
  - bin/pgmtost4
  - bin/pi1toppm
  - bin/pi3topbm
  - bin/picttoppm
  - bin/pjtoppm
  - bin/pktopbm
  - bin/pngtopam
  - bin/pnmalias
  - bin/pnmcat
  - bin/pnmcolormap
  - bin/pnmconvol
  - bin/pnmcrop
  - bin/pnmgamma
  - bin/pnmhisteq
  - bin/pnmhistmap
  - bin/pnmindex
  - bin/pnminvert
  - bin/pnmmercator
  - bin/pnmmontage
  - bin/pnmnlfilt
  - bin/pnmnorm
  - bin/pnmpad
  - bin/pnmpaste
  - bin/pnmpsnr
  - bin/pnmremap
  - bin/pnmrotate
  - bin/pnmscalefixed
  - bin/pnmshear
  - bin/pnmsmooth
  - bin/pnmstitch
  - bin/pnmtile
  - bin/pnmtoddif
  - bin/pnmtofiasco
  - bin/pnmtojbig
  - bin/pnmtojpeg
  - bin/pnmtopalm
  - bin/pnmtopclxl
  - bin/pnmtopng
  - bin/pnmtops
  - bin/pnmtorast
  - bin/pnmtorle
  - bin/pnmtosgi
  - bin/pnmtosir
  - bin/pnmtotiffcmyk
  - bin/pnmtoxwd
  - bin/ppm3d
  - bin/ppmbrighten
  - bin/ppmchange
  - bin/ppmcie
  - bin/ppmcolormask
  - bin/ppmcolors
  - bin/ppmdcfont
  - bin/ppmdim
  - bin/ppmdist
  - bin/ppmdither
  - bin/ppmdmkfont
  - bin/ppmdraw
  - bin/ppmflash
  - bin/ppmforge
  - bin/ppmglobe
  - bin/ppmhist
  - bin/ppmlabel
  - bin/ppmmake
  - bin/ppmmix
  - bin/ppmntsc
  - bin/ppmpat
  - bin/ppmrelief
  - bin/ppmrough
  - bin/ppmshift
  - bin/ppmspread
  - bin/ppmtoacad
  - bin/ppmtoapplevol
  - bin/ppmtoarbtxt
  - bin/ppmtoascii
  - bin/ppmtobmp
  - bin/ppmtoeyuv
  - bin/ppmtogif
  - bin/ppmtoicr
  - bin/ppmtoilbm
  - bin/ppmtoleaf
  - bin/ppmtolj
  - bin/ppmtomitsu
  - bin/ppmtompeg
  - bin/ppmtoneo
  - bin/ppmtopcx
  - bin/ppmtopgm
  - bin/ppmtopi1
  - bin/ppmtopict
  - bin/ppmtopj
  - bin/ppmtopjxl
  - bin/ppmtoppm
  - bin/ppmtopuzz
  - bin/ppmtorgb3
  - bin/ppmtosixel
  - bin/ppmtospu
  - bin/ppmtoterm
  - bin/ppmtowinicon
  - bin/ppmtoxpm
  - bin/ppmtoyuv
  - bin/ppmtoyuvsplit
  - bin/ppmtv
  - bin/psidtopgm
  - bin/pstopnm
  - bin/qrttoppm
  - bin/rasttopnm
  - bin/rawtopgm
  - bin/rawtoppm
  - bin/rgb3toppm
  - bin/rlatopam
  - bin/rletopnm
  - bin/sbigtopgm
  - bin/sgitopnm
  - bin/sirtopnm
  - bin/sldtoppm
  - bin/spctoppm
  - bin/spottopgm
  - bin/sputoppm
  - bin/srftopam
  - bin/st4topgm
  - bin/sunicontopnm
  - bin/svgtopam
  - bin/tgatoppm
  - bin/thinkjettopbm
  - bin/tifftopnm
  - bin/wbmptopbm
  - bin/winicontopam
  - bin/winicontoppm
  - bin/xbmtopbm
  - bin/ximtoppm
  - bin/xpmtoppm
  - bin/xvminitoppm
  - bin/xwdtopnm
  - bin/ybmtopbm
  - bin/yuvsplittoppm
  - bin/yuvtoppm
  - bin/yuy2topam
  - bin/zeisstopnm
test:
  dependencies:
    freedesktop.org/pkg-config: '*'
  script:
    - pngtopam test.png -alphapam > test.pam
    - pamdice test.pam -outstem ./test
    - ls | grep "test_0_0.pam"
    - xpmtoppm test.xpm
    - pkg-config --modversion netpbm | grep {{version}}
