jbigkit-2.0-build.patch 9.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
diff -ur jbigkit.orig/libjbig/Makefile jbigkit/libjbig/Makefile
--- jbigkit.orig/libjbig/Makefile	2008-08-30 20:20:52.000000000 +0300
+++ jbigkit/libjbig/Makefile	2010-02-28 13:12:41.000000000 +0200
@@ -1,29 +1,54 @@
 # Unix makefile for the JBIG-KIT library
 # $Id: jbigkit-2.0-build.patch,v 1.1 2010/02/28 11:21:39 ssuominen Exp $
 
-# Select an ANSI/ISO C compiler here, GNU gcc is recommended
-CC = gcc
+AR ?= ar
+CC ?= gcc
+RANLIB ?= ranlib
+
+CFLAGS += -Wall -ansi -pedantic
+
+ifeq ($(USERLAND),Darwin)
+	SONAME = dylib
+else
+	SONAME = so
+endif
 
-# Options for the compiler: A high optimization level is suggested
-CFLAGS = -g -O -Wall -ansi -pedantic # --coverage
-
-all: libjbig.a tstcodec tstcodec85
+all: libjbig.a libjbig.$(SONAME) libjbig85.a libjbig85.$(SONAME) tstcodec tstcodec85
 
 tstcodec: tstcodec.o jbig.o jbig_ar.o
-	$(CC) $(CFLAGS) -o tstcodec $+
+	$(CC) $(LDFLAGS) $(CFLAGS) -o tstcodec $+
 
 tstcodec85: tstcodec85.o jbig85.o jbig_ar.o
-	$(CC) $(CFLAGS) -o tstcodec85 $+
+	$(CC) $(LDFLAGS) $(CFLAGS) -o tstcodec85 $+
 
 libjbig.a: jbig.o jbig_ar.o
 	rm -f libjbig.a
-	ar rc libjbig.a jbig.o jbig_ar.o
-	-ranlib libjbig.a
+	$(AR) rc libjbig.a jbig.o jbig_ar.o
+	-$(RANLIB) libjbig.a
+
+SOBJS = jbig.lo jbig_ar.lo
+
+libjbig.so: $(SOBJS)
+	$(CC) -shared $(LDFLAGS) -o $@ -Wl,-soname -Wl,$@ $(SOBJS)
+
+libjbig.dylib: $(SOBJS)
+	$(CC) -dynamic $(LDFLAGS) -o $@ -dynamiclib -install_name $@ $(SOBJS)
+
+SOBJS85 = jbig85.lo jbig_ar.lo
+
+libjbig85.so: $(SOBJS85)
+	$(CC) -shared $(LDFLAGS) -o $@ -Wl,-soname -Wl,$@ $(SOBJS85)
+
+libjbig85.dylib: $(SOBJS85)
+	$(CC) -dynamic $(LDFLAGS) -o $@ -dynamiclib -install_name $@ $(SOBJS85)
+
+%.lo: %.c jbig.h jbig85.h jbig_ar.h
+	$(CC) $(CFLAGS) -fPIC -c $< -o $@
 
 libjbig85.a: jbig85.o jbig_ar.o
 	rm -f libjbig85.a
-	ar rc libjbig85.a jbig85.o jbig_ar.o
-	-ranlib 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
diff -ur jbigkit.orig/Makefile jbigkit/Makefile
--- jbigkit.orig/Makefile	2008-08-30 23:40:22.000000000 +0300
+++ jbigkit/Makefile	2010-02-28 12:59:07.000000000 +0200
@@ -1,34 +1,25 @@
 # Unix makefile for JBIG-KIT
 # $Id: jbigkit-2.0-build.patch,v 1.1 2010/02/28 11:21:39 ssuominen Exp $
 
-# Select an ANSI/ISO C compiler here, GNU gcc is recommended
-CC = gcc
-
-# Options for the compiler: A high optimization level is suggested
-CCFLAGS = -O2 -W
-#CCFLAGS = -O -g -W -Wall -ansi -pedantic #-DDEBUG  # developer only
-
-CFLAGS = $(CCFLAGS) -I../libjbig
-
 VERSION=2.0
 
 all: lib pbm
-	@echo "Enter 'make test' in order to start some automatic tests."
+	@echo "Enter '$(MAKE) test' in order to start some automatic tests."
 
 lib:
