From 7bba051550fc5cba5389c33e4399f9f2f90d1b4b Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sun, 18 Nov 2018 19:09:33 +0000 Subject: Do backward compatibility names for merge build in the directories instead of in netpbm.c. Now works for programs that are built conditionally git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3436 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- analyzer/Makefile | 7 +++++++ common.mk | 23 +++++++++++++++++++---- converter/other/Makefile | 24 ++++++++++++++++++++++++ converter/pbm/Makefile | 6 ++++++ doc/HISTORY | 4 ++++ editor/Makefile | 14 ++++++++++++++ editor/specialty/Makefile | 6 ++++++ netpbm.c | 42 +----------------------------------------- other/Makefile | 8 ++++++++ 9 files changed, 89 insertions(+), 45 deletions(-) diff --git a/analyzer/Makefile b/analyzer/Makefile index 459f0e60..dc7a0cb2 100644 --- a/analyzer/Makefile +++ b/analyzer/Makefile @@ -46,6 +46,8 @@ OBJECTS = $(BINARIES:%=%.o) MERGEBINARIES = $(BINARIES) MERGE_OBJECTS = $(MERGEBINARIES:%=%.o2) +HAVE_MERGE_COMPAT=YES + .PHONY: all all: $(BINARIES) @@ -60,5 +62,10 @@ install.bin.local: $(PKGDIR)/bin cd $(PKGDIR)/bin ; \ $(SYMLINK) pamfile$(EXE) pnmfile$(EXE) +mergecomptrylist: + cat /dev/null >$@ + echo "TRY(\"pgmslice\", main_pamslice);" >>$@ + echo "TRY(\"pnmfile\", main_pamfile);" >>$@ + FORCE: diff --git a/common.mk b/common.mk index 97810cd4..4bfdb6a1 100644 --- a/common.mk +++ b/common.mk @@ -400,14 +400,29 @@ $(PORTBINARIES) $(MATHBINARIES): %: %.o \ "-Dmain=main_$*" \ $(CFLAGS_MERGE) $(CFLAGS_PERSONAL) $(CADD) -o $@ $< -# The "merge try list" is a file full of TRY macro invocations, one for -# each Netpbm program in this directory or any subdirectory that can be -# invoked via the merged Netpbm program. You will find it #included in -# netpbm.c. +# The "merge try list" is a file full of TRY macro invocations, one for each +# Netpbm program in this directory or any subdirectory that can be invoked via +# the merged Netpbm program. There are additional TRYs for backward +# compatility program names (e.g. 'pnmcomp' for 'pamcomp'). You will find the +# merge try list #included in netpbm.c. + +# The file 'mergecomptrylist' contains the backward compatibility TRYs for the +# current directory. Just the current directory itself - not subdirectories. +# Only directories that contain programs with backward compatibility names +# have a 'mergecomptrylist'. The make file for a directory that has +# 'mergecomptrylist' sets make variable HAVE_MERGE_COMPAT to "YES". + +ifeq ($(HAVE_MERGE_COMPAT),YES) +mergetrylist: mergecomptrylist +endif mergetrylist: $(SUBDIRS:%=%/mergetrylist) cat /dev/null $(SUBDIRS:%=%/mergetrylist) >$@ $(SRCDIR)/buildtools/make_merge.sh $(MERGEBINARIES) >>$@ +ifeq ($(HAVE_MERGE_COMPAT),YES) + echo "/* Backward compatibility names from mergecomptrylist: */" >>$@ + cat mergecomptrylist >>$@ +endif # The "merge list" is a list of all the object files from this directory and # any subdirectories that have to be linked into the merged Netpbm program. diff --git a/converter/other/Makefile b/converter/other/Makefile index 02774e81..2be88781 100644 --- a/converter/other/Makefile +++ b/converter/other/Makefile @@ -166,6 +166,8 @@ endif OBJECTS = $(BINARIES:%=%.o) $(EXTRA_OBJECTS) MERGE_OBJECTS = $(MERGEBINARIES:%=%.o2) $(EXTRA_OBJECTS) +HAVE_MERGE_COMPAT=YES + pnmtops.o pnmtops.o2: CFLAGS_TARGET=$(PNMTOPS_NOFLATE_OPT) SCRIPTS = anytopnm pnmtoplainpnm @@ -296,3 +298,25 @@ ifeq ($(HAVE_PNGLIB),Y) cd $(PKGDIR)/bin ; \ $(SYMLINK) pamtopng$(EXE) pamrgbatopng$(EXE) endif + +mergecomptrylist: + cat /dev/null >$@ + echo "TRY(\"bmptoppm\", main_bmptopnm);" >>$@ + echo "TRY(\"gemtopbm\", main_gemtopnm);" >>$@ +ifneq ($(JPEGLIB),NONE) + echo "TRY(\"ppmtojpeg\", main_pnmtojpeg);" >>$@ +endif + echo "TRY(\"ppmtouil\", main_pamtouil);" >>$@ + echo "TRY(\"ppmtotga\", main_pamtotga);" >>$@ + echo "TRY(\"pnmtopnm\", main_pamtopnm);" >>$@ + echo "TRY(\"pnmtofits\", main_pamtofits);" >>$@ +ifneq ($(TIFF_PREREQ_MISSING),Y) + echo "TRY(\"pnmtotiff\", main_pamtotiff);" >>$@ +endif +ifeq ($(HAVE_PNGLIB),Y) + echo "TRY(\"pngtopnm\", main_pngtopam);" >>$@ +endif + echo "TRY(\"icontopbm\", main_sunicontopnm);" >>$@ +ifeq ($(HAVE_PNGLIB),Y) + echo "TRY(\"pamrgbatopng\", main_pamtopng);" >>$@ +endif diff --git a/converter/pbm/Makefile b/converter/pbm/Makefile index e7b0cee9..352b73de 100644 --- a/converter/pbm/Makefile +++ b/converter/pbm/Makefile @@ -38,6 +38,8 @@ OBJECTS = $(BINARIES:%=%.o) $(EXTRA_OBJECTS) MERGEBINARIES = $(BINARIES) MERGE_OBJECTS = $(MERGEBINARIES:%=%.o2) $(EXTRA_OBJECTS) +HAVE_MERGE_COMPAT=YES + SUBDIRS=pbmtoppa .PHONY: all @@ -82,6 +84,10 @@ install.bin.local: $(PKGDIR)/bin cd $(PKGDIR)/bin ; \ $(SYMLINK) pbmtosunicon$(EXE) pbmtoicon$(EXE) +mergecomptrylist: + cat /dev/null >$@ + echo "TRY(\"pbmtoicon\", main_pbmtosunicon);" >>$@ + thisdirclean: localclean .PHONY: localclean localclean: diff --git a/doc/HISTORY b/doc/HISTORY index cc00705e..d9315ad2 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -23,6 +23,10 @@ not yet BJH Release 10.85.00 pamtotga: Ignore extra planes in black and white or grayscale input instead of generating junk output. + Merge build: make old names for JPEG, TIFF, and PNG converter + programs work (function previously omitted by design because it + was too hard). + libnetpbm: Fix invalid memory reference in color name processing when trivial memory allocation fails. diff --git a/editor/Makefile b/editor/Makefile index 490900dd..de5ae666 100644 --- a/editor/Makefile +++ b/editor/Makefile @@ -51,6 +51,8 @@ OBJECTS = $(BINARIES:%=%.o) MERGE_OBJECTS = $(MERGEBINARIES:%=%.o2) +HAVE_MERGE_COMPAT=YES + .PHONY: all all: $(BINARIES) $(SUBDIRS:%=%/all) @@ -98,3 +100,15 @@ install.bin.local: $(PKGDIR)/bin cd $(PKGDIR)/bin ; \ rm -f pnmcomp$(EXE) ; \ $(SYMLINK) pamcomp$(EXE) pnmcomp$(EXE) + +mergecomptrylist: + cat /dev/null >$@ + echo "TRY(\"pnminterp\", main_pamstretch);" >>$@ + echo "TRY(\"pgmnorm\", main_pnmnorm);" >>$@ + echo "TRY(\"ppmnorm\", main_pnmnorm);" >>$@ + echo "TRY(\"pgmedge\", main_pamedge);" >>$@ + echo "TRY(\"pnmenlarge\", main_pamenlarge);" >>$@ + echo "TRY(\"pnmcut\", main_pamcut);" >>$@ + echo "TRY(\"pnmscale\", main_pamscale);" >>$@ + echo "TRY(\"pnmcomp\", main_pamcomp);" >>$@ + diff --git a/editor/specialty/Makefile b/editor/specialty/Makefile index 0599cf72..8d9ca044 100644 --- a/editor/specialty/Makefile +++ b/editor/specialty/Makefile @@ -41,6 +41,8 @@ OBJECTS = $(BINARIES:%=%.o) MERGE_OBJECTS = $(MERGEBINARIES:%=%.o2) +HAVE_MERGE_COMPAT=YES + .PHONY: all all: $(BINARIES) @@ -55,3 +57,7 @@ install.bin.local: $(PKGDIR)/bin cd $(PKGDIR)/bin ; \ rm -f pgmoil$(EXE) ; \ $(SYMLINK) pamoil$(EXE) pgmoil$(EXE) + +mergecomptrylist: + cat /dev/null >$@ + echo "TRY(\"pgmoil\", main_pamoil);" >>$@ diff --git a/netpbm.c b/netpbm.c index 6d70a77c..a9a0bf81 100644 --- a/netpbm.c +++ b/netpbm.c @@ -55,48 +55,8 @@ main(int argc, char *argv[]) { #include "mergetrylist" - /* Add the obsolete names for some programs */ - TRY("bmptoppm", main_bmptopnm); - TRY("gemtopbm", main_gemtopnm); - TRY("icontopbm", main_sunicontopnm); - TRY("pbmtoicon", main_pbmtosunicon); - TRY("pgmedge", main_pamedge); - TRY("pgmnorm", main_pnmnorm); - TRY("pgmoil", main_pamoil); - TRY("pgmslice", main_pamslice); - TRY("pnmarith", main_pamarith); - TRY("pngtopnm", main_pngtopam); - TRY("pnmarith", main_pamarith); - TRY("pnmcomp", main_pamcomp); - TRY("pnmcut", main_pamcut); - TRY("pnmdepth", main_pamdepth); - TRY("pnmfile", main_pamfile); - TRY("pnminterp", main_pamstretch); - TRY("pnmenlarge", main_pamenlarge); - TRY("pnmscale", main_pamscale); - TRY("pnmsplit", main_pamsplit); - TRY("pnmtofits", main_pamtofits); - TRY("pnmtopnm", main_pamtopnm); - TRY("ppmnorm", main_pnmnorm); - TRY("ppmtotga", main_pamtotga); - TRY("ppmtouil", main_pamtouil); - TRY("pnmtopnm", main_pamtopnm); - TRY("ppmnorm", main_pnmnorm); - TRY("ppmtotga", main_pamtotga); - - /* We don't do the ppmtojpeg alias because if user doesn't have a JPEG - library, there is no main_pnmtojpeg library. The right way to do - this is to have these TRY's generated by the subdirectory makes, - which would know whether pnmtojpeg was built into the merged binary - or not. But that's too much work. Same with TIFF and PNG converters. - - TRY("ppmtojpeg", main_pnmtojpeg); - TRY("pngtopnm", main_pngtopam); - TRY("pnmtotiff", main_pamtotiff); - TRY("pamrgbatopng", main_pamtopng); - */ - fprintf(stderr,"'%s' is an unknown Netpbm program name \n", cp ); + exit(1); } diff --git a/other/Makefile b/other/Makefile index 3314aede..aa0d75bb 100644 --- a/other/Makefile +++ b/other/Makefile @@ -45,6 +45,8 @@ OBJECTS = $(BINARIES:%=%.o) MERGEBINARIES = $(BINARIES) MERGE_OBJECTS = $(MERGEBINARIES:%=%.o2) +HAVE_MERGE_COMPAT=YES + .PHONY: all all: $(BINARIES) $(SUBDIRS:%=%/all) @@ -69,4 +71,10 @@ install.bin.local: $(PKGDIR)/bin rm -f pnmdepth$(EXE) ; \ $(SYMLINK) pamdepth$(EXE) pnmdepth$(EXE) +mergecomptrylist: + cat /dev/null >$@ + echo "TRY(\"pnmarith\", main_pamarith);" >>$@ + echo "TRY(\"pnmsplit\", main_pamsplit);" >>$@ + echo "TRY(\"pnmdepth\", main_pamdepth);" >>$@ + FORCE: -- cgit 1.4.1