From b425596a5202835f60e5a44d622d654e58da1059 Mon Sep 17 00:00:00 2001 From: Packit Date: Sep 14 2020 09:58:54 +0000 Subject: Apply patch jbigkit-2.1-shlib.patch patch_name: jbigkit-2.1-shlib.patch present_in_specfile: true --- diff --git a/Makefile b/Makefile index 9f7e3ba..4db84b8 100644 --- a/Makefile +++ b/Makefile @@ -4,25 +4,26 @@ CC = gcc # Options for the compiler: A high optimization level is suggested -CFLAGS = -O2 -W -Wno-unused-result +CFLAGS = $(RPM_OPT_FLAGS) -W -Wno-unused-result # CFLAGS = -O -g -W -Wall -Wno-unused-result -ansi -pedantic # -DDEBUG export CC CFLAGS VERSION=2.1 +export VERSION all: lib pbm @echo "Enter 'make test' in order to start some automatic tests." lib: - cd libjbig && $(MAKE) -e + make -C libjbig pbm: lib - cd pbmtools && $(MAKE) -e + make -C pbmtools test: lib pbm - cd libjbig && $(MAKE) test - cd pbmtools && $(MAKE) test + LD_LIBRARY_PATH=`pwd`/libjbig make -C libjbig test + LD_LIBRARY_PATH=`pwd`/libjbig make -C pbmtools test analyze: cd libjbig && $(MAKE) analyze @@ -30,8 +31,8 @@ analyze: clean: rm -f *~ core - cd libjbig && $(MAKE) clean - cd pbmtools && $(MAKE) clean + make -C libjbig clean + make -C pbmtools clean distribution: rm -rf jbigkit-$(VERSION) diff --git a/Makefile.shlib b/Makefile.shlib new file mode 100644 index 0000000..9f7e3ba --- /dev/null +++ b/Makefile.shlib @@ -0,0 +1,44 @@ +# Unix makefile for JBIG-KIT + +# Select an ANSI/ISO C compiler here, GNU gcc is recommended +CC = gcc + +# Options for the compiler: A high optimization level is suggested +CFLAGS = -O2 -W -Wno-unused-result +# CFLAGS = -O -g -W -Wall -Wno-unused-result -ansi -pedantic # -DDEBUG + +export CC CFLAGS + +VERSION=2.1 + +all: lib pbm + @echo "Enter 'make test' in order to start some automatic tests." + +lib: + cd libjbig && $(MAKE) -e + +pbm: lib + cd pbmtools && $(MAKE) -e + +test: lib pbm + cd libjbig && $(MAKE) test + cd pbmtools && $(MAKE) test + +analyze: + cd libjbig && $(MAKE) analyze + cd pbmtools && $(MAKE) analyze + +clean: + rm -f *~ core + cd libjbig && $(MAKE) clean + cd pbmtools && $(MAKE) clean + +distribution: + rm -rf jbigkit-$(VERSION) + git archive v$(VERSION) --prefix jbigkit-$(VERSION)/ | tar xvf - + make -C jbigkit-$(VERSION)/pbmtools txt + tar cvaf jbigkit-$(VERSION).tar.gz jbigkit-$(VERSION) + +release: + rsync -t jbigkit-$(VERSION).tar.gz $(HOME)/public_html/download/ + rsync -t jbigkit-$(VERSION)/CHANGES $(HOME)/public_html/jbigkit/ diff --git a/libjbig/Makefile b/libjbig/Makefile index f2898f5..dca9129 100644 --- a/libjbig/Makefile +++ b/libjbig/Makefile @@ -4,25 +4,27 @@ CC = gcc # Options for the compiler: A high optimization level is suggested -CFLAGS = -g -O -W -Wall -ansi -pedantic # --coverage +CFLAGS = $(RPM_OPT_FLAGS) -W -Wall -ansi -pedantic # --coverage +PICFLAGS := -fPIC -DPIC -all: libjbig.a libjbig85.a tstcodec tstcodec85 +all: libjbig.so.$(VERSION) tstcodec tstcodec85 -tstcodec: tstcodec.o jbig.o jbig_ar.o - $(CC) $(CFLAGS) -o tstcodec tstcodec.o jbig.o jbig_ar.o +tstcodec: tstcodec.o libjbig.so + $(CC) $(CFLAGS) -o tstcodec $< -L. -ljbig -tstcodec85: tstcodec85.o jbig85.o jbig_ar.o - $(CC) $(CFLAGS) -o tstcodec85 tstcodec85.o jbig85.o jbig_ar.o +tstcodec85: tstcodec85.o libjbig85.so + $(CC) $(CFLAGS) -o tstcodec85 $^ -L. -ljbig -libjbig.a: jbig.o jbig_ar.o - rm -f libjbig.a - ar rc libjbig.a jbig.o jbig_ar.o - -ranlib libjbig.a +%.so: %.so.$(VERSION) + ln -sf $< $@ -libjbig85.a: jbig85.o jbig_ar.o - rm -f libjbig85.a - ar rc libjbig85.a jbig85.o jbig_ar.o - -ranlib libjbig85.a +libjbig.so.$(VERSION): jbig.o jbig_ar.o + $(CC) $(CFLAGS) -shared -Wl,-soname,$@ -o $@ $^ + +libjbig85.so.$(VERSION): jbig85.o jbig_ar.o + $(CC) $(CFLAGS) -shared -Wl,-soname,$@ -o $@ $^ + +jbig.o jbig85.o jbig_ar.o: CFLAGS += $(PICFLAGS) jbig.o: jbig.c jbig.h jbig_ar.h jbig85.o: jbig85.c jbig85.h jbig_ar.h @@ -43,11 +45,11 @@ analyze: clang --analyze *.c test: tstcodec tstcodec85 - ./tstcodec - ./tstcodec85 + LD_LIBRARY_PATH=`pwd` ./tstcodec + LD_LIBRARY_PATH=`pwd` ./tstcodec85 t82test.pbm: tstcodec - ./tstcodec $@ + LD_LIBRARY_PATH=`pwd` ./tstcodec $@ clean: rm -f *.o *.gcda *.gcno *.gcov *.plist *~ core gmon.out dbg_d\=??.pbm diff --git a/libjbig/Makefile.shlib b/libjbig/Makefile.shlib new file mode 100644 index 0000000..f2898f5 --- /dev/null +++ b/libjbig/Makefile.shlib @@ -0,0 +1,55 @@ +# Unix makefile for the JBIG-KIT library + +# Select an ANSI/ISO C compiler here, GNU gcc is recommended +CC = gcc + +# Options for the compiler: A high optimization level is suggested +CFLAGS = -g -O -W -Wall -ansi -pedantic # --coverage + +all: libjbig.a libjbig85.a tstcodec tstcodec85 + +tstcodec: tstcodec.o jbig.o jbig_ar.o + $(CC) $(CFLAGS) -o tstcodec tstcodec.o jbig.o jbig_ar.o + +tstcodec85: tstcodec85.o jbig85.o jbig_ar.o + $(CC) $(CFLAGS) -o tstcodec85 tstcodec85.o jbig85.o jbig_ar.o + +libjbig.a: jbig.o jbig_ar.o + rm -f libjbig.a + ar rc libjbig.a jbig.o jbig_ar.o + -ranlib libjbig.a + +libjbig85.a: jbig85.o jbig_ar.o + rm -f libjbig85.a + ar rc libjbig85.a jbig85.o jbig_ar.o + -ranlib libjbig85.a + +jbig.o: jbig.c jbig.h jbig_ar.h +jbig85.o: jbig85.c jbig85.h jbig_ar.h +jbig_ar.o: jbig_ar.c jbig_ar.h +tstcodec.o: tstcodec.c jbig.h +tstcodec85.o: tstcodec85.c jbig85.h + +update-po: jbig.c jbig85.c Makefile + xgettext -ojbig.pot -k_ \ + --copyright-holder='Markus Kuhn' \ + --msgid-bugs-address='http://www.cl.cam.ac.uk/~mgk25/jbigkit/' \ + --package-name jbigkit \ + jbig.c jbig85.c + cd po && for po in *.po ; do \ + msgmerge --update $$po ../jbig.pot ; done + +analyze: + clang --analyze *.c + +test: tstcodec tstcodec85 + ./tstcodec + ./tstcodec85 + +t82test.pbm: tstcodec + ./tstcodec $@ + +clean: + rm -f *.o *.gcda *.gcno *.gcov *.plist *~ core gmon.out dbg_d\=??.pbm + rm -f t82test.pbm + rm -f tstcodec tstcodec85 diff --git a/pbmtools/Makefile b/pbmtools/Makefile index 6314af8..4aacd2d 100644 --- a/pbmtools/Makefile +++ b/pbmtools/Makefile @@ -4,26 +4,26 @@ CC = gcc # Options for the compiler -CFLAGS = -g -O -W -Wall -Wno-unused-result -ansi -pedantic # --coverage +CFLAGS = $(RPM_OPT_FLAGS) -W -Wall -Wno-unused-result -ansi -pedantic # --coverage CPPFLAGS = -I../libjbig .SUFFIXES: .1 .5 .txt $(SUFFIXES) .PHONY: txt test test82 test85 clean -all: pbmtojbg jbgtopbm pbmtojbg85 jbgtopbm85 txt +all: pbmtojbg jbgtopbm pbmtojbg85 jbgtopbm85 # txt txt: pbmtojbg.txt jbgtopbm.txt pbm.txt pgm.txt -pbmtojbg: pbmtojbg.o ../libjbig/libjbig.a +pbmtojbg: pbmtojbg.o ../libjbig/libjbig.so $(CC) $(CFLAGS) -o pbmtojbg pbmtojbg.o -L../libjbig -ljbig -jbgtopbm: jbgtopbm.o ../libjbig/libjbig.a +jbgtopbm: jbgtopbm.o ../libjbig/libjbig.so $(CC) $(CFLAGS) -o jbgtopbm jbgtopbm.o -L../libjbig -ljbig -pbmtojbg85: pbmtojbg85.o ../libjbig/libjbig85.a +pbmtojbg85: pbmtojbg85.o ../libjbig/libjbig85.so $(CC) $(CFLAGS) -o pbmtojbg85 pbmtojbg85.o -L../libjbig -ljbig85 -jbgtopbm85: jbgtopbm85.o ../libjbig/libjbig85.a +jbgtopbm85: jbgtopbm85.o ../libjbig/libjbig85.so $(CC) $(CFLAGS) -o jbgtopbm85 jbgtopbm85.o -L../libjbig -ljbig85 jbgtopbm.o: jbgtopbm.c ../libjbig/jbig.h @@ -31,13 +31,13 @@ pbmtojbg.o: pbmtojbg.c ../libjbig/jbig.h jbgtopbm85.o: jbgtopbm85.c ../libjbig/jbig85.h pbmtojbg85.o: pbmtojbg85.c ../libjbig/jbig85.h -../libjbig/libjbig.a: ../libjbig/jbig.c ../libjbig/jbig.h \ +../libjbig/libjbig.so: ../libjbig/jbig.c ../libjbig/jbig.h \ ../libjbig/jbig_ar.c ../libjbig/jbig_ar.h - make -C ../libjbig libjbig.a + make -C ../libjbig libjbig.so -../libjbig/libjbig85.a: ../libjbig/jbig85.c ../libjbig/jbig85.h \ +../libjbig/libjbig85.so: ../libjbig/jbig85.c ../libjbig/jbig85.h \ ../libjbig/jbig_ar.c ../libjbig/jbig_ar.h - make -C ../libjbig libjbig85.a + make -C ../libjbig libjbig85.so analyze: clang $(CPPFLAGS) --analyze *.c diff --git a/pbmtools/Makefile.shlib b/pbmtools/Makefile.shlib new file mode 100644 index 0000000..6314af8 --- /dev/null +++ b/pbmtools/Makefile.shlib @@ -0,0 +1,166 @@ +# Unix makefile for the JBIG-KIT PBM tools + +# Select an ANSI/ISO C compiler here, e.g. GNU gcc is recommended +CC = gcc + +# Options for the compiler +CFLAGS = -g -O -W -Wall -Wno-unused-result -ansi -pedantic # --coverage +CPPFLAGS = -I../libjbig + +.SUFFIXES: .1 .5 .txt $(SUFFIXES) +.PHONY: txt test test82 test85 clean + +all: pbmtojbg jbgtopbm pbmtojbg85 jbgtopbm85 txt + +txt: pbmtojbg.txt jbgtopbm.txt pbm.txt pgm.txt + +pbmtojbg: pbmtojbg.o ../libjbig/libjbig.a + $(CC) $(CFLAGS) -o pbmtojbg pbmtojbg.o -L../libjbig -ljbig + +jbgtopbm: jbgtopbm.o ../libjbig/libjbig.a + $(CC) $(CFLAGS) -o jbgtopbm jbgtopbm.o -L../libjbig -ljbig + +pbmtojbg85: pbmtojbg85.o ../libjbig/libjbig85.a + $(CC) $(CFLAGS) -o pbmtojbg85 pbmtojbg85.o -L../libjbig -ljbig85 + +jbgtopbm85: jbgtopbm85.o ../libjbig/libjbig85.a + $(CC) $(CFLAGS) -o jbgtopbm85 jbgtopbm85.o -L../libjbig -ljbig85 + +jbgtopbm.o: jbgtopbm.c ../libjbig/jbig.h +pbmtojbg.o: pbmtojbg.c ../libjbig/jbig.h +jbgtopbm85.o: jbgtopbm85.c ../libjbig/jbig85.h +pbmtojbg85.o: pbmtojbg85.c ../libjbig/jbig85.h + +../libjbig/libjbig.a: ../libjbig/jbig.c ../libjbig/jbig.h \ + ../libjbig/jbig_ar.c ../libjbig/jbig_ar.h + make -C ../libjbig libjbig.a + +../libjbig/libjbig85.a: ../libjbig/jbig85.c ../libjbig/jbig85.h \ + ../libjbig/jbig_ar.c ../libjbig/jbig_ar.h + make -C ../libjbig libjbig85.a + +analyze: + clang $(CPPFLAGS) --analyze *.c + +test: test82 test85 + +test82: pbmtojbg jbgtopbm + make IMG=ccitt1 OPTIONSP= dotest1 + make IMG=ccitt2 OPTIONSP= dotest1 + make IMG=ccitt3 OPTIONSP= dotest1 + make IMG=xvlogo "OPTIONSP=-d 3" dotest1 + make IMG=sandra OPTIONSP= OPTIONSJ= dotest2g + make IMG=sandra OPTIONSP=-b OPTIONSJ=-b dotest2g + make IMG=sandra OPTIONSP=-q OPTIONSJ= dotest2g + make IMG=sandra "OPTIONSP=-o 0" OPTIONSJ= dotest2g + make IMG=sandra "OPTIONSP=-o 2" OPTIONSJ= dotest2g + make IMG=multi OPTIONSP= OPTIONSJ= dotest2g + make IMG=multi OPTIONSP=-b OPTIONSJ=-b dotest2g + make IMG=mx "OPTIONSP=-q -s 3 -m 128" dotest1 + make IMG=mx "OPTIONSP=-q -s 3 -m 128" dotest2b + make IMG=mx "OPTIONSP=-q -s 3 -m 128 -p 92" dotest2b + make IMG=mx "OPTIONSP=-q -Y -1" dotest2b + make IMG=mx "OPTIONSP=-Y -1" dotest2b + rm -f test-*.jbg test-*.pbm test-*.pgm + ./jbgtopbm ../examples/ccitt1.jbg | ./pbmtojbg > test-ccitt1.jbg + cmp ../examples/ccitt1.jbg test-ccitt1.jbg + rm -f test-*.jbg test-*.pbm test-*.pgm + ./jbgtopbm < ../examples/ccitt1.jbg | ./pbmtojbg - test-ccitt1.jbg + cmp ../examples/ccitt1.jbg test-ccitt1.jbg + rm -f test-*.jbg test-*.pbm test-*.pgm + ./jbgtopbm < ../examples/ccitt1.jbg - test-ccitt1.pbm ; \ + ./pbmtojbg test-ccitt1.pbm test-ccitt1.jbg + cmp ../examples/ccitt1.jbg test-ccitt1.jbg + rm -f test-*.jbg test-*.pbm test-*.pgm + ./jbgtopbm ../examples/ccitt1.jbg test-ccitt1.pbm ; \ + ./pbmtojbg test-ccitt1.pbm >test-ccitt1.jbg + cmp ../examples/ccitt1.jbg test-ccitt1.jbg + rm -f test-*.jbg test-*.pbm test-*.pgm + @echo + @echo "The pbmtools have PASSED the functional tests. Good!" + @echo + +dotest1: + ./jbgtopbm ../examples/$(IMG).jbg test-$(IMG).pbm + ./pbmtojbg $(OPTIONSP) test-$(IMG).pbm test-$(IMG).jbg + cmp test-$(IMG).jbg ../examples/$(IMG).jbg + +dotest2b: + ./pbmtojbg $(OPTIONSP) test-$(IMG).pbm test-$(IMG).jbg + ./jbgtopbm $(OPTIONSJ) test-$(IMG).jbg test-$(IMG)-2.pbm + cmp test-$(IMG).pbm test-$(IMG)-2.pbm + +dotest2g: + ./pbmtojbg $(OPTIONSP) ../examples/$(IMG).pgm test-$(IMG).jbg + ./jbgtopbm $(OPTIONSJ) test-$(IMG).jbg test-$(IMG).pgm + cmp test-$(IMG).pgm ../examples/$(IMG).pgm + +test85: pbmtojbg jbgtopbm pbmtojbg85 jbgtopbm85 test-t82.pbm + make IMG=t82 "OPTIONSP=-p 0" dotest85 + make IMG=t82 "OPTIONSP=-p 8" dotest85 + make IMG=t82 "OPTIONSP=-p 8 -r" dotest85b + make IMG=t82 "OPTIONSP=-p 64" dotest85 + make IMG=t82 "OPTIONSP=-p 72" dotest85 + make IMG=t82 "OPTIONSP=-s 2 -C c" dotest85 + make IMG=t82 "OPTIONSP=-s 99999" dotest85 + make IMG=t82 "OPTIONSP=-Y 9999 0" dotest85 + make IMG=t82 "OPTIONSP=-Y 1951 0" dotest85 + make IMG=t82 "OPTIONSP=-Y -1 127" dotest85 + make IMG=t82 "OPTIONSP=-Y -1 128" dotest85 + make IMG=t82 "OPTIONSP=-Y -1 1919" dotest85 + make IMG=t82 "OPTIONSP=-Y -1 1920" dotest85 + make IMG=t82 "OPTIONSP=-Y -1 1949" dotest85 + make IMG=t82 "OPTIONSP=-Y -1 1950" dotest85 + make IMG=ccitt1 dotest85 + make IMG=ccitt2 dotest85 + make IMG=ccitt3 dotest85 + rm -f test-*.jbg test-*.jbg85 test-*.pbm + @echo + @echo "The T.85 pbmtools have PASSED the functional tests. Good!" + @echo + +dotest85: test-$(IMG).pbm + ./pbmtojbg85 $(OPTIONSP) test-$(IMG).pbm test-$(IMG).jbg85 + ls -l test-$(IMG).jbg85 + ./jbgtopbm test-$(IMG).jbg85 test-$(IMG).pbm85 + cmp test-$(IMG).pbm test-$(IMG).pbm85 + rm test-$(IMG).pbm85 + ./jbgtopbm85 test-$(IMG).jbg85 test-$(IMG).pbm85 + cmp test-$(IMG).pbm test-$(IMG).pbm85 + rm test-$(IMG).pbm85 + ./jbgtopbm85 -B 1 test-$(IMG).jbg85 test-$(IMG).pbm85 + cmp test-$(IMG).pbm test-$(IMG).pbm85 + +dotest85b: test-$(IMG).pbm + ./pbmtojbg -f $(OPTIONSP) test-$(IMG).pbm test-$(IMG).jbg85 + ls -l test-$(IMG).jbg85 + ./jbgtopbm test-$(IMG).jbg85 test-$(IMG).pbm85 + cmp test-$(IMG).pbm test-$(IMG).pbm85 + rm test-$(IMG).pbm85 + ./jbgtopbm85 test-$(IMG).jbg85 test-$(IMG).pbm85 + cmp test-$(IMG).pbm test-$(IMG).pbm85 + rm test-$(IMG).pbm85 + ./jbgtopbm85 -B 1 test-$(IMG).jbg85 test-$(IMG).pbm85 + cmp test-$(IMG).pbm test-$(IMG).pbm85 + +test-%.pbm: ../examples/%.jbg + ./jbgtopbm $< $@ + +test-t82.pbm: + make -C ../libjbig tstcodec + ../libjbig/tstcodec $@ + +FOPT=-c 1000 -p 300000 -m 3 +fuzz: test-t82.pbm + while \ + ./pbmtojbg -f test-t82.pbm | ./jbgfuzz.pl $(FOPT) && \ + ./pbmtojbg test-t82.pbm | ./jbgfuzz.pl $(FOPT) -d jbgtopbm ; \ + do true; done + +.1.txt .5.txt: + groff -man -Tascii -P -c -P -b -P -u $< >$@ + +clean: + rm -f *.o *~ core pbmtojbg jbgtopbm pbmtojbg85 jbgtopbm85 + rm -f test-*.jbg test-*.pbm test-*.pgm test-*.jbg85 test-*.pbm85 + rm -f *.gcda *.gcno *.plist