-	(cd libjbig;  make "CC=$(CC)" "CFLAGS=$(CFLAGS)")
+	(cd libjbig;  $(MAKE))
 
 pbm: lib
-	(cd pbmtools; make "CC=$(CC)" "CFLAGS=$(CFLAGS)")
+	(cd pbmtools; $(MAKE))
 
 test: lib pbm
-	(cd libjbig;  make "CC=$(CC)" "CFLAGS=$(CFLAGS)" test)
-	(cd pbmtools; make "CC=$(CC)" "CFLAGS=$(CFLAGS)" test)
+	(cd libjbig;  $(MAKE) test)
+	(cd pbmtools; $(MAKE) test)
 
 clean:
 	rm -f *~ core
-	(cd libjbig; make clean)
-	(cd pbmtools; make clean)
+	(cd libjbig;  $(MAKE) clean)
+	(cd pbmtools; $(MAKE) clean)
 
 distribution: clean
 	rm -f libjbig/libjbig*.a
diff -ur jbigkit.orig/pbmtools/Makefile jbigkit/pbmtools/Makefile
--- jbigkit.orig/pbmtools/Makefile	2008-08-26 01:26:39.000000000 +0300
+++ jbigkit/pbmtools/Makefile	2010-02-28 13:01:19.000000000 +0200
@@ -2,10 +2,10 @@
 # $Id: jbigkit-2.0-build.patch,v 1.1 2010/02/28 11:21:39 ssuominen Exp $
 
 # Select an ANSI/ISO C compiler here, e.g. GNU gcc is recommended
-CC = gcc
+CC ?= gcc
 
 # Options for the compiler
-CFLAGS = -g -Wall -ansi -pedantic -I../libjbig # --coverage
+CFLAGS += -Wall -ansi -pedantic -I../libjbig
 
 .SUFFIXES: .1 .5 .txt $(SUFFIXES)
 
@@ -13,16 +13,16 @@
 	pbmtojbg.txt jbgtopbm.txt pbm.txt pgm.txt
 
 pbmtojbg: pbmtojbg.o ../libjbig/libjbig.a
-	$(CC) $(CFLAGS) -o pbmtojbg pbmtojbg.o -L../libjbig -ljbig
+	$(CC) $(LDFLAGS) $(CFLAGS) -o pbmtojbg pbmtojbg.o -L../libjbig -ljbig
 
 jbgtopbm: jbgtopbm.o ../libjbig/libjbig.a
-	$(CC) $(CFLAGS) -o jbgtopbm jbgtopbm.o -L../libjbig -ljbig
+	$(CC) $(LDFLAGS) $(CFLAGS) -o jbgtopbm jbgtopbm.o -L../libjbig -ljbig
 
 pbmtojbg85: pbmtojbg85.o ../libjbig/libjbig85.a
-	$(CC) $(CFLAGS) -o pbmtojbg85 pbmtojbg85.o -L../libjbig -ljbig85
+	$(CC) $(LDFLAGS) $(CFLAGS) -o pbmtojbg85 pbmtojbg85.o -L../libjbig -ljbig85
 
 jbgtopbm85: jbgtopbm85.o ../libjbig/libjbig85.a
-	$(CC) $(CFLAGS) -o jbgtopbm85 jbgtopbm85.o -L../libjbig -ljbig85
+	$(CC) $(LDFLAGS) $(CFLAGS) -o jbgtopbm85 jbgtopbm85.o -L../libjbig -ljbig85
 
 jbgtopbm.o: jbgtopbm.c ../libjbig/jbig.h
 pbmtojbg.o: pbmtojbg.c ../libjbig/jbig.h
@@ -31,31 +31,31 @@
 
 ../libjbig/libjbig.a: ../libjbig/jbig.c ../libjbig/jbig.h \
 	../libjbig/jbig_ar.c ../libjbig/jbig_ar.h
-	make -C ../libjbig libjbig.a
+	$(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
+	$(MAKE) -C ../libjbig libjbig85.a
 
 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
+	$(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
@@ -91,24 +91,24 @@
 	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
+	$(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!"
@@ -142,7 +142,7 @@
 	./jbgtopbm $< $@
 
 test-t82.pbm:
-	make -C ../libjbig tstcodec
+	$(MAKE) -C ../libjbig tstcodec
 	../libjbig/tstcodec $@
 
 .1.txt .5.txt: