From 367c9cb514c9da766488b9bdb218a18e31cb7624 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sun, 27 Mar 2016 01:38:28 +0000 Subject: Promote Stable (10.47) to Super Stable git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@2691 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- buildtools/Makefile | 12 +- buildtools/Makefile.manpage | 366 ------------------------ buildtools/README.pkg | 10 + buildtools/configure.pl | 663 +++++++++++++++++++++++++++++--------------- buildtools/debian/README | 122 -------- buildtools/debian/mkdeb | 541 ------------------------------------ buildtools/debian/postinst | 5 - buildtools/debian/postrm | 5 - buildtools/endiangen.c | 6 +- buildtools/installnetpbm.pl | 14 +- buildtools/installosf | 2 +- buildtools/libopt.c | 10 +- buildtools/makeman | 50 ++-- buildtools/makepointerman | 10 +- buildtools/manpage.mk | 414 +++++++++++++++++++++++++++ 15 files changed, 922 insertions(+), 1308 deletions(-) delete mode 100644 buildtools/Makefile.manpage delete mode 100644 buildtools/debian/README delete mode 100755 buildtools/debian/mkdeb delete mode 100755 buildtools/debian/postinst delete mode 100755 buildtools/debian/postrm create mode 100644 buildtools/manpage.mk (limited to 'buildtools') diff --git a/buildtools/Makefile b/buildtools/Makefile index 8ea61abe..9c0ee778 100644 --- a/buildtools/Makefile +++ b/buildtools/Makefile @@ -4,7 +4,7 @@ ifeq ($(SRCDIR)x,x) endif SUBDIR = buildtools VPATH = .:$(SRCDIR)/$(SUBDIR) -include $(BUILDDIR)/Makefile.config +include $(BUILDDIR)/config.mk MERGE_OBJECTS = @@ -17,7 +17,7 @@ BINARIES = SCRIPTS = OMIT_BUILDTOOL_RULE = 1 -include $(SRCDIR)/Makefile.common +include $(SRCDIR)/common.mk ifdef DLLVER STRIP_DLL_VERSION=-DDLLVERSTR="\"$(DLLVER)\"" @@ -28,16 +28,16 @@ EXPLICIT=-DEXPLICIT endif libopt.o: libopt.c - $(CC_FOR_BUILD) -c $(CFLAGS_FOR_BUILD) \ + $(CC_FOR_BUILD) -c -o $@ $(CFLAGS_FOR_BUILD) \ -DSHLIBPREFIXLIST="\"$(SHLIBPREFIXLIST)\"" \ $(STRIP_DLL_VERSION) $(EXPLICIT) $(CFLAGS_PERSONAL) $(CADD) \ - -o $@ $< + $< typegen.o endiangen.o:%.o:%.c - $(CC_FOR_BUILD) -c $(CFLAGS_FOR_BUILD) -o $@ $< + $(CC_FOR_BUILD) -c -o $@ $(CFLAGS_FOR_BUILD) $< $(PROGS):%:%.o - $(LD_FOR_BUILD) -o $@ $< + $(LD_FOR_BUILD) -o $@ $(LDFLAGS_FOR_BUILD) $< distclean clean: cleanlocal .PHONY: cleanlocal diff --git a/buildtools/Makefile.manpage b/buildtools/Makefile.manpage deleted file mode 100644 index e8c17972..00000000 --- a/buildtools/Makefile.manpage +++ /dev/null @@ -1,366 +0,0 @@ -# -*-makefile-*- <-- an Emacs control - -# Make Unix man pages from Netpbm HTML user manual - -MAKEMAN = makeman - -MANDIR = /usr/share/man/man1 - -# These can convert to man pages cleanly -MAN1 = \ - 411toppm.1 \ - anytopnm.1 \ - asciitopgm.1 \ - atktopbm.1 \ - bioradtopgm.1 \ - bmptopnm.1 \ - bmptoppm.1 \ - brushtopbm.1 \ - cmuwmtopbm.1 \ - ddbugtopbm.1 \ - escp2topbm.1 \ - eyuvtoppm.1 \ - fiascotopnm.1 \ - fitstopnm.1 \ - fstopgm.1 \ - g3topbm.1 \ - gemtopbm.1 \ - gemtopnm.1 \ - giftopnm.1 \ - gouldtoppm.1 \ - hdifftopam.1 \ - hipstopgm.1 \ - hpcdtoppm.1 \ - icontopbm.1 \ - ilbmtoppm.1 \ - imgtoppm.1 \ - infotopam.1 \ - jbigtopnm.1 \ - jpeg2ktopam.1 \ - jpegtopnm.1 \ - leaftoppm.1 \ - lispmtopgm.1 \ - macptopbm.1 \ - mdatopbm.1 \ - mgrtopbm.1 \ - mrf.1 \ - mrftopbm.1 \ - mtvtoppm.1 \ - neotoppm.1 \ - palmtopnm.1 \ - pamarith.1 \ - pamchannel.1 \ - pamcomp.1 \ - pamcut.1 \ - pamdeinterlace.1 \ - pamdice.1 \ - pamditherbw.1 \ - pamedge.1 \ - pamendian.1 \ - pamfile.1 \ - pamflip.1 \ - pamfunc.1 \ - pamgauss.1 \ - pamlookup.1 \ - pamoil.1 \ - pamperspective.1 \ - pampop9.1 \ - pamscale.1 \ - pamseq.1 \ - pamsharpmap.1 \ - pamsharpness.1 \ - pamslice.1 \ - pamstack.1 \ - pamstereogram.1 \ - pamstretch-gen.1 \ - pamstretch.1 \ - pamsummcol.1 \ - pamsumm.1 \ - pamtodjvurle.1 \ - pamtohdiff.1 \ - pamtohtmltbl.1 \ - pamtojpeg2k.1 \ - pamtopfm.1 \ - pamtopnm.1 \ - pamtotga.1 \ - pamtouil.1 \ - pbmclean.1 \ - pbmlife.1 \ - pbmmake.1 \ - pbmmask.1 \ - pbmpage.1 \ - pbmpscale.1 \ - pbmreduce.1 \ - pbmtext.1 \ - pbmtextps.1 \ - pbmto10x.1 \ - pbmto4425.1 \ - pbmtoascii.1 \ - pbmtoatk.1 \ - pbmtobbnbg.1 \ - pbmtocmuwm.1 \ - pbmtodjvurle.1 \ - pbmtoepsi.1 \ - pbmtoepson.1 \ - pbmtoescp2.1 \ - pbmtog3.1 \ - pbmtogem.1 \ - pbmtogo.1 \ - pbmtoicon.1 \ - pbmtolj.1 \ - pbmtoln03.1 \ - pbmtolps.1 \ - pbmtomacp.1 \ - pbmtomda.1 \ - pbmtomgr.1 \ - pbmtomrf.1 \ - pbmtonokia.1 \ - pbmtopgm.1 \ - pbmtopi3.1 \ - pbmtopk.1 \ - pbmtoplot.1 \ - pbmtoppa.1 \ - pbmtopsg3.1 \ - pbmtoptx.1 \ - pbmtowbmp.1 \ - pbmtox10bm.1 \ - pbmtoxbm.1 \ - pbmtoybm.1 \ - pbmtozinc.1 \ - pbmupc.1 \ - pc1toppm.1 \ - pcdovtoppm.1 \ - pcxtoppm.1 \ - pfmtopam.1 \ - pgmabel.1 \ - pgmbentley.1 \ - pgmcrater.1 \ - pgmedge.1 \ - pgmenhance.1 \ - pgmhist.1 \ - pgmkernel.1 \ - pgmminkowski.1 \ - pgmmorphconv.1 \ - pgmnoise.1 \ - pgmnorm.1 \ - pgmoil.1 \ - pgmramp.1 \ - pgmslice.1 \ - pgmtexture.1 \ - pgmtofs.1 \ - pgmtolispm.1 \ - pgmtopbm.1 \ - pgmtopgm.1 \ - pgmtoppm.1 \ - pi1toppm.1 \ - pi3topbm.1 \ - picttoppm.1 \ - pjtoppm.1 \ - pktopbm.1 \ - pngtopnm.1 \ - pnmalias.1 \ - pnmarith.1 \ - pnmcat.1 \ - pnmcolormap.1 \ - pnmcomp.1 \ - pnmconvol.1 \ - pnmcrop.1 \ - pnmcut.1 \ - pnmdepth.1 \ - pnmenlarge.1 \ - pnmfile.1 \ - pnmgamma.1 \ - pnmhisteq.1 \ - pnmhistmap.1 \ - pnmindex.1 \ - pnminterp.1 \ - pnminvert.1 \ - pnmmargin.1 \ - pnmmontage.1 \ - pnmnlfilt.1 \ - pnmnoraw.1 \ - pnmnorm.1 \ - pnmpad.1 \ - pnmpaste.1 \ - pnmpsnr.1 \ - pnmquant.1 \ - pnmremap.1 \ - pnmrotate.1 \ - pnmscalefixed.1 \ - pnmscale.1 \ - pnmshear.1 \ - pnmsmooth.1 \ - pnmsplit.1 \ - pnmstitch.1 \ - pnmtile.1 \ - pnmtoddif.1 \ - pnmtofiasco.1 \ - pnmtofits.1 \ - pnmtojbig.1 \ - pnmtojpeg.1 \ - pnmtopalm.1 \ - pnmtopclxl.1 \ - pnmtoplainpnm.1 \ - pnmtopng.1 \ - pnmtopnm.1 \ - pnmtops.1 \ - pnmtorast.1 \ - pnmtorle.1 \ - pnmtosgi.1 \ - pnmtosir.1 \ - pnmtotiffcmyk.1 \ - pnmtotiff.1 \ - pnmtoxwd.1 \ - ppm3d.1 \ - ppmbrighten.1 \ - ppmchange.1 \ - ppmcie.1 \ - ppmcolormask.1 \ - ppmdim.1 \ - ppmdist.1 \ - ppmdither.1 \ - ppmfade.1 \ - ppmflash.1 \ - ppmforge.1 \ - ppmglobe.1 \ - ppmhist.1 \ - ppmlabel.1 \ - ppmmake.1 \ - ppmmix.1 \ - ppmnorm.1 \ - ppmntsc.1 \ - ppmpat.1 \ - ppmquantall.1 \ - ppmquant.1 \ - ppmrainbow.1 \ - ppmrelief.1 \ - ppmrough.1 \ - ppmshadow.1 \ - ppmshift.1 \ - ppmspread.1 \ - ppmsvgalib.1 \ - ppmtoacad.1 \ - ppmtoarbtxt.1 \ - ppmtobmp.1 \ - ppmtoeyuv.1 \ - ppmtogif.1 \ - ppmtoicr.1 \ - ppmtoilbm.1 \ - ppmtojpeg.1 \ - ppmtoleaf.1 \ - ppmtolj.1 \ - ppmtomitsu.1 \ - ppmtompeg.1 \ - ppmtoneo.1 \ - ppmtopcx.1 \ - ppmtopgm.1 \ - ppmtopi1.1 \ - ppmtopict.1 \ - ppmtopj.1 \ - ppmtopjxl.1 \ - ppmtoppm.1 \ - ppmtopuzz.1 \ - ppmtorgb3.1 \ - ppmtosixel.1 \ - ppmtoterm.1 \ - ppmtotga.1 \ - ppmtouil.1 \ - ppmtowinicon.1 \ - ppmtoxpm.1 \ - ppmtoyuv.1 \ - ppmtoyuvsplit.1 \ - ppmtv.1 \ - ppmwheel.1 \ - psidtopgm.1 \ - pstopnm.1 \ - qrttoppm.1 \ - rasttopnm.1 \ - rawtopgm.1 \ - rawtoppm.1 \ - rgb3toppm.1 \ - rletopnm.1 \ - sbigtopgm.1 \ - sgitopnm.1 \ - sirtopnm.1 \ - sldtoppm.1 \ - spctoppm.1 \ - spottopgm.1 \ - sputoppm.1 \ - tgatoppm.1 \ - thinkjettopbm.1 \ - tifftopnm.1 \ - vidtoppm.1 \ - wbmptopbm.1 \ - winicontoppm.1 \ - xbmtopbm.1 \ - ximtoppm.1 \ - xpmtoppm.1 \ - xvminitoppm.1 \ - xwdtopnm.1 \ - ybmtopbm.1 \ - yuvsplittoppm.1 \ - yuvtoppm.1 \ - zeisstopnm.1 \ - -MAN3 = \ - libnetpbm.3 \ - libnetpbm_image.3 \ - libnetpbm_ug.3 \ - libpbm.3 \ - libpgm.3 \ - libpm.3 \ - libpnm.3 \ - libppm.3 \ - libsystem.3 \ - libtmpfile.3 \ - -MAN5 = \ - extendedopacity.5 \ - pam.5 \ - pbm.5 \ - pgm.5 \ - pnm.5 \ - ppm.5 \ - -MANPAGES = $(MAN1) netpbm.1 $(MAN3) $(MAN5) -HTMLMANUALS = $(MAN1:.1=.html) $(MAN3:.3=.html) $(MAN5:.5=.html) -XML = $(HTMLMANUALS:.html=.xml) netpbm.xml - -# These things don't get converted to manual pages -# They're basically link lists, not useful in the man hierarchy. -EXCEPTIONS = directory.html libnetpbm_dir.html - -# Make man pages -- reports bad lines to standard error -manpages: - @python $(MAKEMAN) index.html $(HTMLMANUALS) - mv index.1 netpbm.1 - -# Make XML pages, and validate them. -xmlpages: - @for x in $(MANPAGES); do doclifter $$x; done - @for x in $(XML); do xmllint -xinclude --postvalid $$x >/dev/null; done - -# This will install the generated man pages -installman: manpages - for f in $(MAN1); do \ - if [ -f $$f ]; then gzip <$$f >$(MANDIR)/man1/$$f.gz; fi; \ - done - for f in $(MAN3); do \ - if [ -f $$f ]; then gzip <$$f >$(MANDIR)/man3/$$f.gz; fi; \ - done - for f in $(MAN5); do \ - if [ -f $$f ]; then gzip <$$f >$(MANDIR)/man5/$$f.gz; fi; \ - done - # Clean up old locations on Fedora Core 2 - rm -f $(MANDIR)/man1/extendedopacity.1.gz - rm -f $(MANDIR)/man3/directory.3.gz - rm -f $(MANDIR)/man3/libnetpbm_dir.3.gz - # remove pointer man pages (that say, "The man page isn't here") - # which might have been installed previously - for f in $(MAN1); do rm -f $(MANDIR)/man1/$$f; done - for f in $(MAN3); do rm -f $(MANDIR)/man3/$$f; done - for f in $(MAN5); do rm -f $(MANDIR)/man5/$$f; done - -clean: - @rm -f *.[135] $(XML) - diff --git a/buildtools/README.pkg b/buildtools/README.pkg index b2a6b0ef..e544cbb7 100644 --- a/buildtools/README.pkg +++ b/buildtools/README.pkg @@ -69,6 +69,16 @@ The parts to be installed are: that is in the default search path of your compiler. Typical directories for this are /usr/include and /usr/local/include. + All of the files are meant to be named like for C + #include purposes, which means on an ordinary system, they are + installed in a directory named "netpbm". Thus, they are organized + this way in the package. BUT: until Netpbm 10.41 (December 2007), + they were packaged for, and customarily used, just as . + Therefore, for backward compatibility, it is a good idea to make + symbolic links from the parent directory into the netpbm/ + directory. But as that may pollute your namespace, you may prefer + just to make all users migrate to the form. + Data Files These are files that you can use for various purposes as input to diff --git a/buildtools/configure.pl b/buildtools/configure.pl index ed8fce8a..21f11bf3 100755 --- a/buildtools/configure.pl +++ b/buildtools/configure.pl @@ -13,26 +13,26 @@ use Config; my ($TRUE, $FALSE) = (1,0); -# This program generates Makefile.config, which is included by all of the +# This program generates config.mk, which is included by all of the # Netpbm makefiles. You run this program as the first step in building # Netpbm. (The second step is 'make'). # This program is only a convenience. It is supported to create -# Makefile.config any way you want. In fact, an easy way is to copy -# Makefile.config.in and follow the instructions in the comments therein +# config.mk any way you want. In fact, an easy way is to copy +# config.mk.in and follow the instructions in the comments therein # to uncomment certain lines and make other changes. # Note that if you invoke 'make' without having first run 'configure', # the make will call 'configure' itself when it finds -# 'Makefile.config' missing. That might look a little messy to the +# 'config.mk' missing. That might look a little messy to the # user, but it isn't the normal build process. -# The argument to this program is the filepath of the Makefile.config.in -# file. If unspecified, the default is 'Makefile.config.in' in the +# The argument to this program is the filepath of the config.mk.in +# file. If unspecified, the default is 'config.mk.in' in the # Netpbm source directory. # For explanations of the stuff we put in the make files, see the comments -# in Makefile.config.in. +# in config.mk.in. # $testCc is the command we use to do test compiles. Note that test @@ -42,6 +42,18 @@ my ($TRUE, $FALSE) = (1,0); my $testCc; +############################################################################## +# +# Implementation note: +# +# At one time, we thought we had to add /usr/local/lib and /usr/local/include +# to the path on some platforms because they needed it and didn't include +# it in the default compiler search path. But then we had reason to doubt +# that was really required, so removed the function on 04.03.15 and never +# had any complaint in the next 3 years. +############################################################################## + + #****************************************************************************** # # SUBROUTINES @@ -87,13 +99,17 @@ sub tmpdir() { my $retval; - if ($ENV{"TMPDIR"}) { - $retval = $ENV{"TMPDIR"}; + if ($ENV{'TMPDIR'}) { + $retval = $ENV{'TMPDIR'}; + } elsif ($ENV{'TEMP'}) { + $retval = $ENV{'TEMP'}; } else { - if ($Config{'osvers'} eq "djgpp") { - $retval = "/dev/env/DJDIR/tmp"; + if ($Config{'osvers'} eq 'djgpp') { + $retval = '/dev/env/DJDIR/tmp'; } else { - $retval = "/tmp"; + if (-d('/tmp')) { + $retval = '/tmp'; + } } } return $retval; @@ -110,14 +126,43 @@ sub tempFile($) { # DIR=>File::Spec->tmpdir(), # UNLINK=>0); my ($suffix) = @_; + my $fileName; local *file; # For some inexplicable reason, must be local, not my - my $i; - $i = 0; - do { - $fileName = tmpdir() . "/netpbm" . $i++ . $suffix; - } until sysopen(*file, $fileName, O_RDWR|O_CREAT|O_EXCL); + my $tmpdir = tmpdir(); + + if (!defined($tmpdir)) { + print STDERR ("Cannot determine what directory to use for " . + "temporary files. " . + "Set TMPDIR environment variable to fix this.\n"); + exit(1); + } else { + if (!-d($tmpdir)) { + print STDERR ("Temporary file directory '$tmpdir' does not " . + "exist. Create it or set TMPDIR environment " . + "variable appropriately\n"); + exit(1); + } else { + for (my $i = 0; $i < 50 && !defined($fileName); ++$i) { + my $trialFileName = tmpdir() . "/netpbm" . $i . $suffix; + + my $success = sysopen(*file, + $trialFileName, + O_RDWR|O_CREAT|O_EXCL); + + if ($success) { + $fileName = $trialFileName; + } + } + + if (!defined($fileName)) { + print STDERR ("Unable to create a temporary file in " . + "directory '$tmpdir'\n"); + exit(1); + } + } + } return(*file, $fileName); } @@ -159,8 +204,7 @@ sub chooseTestCompiler($$) { -sub testCflags($) { - my ($needLocal) = @_; +sub testCflags() { my $cflags; @@ -176,9 +220,6 @@ sub testCflags($) { $cflags .= " " . $ENV{"CFLAGS"}; } - if ($needLocal) { - $cflags .= " -I/usr/local/include"; - } return $cflags; } @@ -213,10 +254,40 @@ sub testCompile($$$) { +sub testCompileLink($$$) { + my ($flags, $cSourceCodeR, $successR) = @_; +#----------------------------------------------------------------------------- +# Do a test compile of the program in @{$cSourceCodeR}. +# +# Return $$successR == $TRUE iff the compile succeeds (exit code 0). +#----------------------------------------------------------------------------- + my ($cFile, $cFileName) = tempFile('.c'); + + print $cFile @{$cSourceCodeR}; + + my ($oFile, $oFileName) = tempFile(''); + + # Note that $flags may contain -l options, which where static linking + # is involved have to go _after_ the base object file ($oFileName). + + my $compileCommand = "$testCc -o $oFileName $cFileName $flags"; + print ("Doing test compile/link: $compileCommand\n"); + my $rc = system($compileCommand); + + unlink($oFileName); + close($oFile); + unlink($cFileName); + close($cFile); + + $$successR = ($rc == 0); +} + + + sub displayIntroduction() { print("This is the Netpbm configurator. It is an interactive dialog " . "that\n"); - print("helps you build the file 'Makefile.config' and prepare to build "); + print("helps you build the file 'config.mk' and prepare to build "); print("Netpbm.\n"); print("\n"); @@ -414,8 +485,8 @@ sub getPlatform() { -sub getCompiler($$) { - my ($platform, $compilerR) = @_; +sub getCompiler($$$) { + my ($platform, $subplatform, $compilerR) = @_; #----------------------------------------------------------------------------- # Here are some of the issues surrounding choosing a compiler: # @@ -460,6 +531,8 @@ sub getCompiler($$) { if ($gccUsualPlatform{$platform}) { $$compilerR = "gcc"; + } elsif ($platform eq "WINDOWS" && $subplatform eq "cygwin") { + $$compilerR = "gcc"; } elsif ($gccOptionalPlatform{$platform}) { print("GNU compiler or native operating system compiler (cc)?\n"); print("\n"); @@ -701,7 +774,7 @@ sub inttypesDefault() { print("(Doing test compiles to choose a default for you -- " . "ignore errors)\n"); - my $cflags = testCflags($FALSE); + my $cflags = testCflags(); my $works; @@ -791,7 +864,7 @@ sub getInt64($$) { print("(Doing test compiles to determine if you have int64 type -- " . "ignore errors)\n"); - my $cflags = testCflags($FALSE); + my $cflags = testCflags(); my $works; @@ -822,7 +895,7 @@ sub getInt64($$) { # warning after user has chosen. Also test links to test the link library. # It looks like these should all be in the default search paths and were there -# just to override defaults in Makefile.config.in. Since Configure now +# just to override defaults in config.mk.in. Since Configure now # creates a default of "standard search path," I'm guessing we don't need # to set these anymore. @@ -1140,8 +1213,8 @@ sub help() { print("It is not GNU Configure.\n"); print("\n"); print("There is one optional argument to this program: The " . - "name of the file to use as the basis for the Makefile.config " . - "file. Default is 'Makefile.config.in'\n"); + "name of the file to use as the basis for the config.mk " . + "file. Default is 'config.mk.in'\n"); print("\n"); print("Otherwise, the program is interactive.\n"); } @@ -1188,7 +1261,7 @@ sub gnuOptimizeOpt($) { print("Therefore, I am configuring the build to not do inline \n"); print("optimization. This will make some Netpbm programs \n"); print("noticeably slower. If I am wrong about your compiler, just\n"); - print("edit Makefile.config and change -O0 to -O3 near the bottom.\n"); + print("edit config.mk and change -O0 to -O3 near the bottom.\n"); print("\n"); print("The problem is known to exist in the GNU Compiler \n"); print("release 2.96. If you upgrade, you will not have this \n"); @@ -1204,38 +1277,22 @@ sub gnuOptimizeOpt($) { -sub needLocal($) { -#----------------------------------------------------------------------------- -# Return wether or not /usr/local paths must be added to compiles and -# links. In a properly configured system, those paths should be in -# the compiler and linker default search paths, e.g. the compiler -# should search /usr/local/include and then /usr/include without any -# -I options needed. But we've seen some systems where it isn't. -# -# Actually, I have doubts now as to whether these misconfigured systems -# really exist. This subroutine was apparently always broken, because -# before 04.03.15, it had "netbsd", etc. in lower case. So it always -# returned false. I never had a complaint. Plus, we had a bug in -# Makefile.config.in wherein it wiped out the user's setting of the LDFLAGS -# environment variable. This could explain /usr/local/lib not being in -# the path when it should have been. -# -# So I've disabled this function; we'll see if we encounter any truly -# misconfigured systems. 04.03.15. -#----------------------------------------------------------------------------- - my ($platform) = @_; +sub gnuCflags($) { + my ($gccCommandName) = @_; - return $FALSE; # See comments above. + return("CFLAGS = " . gnuOptimizeOpt($gccCommandName) . " -ffast-math " . + " -pedantic -fno-common " . + "-Wall -Wno-uninitialized -Wmissing-declarations -Wimplicit " . + "-Wwrite-strings -Wmissing-prototypes -Wundef\n"); +} - my $needLocal; - - if ($platform eq "NETBSD" || $platform eq "OPENBSD" || - $platform eq "FREEBSD") { - $needLocal = $TRUE; - } else { - $needLocal = $FALSE; - } - return $needLocal; + + +sub makeCompilerGcc($) { + my ($config_mkR) = @_; + my $compileCommand = 'gcc'; + push(@{$config_mkR}, "CC = $compileCommand\n"); + push(@{$config_mkR}, gnuCflags($compileCommand)); } @@ -1246,7 +1303,7 @@ sub findProcessManagement($) { # Return $TRUE iff the system does not have in its default # search path. #----------------------------------------------------------------------------- - my $cflags = testCflags($FALSE); + my $cflags = testCflags(); my @cSourceCode = ( "#include \n", @@ -1383,13 +1440,13 @@ sub printOldJpegWarning() { -sub testJpegHdr($$) { +sub testJpegHdr($) { - my ($needLocal, $jpeghdr_dir) = @_; + my ($jpeghdr_dir) = @_; if (defined($testCc)) { - my $generalCflags = testCflags($needLocal); + my $generalCflags = testCflags(); my $jpegIOpt = $jpeghdr_dir ? "-I$jpeghdr_dir" : ""; @@ -1442,15 +1499,15 @@ sub testCompilePngH($$) { -sub testPngHdr($$$) { +sub testPngHdr($$) { #----------------------------------------------------------------------------- # Issue a warning if the compiler can't find png.h. #----------------------------------------------------------------------------- - my ($needLocal, $pnghdr_dir, $zhdr_dir) = @_; + my ($pnghdr_dir, $zhdr_dir) = @_; if (defined($testCc)) { - my $generalCflags = testCflags($needLocal); + my $generalCflags = testCflags(); my $zlibIOpt = $zhdr_dir ? "-I$zhdr_dir" : ""; @@ -1474,13 +1531,76 @@ sub testPngHdr($$$) { -sub testLibpngConfig($) { - my ($needLocal) = @_; +sub printBadPngConfigLdflagsWarning($) { + my ($pngLdFlags) = @_; + + print << 'EOF'; +WARNING: 'libpng-config' in this environment (a program in your PATH) +gives instructions that don't work for linking with the PNG library. +Our test link failed. + +This indicates Libpng is installed incorrectly on this system. If so, +your Netpbm build, which uses 'libpng-config', will fail. But it +might also just be our test that is broken. + +EOF + +} + + + +sub printBadPngConfigCflagsWarning($) { + my ($pngCFlags) = @_; + + print << 'EOF'; +WARNING: 'libpng-config' in this environment (a program in your PATH) +gives instructions that don't work for compiling for the PNG library. +Our test compile failed. + +This indicates Libpng is installed incorrectly on this system. If so, +your Netpbm build, which uses 'libpng-config', will fail. But it +might also just be our test that is broken. + +EOF + +} + + + +sub testLinkPnglib($$) { + my ($generalCflags, $pngCflags) = @_; + + my @cSourceCode = ( + "#include \n", + "int main() {\n", + "png_create_write_struct(0, NULL, NULL, NULL);\n", + "}\n", + ); + + testCompile("$generalCflags $pngCflags", \@cSourceCode, \my $success); + if (!$success) { + # Since it won't compile, we can't test the link + } else { + my $pngLdflags = qx{libpng-config --ldflags}; + chomp($pngLdflags); + + testCompileLink("$generalCflags $pngCflags $pngLdflags", + \@cSourceCode, \my $success); + + if (!$success) { + printBadPngConfigLdflagsWarning($pngLdflags); + } + } +} + + + +sub testLibpngConfig() { #----------------------------------------------------------------------------- # Issue a warning if the instructions 'libpng-config' give for compiling # with Libpng don't work. #----------------------------------------------------------------------------- - my $generalCflags = testCflags($needLocal); + my $generalCflags = testCflags(); my $pngCflags = qx{libpng-config --cflags}; chomp($pngCflags); @@ -1488,33 +1608,136 @@ sub testLibpngConfig($) { testCompilePngH("$generalCflags $pngCflags", \my $success); if (!$success) { - print("\n"); - print("Unable to compile a test PNG program using the compiler " . - "flags that libpng-config says to use: '$pngCflags'.\n"); - print("This indicates that you have Libpng installed incorrectly.\n"); - print("libpng-config gets installed as part of the Libpng package.\n"); + printBadPngConfigCflagsWarning($pngCflags); } else { - + testLinkPnglib($generalCflags, $pngCflags); + } +} + + + +sub testCompileXmlreaderH($$) { + my ($cflags, $successR) = @_; +#----------------------------------------------------------------------------- +# Do a test compile to see if we can see xmlreader.h. +#----------------------------------------------------------------------------- + my @cSourceCode = ( + "#include \n", + ); + + testCompile($cflags, \@cSourceCode, $successR); +} + + + +sub printBadXml2CFlagsWarning($) { + my ($xml2CFlags) = @_; + + print << 'EOF'; + +WARNING: 'xml2-config' in this environment (a program in your PATH) +gives instructions that don't work for compiling for the Libxml2 library. +Our test compile failed. + +This indicates Libxml2 is installed incorrectly on this system. If so, +your Netpbm build, which uses 'xml2-config', will fail. But it +might also just be our test that is broken. + +'xml2-config' says to use compiler options '$xml2CFlags'. + +EOF + +} + + + +sub testCompileXmlReaderTypes($$) { + my ($cflags, $successR) = @_; +#----------------------------------------------------------------------------- +# Do a test compile to see if xmlreader.h defines xmlReaderTypes, +# assuming we can compile with xmlreader.h in general. +#----------------------------------------------------------------------------- + my @cSourceCode = ( + "#include \n", + "xmlReaderTypes dummy;\n", + ); + + testCompile($cflags, \@cSourceCode, $successR); +} + + + +sub printMissingXmlReaderTypesWarning() { + + print << 'EOF'; + +WARNING: Your libxml2 interface header file does not define the type +'xmlReaderTypes', which Netpbm needs. In order to build Netpbm successfully, +you must install a more recent version of Libxml2. +EOF +} + + + +sub printNoLibxml2Warning() { + + print << 'EOF'; + +WARNING: You appear not to have Libxml2 installed ('xml2-config' does not +exist in your program search PATH). If this is the case at build time, +the build will skip building 'svgtopam'. + +EOF +} + + + +sub testLibxml2Hdr() { +#----------------------------------------------------------------------------- +# Issue a warning if the instructions 'xml2-config' give for compiling +# with Libxml2 don't work. In particular, note whether they get us a +# modern enough Libxml2 to have the 'xmlReaderTypes' type. +#----------------------------------------------------------------------------- + if (commandExists('xml2-config')) { + my $generalCflags = testCflags(); + + my $xml2Cflags = qx{xml2-config --cflags}; + chomp($xml2Cflags); + testCompileXmlreaderH("$generalCflags $xml2Cflags", \my $success); + + if (!$success) { + printBadXml2CflagsWarning($xml2Cflags); + } else { + testCompileXmlReaderTypes("$generalCflags $xml2Cflags", + \my $success); + + if (!$success) { + printMissingXmlReaderTypesWarning(); + } + } + } else { + printNoLibxml2Warning(); } } -sub testConfiguration($$$$$$$) { +sub testConfiguration($$$$$$) { - my ($needLocal, $jpeglib, $jpeghdr_dir, + my ($jpeglib, $jpeghdr_dir, $pnglib, $pnghdr_dir, $zlib, $zhdr_dir) = @_; if (defined($jpeglib)) { - testJpegHdr($needLocal, $jpeghdr_dir); + testJpegHdr($jpeghdr_dir); } if (defined($pnglib) && defined($zlib)) { - testPngHdr($needLocal, $pnghdr_dir, $zhdr_dir); + testPngHdr($pnghdr_dir, $zhdr_dir); } elsif (commandExists('libpng-config')) { - testLibpngConfig($needLocal); + testLibpngConfig(); } + testLibxml2Hdr(); # TODO: We ought to validate other libraries too. But it's not # that important, because in the vast majority of cases where the @@ -1546,8 +1769,8 @@ if (@ARGV > 0) { $configInPathArg = $ARGV[0]; } -if (stat("Makefile.config")) { - print("Discard existing Makefile.config?\n"); +if (stat("config.mk")) { + print("Discard existing config.mk?\n"); print("Y or N (N) ==> "); my $answer = ; @@ -1570,21 +1793,22 @@ my ($platform, $subplatform) = getPlatform(); print("\n"); if ($platform eq "NONE") { - print("You will have to construct Makefile.config manually. To do \n"); - print("this, copy Makefile.config.in as Makefile.config, and then \n"); + print("You will have to construct config.mk manually. To do \n"); + print("this, copy config.mk.in as config.mk, and then \n"); print("edit it. Follow the instructions and examples in the file. \n"); print("Please report your results to the Netpbm maintainer so he \n"); print("can improve the configure program. \n"); exit; } -getCompiler($platform, \my $compiler); +getCompiler($platform, $subplatform, \my $compiler); + getLinker($platform, $compiler, \my $baseLinker, \my $linkViaCompiler); chooseTestCompiler($compiler, \$testCc); my $netpbmlib_runtime_path; - # Undefined if the default from Makefile.config.in is acceptable. + # Undefined if the default from config.mk.in is acceptable. if ($platform eq "SOLARIS" or $platform eq "IRIX" or $platform eq "DARWIN" or $platform eq "NETBSD" or @@ -1728,8 +1952,7 @@ validateLibraries($jpeglib, $tifflib, $pnglib, $zlib); warnJpegTiffDependency($jpeglib, $tifflib); -testConfiguration(needLocal($platform), - $jpeglib, $jpeghdr_dir, +testConfiguration($jpeglib, $jpeghdr_dir, $pnglib, $pnghdr_dir, $zlib, $zhdr_dir, ); @@ -1745,7 +1968,7 @@ my $defaultConfigInPath; if (-f("GNUmakefile")) { # He's apparently running us in the source tree or an already set up # build directory. - $defaultConfigInPath = "Makefile.config.in"; + $defaultConfigInPath = "config.mk.in"; } else { my $srcdir; my $done; @@ -1770,41 +1993,24 @@ if (-f("GNUmakefile")) { unlink("Makefile"); symlink("$srcdir/Makefile", "Makefile"); - open(SRCDIR, ">Makefile.srcdir"); + open(SRCDIR, ">srcdir.mk"); print(SRCDIR "SRCDIR = $srcdir\n"); close(SRCDIR); - $defaultConfigInPath = "$srcdir/Makefile.config.in"; -} - -sub makeCompilerGcc($) { - my ($Makefile_configR) = @_; - my $compileCommand = 'gcc'; - push(@{$Makefile_configR}, "CC = $compileCommand\n"); - push(@{$Makefile_configR}, gnuCflags($compileCommand)); + $defaultConfigInPath = "$srcdir/config.mk.in"; } - #****************************************************************************** # -# BUILD Makefile.config +# BUILD config.mk # #***************************************************************************** -sub gnuCflags($) { - my ($gccCommandName) = @_; - - return("CFLAGS = " . gnuOptimizeOpt($gccCommandName) . " -ffast-math " . - " -pedantic -fno-common " . - "-Wall -Wno-uninitialized -Wmissing-declarations -Wimplicit " . - "-Wwrite-strings -Wmissing-prototypes -Wundef\n"); -} - -my @Makefile_config; - # This is the complete Makefile.config contents. We construct it here - # and ultimately write the whole thing out as Makefile.config. +my @config_mk; + # This is the complete config.mk contents. We construct it here + # and ultimately write the whole thing out as config.mk. -# First, we just read the 'Makefile.config.in' in +# First, we just read the 'config.mk.in' in my $configInPath; if (defined($configInPathArg)) { @@ -1815,9 +2021,9 @@ if (defined($configInPathArg)) { open (CONFIG_IN,"<$configInPath") or die("Unable to open file '$configInPath' for input."); -@Makefile_config = ; +@config_mk = ; -unshift(@Makefile_config, +unshift(@config_mk, "####This file was automatically created by 'configure.'\n", "####Many variables are set twice -- a generic setting, then \n", "####a system-specific override at the bottom of the file.\n", @@ -1826,101 +2032,98 @@ unshift(@Makefile_config, close(CONFIG_IN); # Now, add the variable settings that override the default settings that are -# done by the Makefile.config.in contents. +# done by the config.mk.in contents. -push(@Makefile_config, "\n\n\n\n"); -push(@Makefile_config, "####Lines above were copied from Makefile.config.in " . +push(@config_mk, "\n\n\n\n"); +push(@config_mk, "####Lines above were copied from config.mk.in " . "by 'configure'.\n"); -push(@Makefile_config, "####Lines below were added by 'configure' based on " . +push(@config_mk, "####Lines below were added by 'configure' based on " . "the $platform platform.\n"); if (defined($subplatform)) { - push(@Makefile_config, "####subplatform '$subplatform'\n"); + push(@config_mk, "####subplatform '$subplatform'\n"); } -push(@Makefile_config, "DEFAULT_TARGET = $default_target\n"); +push(@config_mk, "DEFAULT_TARGET = $default_target\n"); -push(@Makefile_config, "NETPBMLIBTYPE=$netpbmlibtype\n"); -push(@Makefile_config, "NETPBMLIBSUFFIX=$netpbmlibsuffix\n"); +push(@config_mk, "NETPBMLIBTYPE=$netpbmlibtype\n"); +push(@config_mk, "NETPBMLIBSUFFIX=$netpbmlibsuffix\n"); if (defined($shlibprefixlist)) { - push(@Makefile_config, "SHLIBPREFIXLIST=$shlibprefixlist\n"); + push(@config_mk, "SHLIBPREFIXLIST=$shlibprefixlist\n"); } -push(@Makefile_config, "STATICLIB_TOO=$staticlib_too\n"); +push(@config_mk, "STATICLIB_TOO=$staticlib_too\n"); if (defined($netpbmlib_runtime_path)) { - push(@Makefile_config, "NETPBMLIB_RUNTIME_PATH=$netpbmlib_runtime_path\n"); + push(@config_mk, "NETPBMLIB_RUNTIME_PATH=$netpbmlib_runtime_path\n"); } if ($platform eq "GNU") { - my $compileCommand; if (!commandExists("cc") && commandExists("gcc")) { - $compileCommand = "gcc"; - push(@Makefile_config, "CC = $compileCommand\n"); + makeCompilerGcc(\@config_mk); } else { - $compileCommand = "cc"; + push(@config_mk, gnuCflags('cc')); } - push(@Makefile_config, gnuCflags($compileCommand)); # The merged programs have a main_XXX subroutine instead of main(), # which would cause a warning with -Wmissing-declarations or # -Wmissing-prototypes. - push(@Makefile_config, "CFLAGS_MERGE = " . + push(@config_mk, "CFLAGS_MERGE = " . "-Wno-missing-declarations -Wno-missing-prototypes\n"); - push(@Makefile_config, "LDRELOC = ld --reloc\n"); - push(@Makefile_config, "LINKER_CAN_DO_EXPLICIT_LIBRARY=Y\n"); + push(@config_mk, "LDRELOC = ld --reloc\n"); + push(@config_mk, "LINKER_CAN_DO_EXPLICIT_LIBRARY=Y\n"); } elsif ($platform eq "SOLARIS") { - push(@Makefile_config, 'LDSHLIB = -Wl,-Bdynamic,-G,-h,$(SONAME)', "\n"); + push(@config_mk, 'LDSHLIB = -Wl,-Bdynamic,-G,-h,$(SONAME)', "\n"); - push(@Makefile_config, 'NEED_RUNTIME_PATH = Y', "\n"); + push(@config_mk, 'NEED_RUNTIME_PATH = Y', "\n"); if ($compiler eq "cc") { - push(@Makefile_config, "CFLAGS = -O\n"); - push(@Makefile_config, "CFLAGS_SHLIB = -Kpic\n"); + push(@config_mk, "CFLAGS = -O\n"); + push(@config_mk, "CFLAGS_SHLIB = -Kpic\n"); } else { - makeCompilerGcc(\@Makefile_config); + makeCompilerGcc(\@config_mk); } # Before Netpbm 10.20 (January 2004), we set this to -R for # $compiler == cc and -rpath otherwise. But now we know that the GNU # compiler can also invoke a linker that needs -R, so we're more flexible. if ($baseLinker eq "GNU") { - push(@Makefile_config, "RPATHOPTNAME = -rpath\n"); + push(@config_mk, "RPATHOPTNAME = -rpath\n"); } else { - push(@Makefile_config, "RPATHOPTNAME = -R\n"); + push(@config_mk, "RPATHOPTNAME = -R\n"); } - push(@Makefile_config, "NETWORKLD = -lsocket -lnsl\n"); + push(@config_mk, "NETWORKLD = -lsocket -lnsl\n"); } elsif ($platform eq "HP-UX") { if ($compiler eq "gcc") { - makeCompilerGcc(\@Makefile_config); - push(@Makefile_config, "CFLAGS += -fPIC\n"); - push(@Makefile_config, "LDSHLIB = -shared -fPIC\n"); - push(@Makefile_config, 'LDFLAGS += -Wl,+b,/usr/pubsw/lib', "\n"); + makeCompilerGcc(\@config_mk); + push(@config_mk, "CFLAGS += -fPIC\n"); + push(@config_mk, "LDSHLIB = -shared -fPIC\n"); + push(@config_mk, 'LDFLAGS += -Wl,+b,/usr/pubsw/lib', "\n"); } else { # We don't know what to do here. We used to (before 10.20) just # just assume the compiler was gcc. We know that the gcc stuff # above does NOT work for HP native compiler. - push(@Makefile_config, "LDSHLIB =\n"); + push(@config_mk, "LDSHLIB =\n"); } } elsif ($platform eq "AIX") { - push(@Makefile_config, 'LDFLAGS = -L /usr/pubsw/lib', "\n"); + push(@config_mk, 'LDFLAGS += -L /usr/pubsw/lib', "\n"); if ($compiler eq "cc") { # Yes, the -L option implies the runtime as well as linktime library # search path. There's no way to specify runtime path independently. - push(@Makefile_config, "RPATHOPTNAME = -L\n"); - push(@Makefile_config, "LDSHLIB = -qmkshrobj\n"); + push(@config_mk, "RPATHOPTNAME = -L\n"); + push(@config_mk, "LDSHLIB = -qmkshrobj\n"); } else { - makeCompilerGcc(\@Makefile_config); - push(@Makefile_config, "LDSHLIB = -shared\n"); + makeCompilerGcc(\@config_mk); + push(@config_mk, "LDSHLIB = -shared\n"); } } elsif ($platform eq "TRU64") { -# push(@Makefile_config, "INSTALL = installbsd\n"); +# push(@config_mk, "INSTALL = installbsd\n"); if ($compiler eq "cc") { - push(@Makefile_config, 'CFLAGS = -O2 -std1', "\n"); - push(@Makefile_config, "LDFLAGS = -call_shared -oldstyle_liblookup " . + push(@config_mk, 'CFLAGS = -O2 -std1', "\n"); + push(@config_mk, "LDFLAGS = -call_shared -oldstyle_liblookup " . "-L/usr/local/lib\n"); - push(@Makefile_config, "LDSHLIB = -shared -expect_unresolved \"*\"\n"); + push(@config_mk, "LDSHLIB = -shared -expect_unresolved \"*\"\n"); } else { # We've never tested this. This is just here to give a user a # headstart on submitting to us the necessary information. 2002.07.04. - push(@Makefile_config, "CC = gcc\n"); - push(@Makefile_config, 'CFLAGS = -O3', "\n"); - push(@Makefile_config, "LDSHLIB = -shared\n"); + push(@config_mk, "CC = gcc\n"); + push(@config_mk, 'CFLAGS = -O3', "\n"); + push(@config_mk, "LDSHLIB = -shared\n"); } # Between May 2000 and July 2003, we had -DLONG_32 in these options. # We took it out because it generated bad code for a TRU64 user in @@ -1928,76 +2131,80 @@ if ($platform eq "GNU") { # only Ppmtompeg and it isn't clear that using long instead of int is # ever right anyway. - push(@Makefile_config, "OMIT_NETWORK = y\n"); - push(@Makefile_config, "LINKER_CAN_DO_EXPLICIT_LIBRARY=Y\n"); + push(@config_mk, "OMIT_NETWORK = y\n"); + push(@config_mk, "LINKER_CAN_DO_EXPLICIT_LIBRARY=Y\n"); } elsif ($platform eq "IRIX") { -# push(@Makefile_config, "INSTALL = install\n"); - push(@Makefile_config, "MANPAGE_FORMAT = cat\n"); - push(@Makefile_config, "RANLIB = true\n"); - push(@Makefile_config, "CFLAGS = -n32 -O3 -fullwarn\n"); - push(@Makefile_config, "LDFLAGS = -n32\n"); - push(@Makefile_config, "LDSHLIB = -shared -n32\n"); +# push(@config_mk, "INSTALL = install\n"); + push(@config_mk, "MANPAGE_FORMAT = cat\n"); + push(@config_mk, "RANLIB = true\n"); + push(@config_mk, "CFLAGS = -n32 -O3 -fullwarn\n"); + push(@config_mk, "LDFLAGS = -n32\n"); + push(@config_mk, "LDSHLIB = -shared -n32\n"); } elsif ($platform eq "WINDOWS") { if ($subplatform eq "cygwin") { - makeCompilerGcc(\@Makefile_config); + makeCompilerGcc(\@config_mk); } - push(@Makefile_config, "EXE = .exe\n"); - push(@Makefile_config, "OMIT_NETWORK = y\n"); + push(@config_mk, "EXE = .exe\n"); + push(@config_mk, "OMIT_NETWORK = y\n"); # # Though it may not have the link as "ginstall", "install" in a Windows # # Unix environment is usually GNU install. # my $ginstall_result = `ginstall --version 2>/dev/null`; # if (!$ginstall_result) { # # System doesn't have 'ginstall', so use 'install' instead. -# push(@Makefile_config, "INSTALL = install\n"); +# push(@config_mk, "INSTALL = install\n"); # } - push(@Makefile_config, 'SYMLINK = ', symlink_command(), "\n"); - push(@Makefile_config, 'DLLVER=$(NETPBM_MAJOR_RELEASE)', "\n"); - push(@Makefile_config, "LDSHLIB = " . + push(@config_mk, 'SYMLINK = ', symlink_command(), "\n"); + push(@config_mk, 'DLLVER=$(NETPBM_MAJOR_RELEASE)', "\n"); + push(@config_mk, "LDSHLIB = " . '-shared -Wl,--image-base=0x10000000 -Wl,--enable-auto-import', "\n"); + if ($subplatform ne "cygwin") { + push(@config_mk, "MSVCRT = Y\n"); + } } elsif ($platform eq "BEOS") { - push(@Makefile_config, "LDSHLIB = -nostart\n"); + push(@config_mk, "LDSHLIB = -nostart\n"); } elsif ($platform eq "OPENBSD") { # vedge@vedge.com.ar says on 2001.04.29 that there are a ton of # undefined symbols in the Fiasco stuff on OpenBSD. So we'll just # cut it out of the build until someone feels like fixing it. - push(@Makefile_config, "BUILD_FIASCO = N\n"); + push(@config_mk, "BUILD_FIASCO = N\n"); } elsif ($platform eq "FREEBSD") { } elsif ($platform eq "AMIGA") { - push(@Makefile_config, "CFLAGS = -m68020-60 -ffast-math -mstackextend\n"); + push(@config_mk, "CFLAGS = -m68020-60 -ffast-math -mstackextend\n"); } elsif ($platform eq "UNIXWARE") { # Nothing to do. } elsif ($platform eq "SCO") { # Got this from "John H. DuBois III" 2002.09.27: - push(@Makefile_config, "RANLIB = true\n"); + push(@config_mk, "RANLIB = true\n"); if ($compiler eq "cc") { - push(@Makefile_config, "CFLAGS = -O\n"); - push(@Makefile_config, "CFLAGS_SHLIB = -O -K pic\n"); - push(@Makefile_config, "LDSHLIB = -G\n"); - push(@Makefile_config, "SHLIB_CLIB =\n"); + push(@config_mk, "CFLAGS = -O\n"); + push(@config_mk, "CFLAGS_SHLIB = -O -K pic\n"); + push(@config_mk, "LDSHLIB = -G\n"); + push(@config_mk, "SHLIB_CLIB =\n"); } else { - makeCompilerGcc(\@Makefile_config); - push(@Makefile_config, "LDSHLIB = -shared\n"); + makeCompilerGcc(\@config_mk); + push(@config_mk, "LDSHLIB = -shared\n"); } - push(@Makefile_config, "NETWORKLD = -lsocket -lresolve\n"); + push(@config_mk, "NETWORKLD = -lsocket -lresolve\n"); } elsif ($platform eq "DARWIN") { - push(@Makefile_config, "CC = cc -no-cpp-precomp\n"); - push(@Makefile_config, 'CFLAGS_SHLIB = -fno-common', "\n"); - push(@Makefile_config, "LDSHLIB = ", - "-dynamiclib ", - '-install_name $(NETPBMLIB_RUNTIME_PATH)/libnetpbm.$(MAJ).dylib', - "\n"); -# push(@Makefile_config, "INSTALL = install\n"); + push(@config_mk, "CC = cc -no-cpp-precomp\n"); + push(@config_mk, gnuCflags('cc')); + push(@config_mk, 'CFLAGS_SHLIB = -fno-common', "\n"); + + my $installNameOpt; + if ($netpbmlib_runtime_path eq '') { + $installNameOpt = ''; + } else { + $installNameOpt = + '-install_name $(NETPBMLIB_RUNTIME_PATH)/libnetpbm.$(MAJ).dylib'; + } + push(@config_mk, "LDSHLIB = -dynamiclib $installNameOpt\n"); +# push(@config_mk, "INSTALL = install\n"); } else { die ("Internal error: invalid value for \$platform: '$platform'\n"); } -if (needLocal($platform)) { - push(@Makefile_config, "CFLAGS += -I/usr/local/include\n"); - push(@Makefile_config, "LDFLAGS += -L/usr/local/lib\n"); -} - if ($linkViaCompiler) { - push(@Makefile_config, "LINKERISCOMPILER = Y\n"); + push(@config_mk, "LINKERISCOMPILER = Y\n"); } my $flex_result = `flex --version`; @@ -2019,7 +2226,7 @@ if (!$flex_result) { my $key = ; print("\n"); - push(@Makefile_config, "LEX=\n"); + push(@config_mk, "LEX=\n"); } else { print("\n"); print("Using 'lex' as the pattern matcher generator, " . @@ -2027,70 +2234,70 @@ if (!$flex_result) { print("find 'flex' on your system.\n"); print("\n"); - push(@Makefile_config, "LEX = lex\n"); + push(@config_mk, "LEX = lex\n"); } } if ($compiler eq 'gcc') { - push(@Makefile_config, "CFLAGS_SHLIB += -fPIC\n"); + push(@config_mk, "CFLAGS_SHLIB += -fPIC\n"); } if (defined($tiffhdr_dir)) { - push(@Makefile_config, "TIFFHDR_DIR = $tiffhdr_dir\n"); + push(@config_mk, "TIFFHDR_DIR = $tiffhdr_dir\n"); } if (defined($tifflib)) { - push(@Makefile_config, "TIFFLIB = $tifflib\n"); + push(@config_mk, "TIFFLIB = $tifflib\n"); } if (defined($jpeghdr_dir)) { - push(@Makefile_config, "JPEGHDR_DIR = $jpeghdr_dir\n"); + push(@config_mk, "JPEGHDR_DIR = $jpeghdr_dir\n"); } if (defined($jpeglib)) { - push(@Makefile_config, "JPEGLIB = $jpeglib\n"); + push(@config_mk, "JPEGLIB = $jpeglib\n"); } if (defined($pnghdr_dir)) { - push(@Makefile_config, "PNGHDR_DIR = $pnghdr_dir\n"); + push(@config_mk, "PNGHDR_DIR = $pnghdr_dir\n"); } if (defined($pnglib)) { - push(@Makefile_config, "PNGLIB = $pnglib\n"); + push(@config_mk, "PNGLIB = $pnglib\n"); } if (defined($zhdr_dir)) { - push(@Makefile_config, "ZHDR_DIR = $zhdr_dir\n"); + push(@config_mk, "ZHDR_DIR = $zhdr_dir\n"); } if (defined($zlib)) { - push(@Makefile_config, "ZLIB = $zlib\n"); + push(@config_mk, "ZLIB = $zlib\n"); } if (defined($x11hdr_dir)) { - push(@Makefile_config, "X11HDR_DIR = $x11hdr_dir\n"); + push(@config_mk, "X11HDR_DIR = $x11hdr_dir\n"); } if (defined($x11lib)) { - push(@Makefile_config, "X11LIB = $x11lib\n"); + push(@config_mk, "X11LIB = $x11lib\n"); } if (defined($linuxsvgahdr_dir)) { - push(@Makefile_config, "LINUXSVGAHDR_DIR = $linuxsvgahdr_dir\n"); + push(@config_mk, "LINUXSVGAHDR_DIR = $linuxsvgahdr_dir\n"); } if (defined($linuxsvgalib)) { - push(@Makefile_config, "LINUXSVGALIB = $linuxsvgalib\n"); + push(@config_mk, "LINUXSVGALIB = $linuxsvgalib\n"); } if (defined($netpbm_docurl)) { - push(@Makefile_config, "NETPBM_DOCURL = $netpbm_docurl\n"); + push(@config_mk, "NETPBM_DOCURL = $netpbm_docurl\n"); } if ($inttypesHeaderFile ne '') { - push(@Makefile_config, "INTTYPES_H = $inttypesHeaderFile\n"); + push(@config_mk, "INTTYPES_H = $inttypesHeaderFile\n"); } if ($haveInt64 ne 'Y') { - push(@Makefile_config, "HAVE_INT64 = $haveInt64\n"); + push(@config_mk, "HAVE_INT64 = $haveInt64\n"); } if ($dontHaveProcessMgmt) { - push(@Makefile_config, "DONT_HAVE_PROCESS_MGMT = Y\n"); + push(@config_mk, "DONT_HAVE_PROCESS_MGMT = Y\n"); } #****************************************************************************** @@ -2099,23 +2306,21 @@ if ($dontHaveProcessMgmt) { # #***************************************************************************** -open(MAKEFILE_CONFIG, ">Makefile.config") or - die("Unable to open Makefile.config for writing in the current " . +open(config_mk, ">config.mk") or + die("Unable to open config.mk for writing in the current " . "directory."); -print MAKEFILE_CONFIG @Makefile_config; +print config_mk @config_mk; -close(MAKEFILE_CONFIG) or - die("Error: Close of Makefile.config failed.\n"); +close(config_mk) or + die("Error: Close of config.mk failed.\n"); print("\n"); -print("We have created the file 'Makefile.config'. Note, however, that \n"); -print("we guessed a lot at your configuration and you may want to look \n"); -print("at Makefile.config and edit it to your requirements and taste \n"); -print("before doing the make.\n"); +print("We have created the file 'config.mk'. You may want to look \n"); +print("at it and edit it to your requirements and taste before doing the \n"); +print("make.\n"); print("\n"); - print("Now you may proceed with 'make'\n"); print("\n"); diff --git a/buildtools/debian/README b/buildtools/debian/README deleted file mode 100644 index 1c600c6b..00000000 --- a/buildtools/debian/README +++ /dev/null @@ -1,122 +0,0 @@ -Files in this directory are for creating a Debian package (.deb file), -which one can use to install Netpbm on a Debian system (or a system running -a derivative of Debian, such as Ubuntu or Mint). - -You can of course install on one of these systems by running 'installnetpbm', -or otherwise inserting all the files in the proper place in your system file -tree, but having a Debian package allows you to manage those files using -Debian's normal package management. The package management system will know -where the Netpbm files came from, and you can upgrade or remove Netpbm easily. -The package management system will also be aware of prerequisites of Netpbm -and ensure that you don't have Debian's own inferior version of Netpbm -installed (which would cause conflicts). - -The package we create is named 'netpbm-sf' (where the "sf" is from -"SourceForge"), to be distinct from the package named "netpbm" which is part -of Debian. - -To install Netpbm as a Debian package: - - 1) Follow the regular instructions to build and package Netpbm - (configure, make, make package). - - 2) With the root of the built Netpbm build tree as your current - directory: - - $ make deb - - (This defaults to getting Netpbm from /tmp/netpbm, which is also where - 'make package' defaults to putting it). - - 3) $ dpkg --install netpbm-sfXXXX.deb - - (netpbm-sfXXXX.deb is the file created by 'makedeb', in the current - directory). - - -PREREQUSISITES --------------- - -The following information was taken from the Wheezy version of Debian, in -January 2014. - -You don't actually need the current version of any of these. For example, -while we list package libjpeg8-dev, the package libjpeg62-dev works fine. - - -Building --------- - -You need the following Debian packages to build all of Netpbm. - -You could omit some of these and, in the Netpbm build configuration dialog, -indicate you don't have them, and the build will simply omit some parts. -For example, if you don't install libx11-dev, the Netpbm build process -will not build the 'pamx' program. - - libjpeg8-dev - libpng12-0-dev - libsvga1-dev - libtiff5-dev - libx11-dev - libxml2a-dev - zlib1g-dev - - -In addition, you need the following build tools: - - make - gcc - flex - perl - pkg-config - - - -Running -------- - -The following Debian packages are the known prerequisites for running Netpbm -(and the package created by 'mkdeb' knows this). - - libc6 - libjpeg8 - libpng12-0 - libsvga1 - libtiff5 - libx11-6 - zlib1g - ghostscript - perl - perl-base - bash - -Note that many of these are needed only for a few parts of Netpbm, and it will -be pretty obvious what the problem is when you need the prerequisite package -and don't have it, so if you don't want to install a prerequisite, it would -probably be fine to force install Netpbm, ignoring the prerequisites. - - -CONFLICTS WITH DEBIAN'S NETPBM ------------------------------- - -Debian has several packages of Netpbm, all based on a slightly modified -Sourceforge Netpbm 9.25 from 2002 (don't be confused by Debian's numbering -system, which makes it look like it is Netpbm 10). If you want to install -Sourceforge Netpbm on your system, you will want first to remove any of these -you have installed: - - netpbm - netpbm-dev - libnetpbm9 - libnetpbm10 - -Sourceforge Netpbm should be backward compatible with all of those. Note that -'mkdeb' makes only one package. It contains the programs, the runtime -libraries, and the development files. - -We have not yet worked out what has to be done about the fact that the Debian -packaging system thinks the Debian Netpbm packages are prerequisites for -things. If you install Sourceforge Netpbm via the package created by mkdeb, -you should tell the Netpbm maintainer whatever you learn about that. - diff --git a/buildtools/debian/mkdeb b/buildtools/debian/mkdeb deleted file mode 100755 index 42a986eb..00000000 --- a/buildtools/debian/mkdeb +++ /dev/null @@ -1,541 +0,0 @@ -#!/usr/bin/perl -############################################################################### -# mkdeb -############################################################################### -# -# This generates a Debian packge file (.deb) to install Sourceforge -# Netpbm on a Debian system. -# -# This is especially useful because Debian does not have a good Debian -# package (what Debian contains is derived from Sourceforge Netpbm ca. -# 2002). -# -############################################################################### - -use strict; -use warnings; -use English; -use Getopt::Long; - -my $TRUE=1; my $FALSE = 0; - - - -sub parseCommandLine(@) { - - local @ARGV = @_; # GetOptions takes input from @ARGV only - - my %cmdline; - - my $validOptions = GetOptions(\%cmdline, - "buildtools=s", - "arch=s", - "pkgdir=s", - ); - - if (!$validOptions) { - print(STDERR "Invalid option syntax.\n"); - exit(1); - } - if (@ARGV > 0) { - print(STDERR "This program takes no non-option arguments. " . - "You specified ", - scalar(@ARGV), "\n"); - exit(1); - } - - return(\%cmdline); -} - - - -sub writeFile($$$$) { - my ($fileLinesR, $fileName, $executable, $errorR) = @_; - - my $success = open(FILE, ">$fileName"); - if ($success) { - if ($executable eq 'EXECUTABLE') { - chmod(0755, $fileName); - } else { - chmod(0644, $fileName); - } - foreach (@{$fileLinesR}) { print FILE; } - close(FILE); - } else { - $$errorR = "Unable to open the file " . - "'$fileName' for writing. Errno=$ERRNO\n"; - } -} - - - -sub netpbmVersion($) { - my ($pkgdir) = @_; - - my $versionFileName = "$pkgdir/VERSION"; - - my $versionOpened = open(VERSION, "<$versionFileName"); - - my $retval; - my $error; - - if (!$versionOpened) { - $error = "Unable to open '$versionFileName' for reading. " . - "Errno=$ERRNO\n"; - } else { - my $version = ; - chomp($version); - - if ($version =~ m{^Netpbm (\S*)}) { - my ($versionNumber) = ($1); - $retval = $versionNumber; - } else { - die("Can't understand format of '$versionFileName': '$version'"); - } - close(VERSION); - } - - if ($error) { - print("Failed to determine the version of Netpbm from the package, " - . "so that will not be correct in netpbm.config and netpbm.pc. " - . $error . "\n"); - $retval = "???"; - } - return $retval; -} - - - -sub control($$) { - my ($release, $architecture) = @_; - -# The Debian packaging system doesn't provide a way to express Netpbm's actual -# prerequisites. For example, Netpbm needs Version 6.2 or better of Libjpeg, -# but there is no way to state that here. Instead, we state Libjpeg 8. -# This makes the Netpbm package less useful. - - my %control; - - my $debianNativeNetpbm = - 'netpbm, ' . - 'libnetpbm10, ' . - 'libnetpbm10-dev, ' . - 'netpbm-dev, ' . - 'netpbm-nonfree, ' . - 'pbmwbmp, ' . - 'pnmtopng, ' . - 'ucbmpeg'; - - $control{'Package'} = 'netpbm-sf'; - $control{'Version'} = $release; - $control{'Architecture'} = $architecture; - $control{'Maintainer'} = 'Bryan Henderson '; - $control{'Installed-Size'} = '6164'; - $control{'Depends'} = - 'libc6, ' . - 'libjpeg62, ' . - 'libpng12-0, ' . - 'libsvga1, ' . - 'libtiff4, ' . - 'libx11-6, ' . - 'libxml2, ' . - 'zlib1g, ' . - 'ghostscript, ' . - 'perl, ' . - 'perl-base, ' . - 'bash' - ; - $control{'Recommends'} = ''; - $control{'Recommends'} = ''; - $control{'Conflicts'} = $debianNativeNetpbm; - $control{'Replaces'} = $debianNativeNetpbm; - $control{'Provides'} = - 'netpbm, ' . - 'pbmwbmp, ' . - 'pnmtopng, ' . - 'netpbm-dev, ' . - 'libnetpbm10' - ; - $control{'Section'} = 'graphics'; - $control{'Priority'} = 'optional'; - $control{'Section'} = 'graphics'; - $control{'Description'} = 'Graphics conversion tools between image formats - Netpbm is a toolkit for manipulation of graphic images, including - conversion of images between a variety of different formats. There - are over 300 separate tools in the package including converters for - more than 80 graphics formats. This is the Super Stable version from - the Sourceforge Netpbm project, unmodified.'; - - return \%control; -} - - - -sub writeControlFile($$) { - my ($controlR, $fileName) = @_; - - open(CTL, '>', $fileName) - or die "Can't open '$fileName': $ERRNO"; - - while (my ($key, $value) = each %{$controlR}) { - print CTL ("$key: $value\n"); - } - - close(CTL); -} - - - -sub createScripts($$) { - my ($dpkgDirName, $buildToolsDir) = @_; - - my @scriptList = ('postinst', 'postrm'); - - my @scriptFileList = map("$buildToolsDir/debian/$_", @scriptList); - - system('cp', @scriptFileList, "$dpkgDirName/DEBIAN/") && - die("Failed to copy postinst, etc. to '$dpkgDirName/DEBIAN'."); - - my @createdFileList = map("$dpkgDirName/DEBIAN/$_", @scriptList); - - chmod(0755, @createdFileList); -} - - - -sub createDirOrDie($) { - my ($newDirName) = @_; - - mkdir($newDirName) - or die("Couldn't create directory '$newDirName'. $ERRNO"); - - chmod(0755, $newDirName); -} - - - -sub -processTemplate($$$) { - my ($templateR, $infoR, $outputR) = @_; - - my @output; - - foreach (@{$templateR}) { - if (m{^@}) { - # Comment -- ignore it. - } else { - if (defined($infoR->{VERSION})) { - s/\@VERSION\@/$infoR->{VERSION}/; - } - if (defined($infoR->{BINDIR})) { - s/\@BINDIR@/$infoR->{BINDIR}/; - } - if (defined($infoR->{LIBDIR})) { - s/\@LIBDIR@/$infoR-.{LIBDIR}/; - } - if (defined($infoR->{LINKDIR})) { - s/\@LINKDIR@/$infoR->{LINKDIR}/; - } - if (defined($infoR->{DATADIR})) { - s/\@DATADIR@/$infoR->{DATADIR}/; - } - if (defined($infoR->{INCLUDEDIR})) { - s/\@INCLUDEDIR@/$infoR->{INCLUDEDIR}/; - } - if (defined($infoR->{MANDIR})) { - s/\@MANDIR@/$infoR->{MANDIR}/; - } - push(@output, $_); - } - } - $$outputR = \@output; -} - - - - - -sub makeConfig($$$) { - my ($fileName, $templateSubsR, $netpbmPkgDir) = @_; -#----------------------------------------------------------------------------- -# Install 'netpbm-config' -- a program you run to tell you things about -# how Netpbm is installed. -#----------------------------------------------------------------------------- - my $error; - - my $configTemplateFilename = $netpbmPkgDir . "/config_template"; - - my $templateOpened = open(TEMPLATE, "<$configTemplateFilename"); - if (!$templateOpened) { - $error = "Can't open template file '$configTemplateFilename'.\n"; - } else { - my @template =