File dirdiff.patch of Package dirdiff
- build the shared lib with -fPIC
- use DESTDIR in the install target, not as global offset
- fix warnings which appear with the newly added -Wall
- add global OPTFLAGS= variable, which can be used to pass
RPM_OPT_FLAGS in a rpm specfile.
Signed-off-by: Olaf Hering <olh@suse.de>
Index: dirdiff-2.1/Makefile
===================================================================
--- dirdiff-2.1.orig/Makefile
+++ dirdiff-2.1/Makefile
@@ -2,21 +2,25 @@
#
# In fact all we have to make is the libfilecmp.so.0.0 library.
-BINDIR=$(DESTDIR)/usr/bin
-LIBDIR=$(DESTDIR)/usr/lib
+DESTDIR=
+BINDIR=/usr/bin
+LIBDIR=/usr/lib
INSTALL=install
+OPTFLAGS=-O3
# You may need to change the -I arguments depending on your system
-CFLAGS=-O3 -I/usr/include/tcl8.3/ -I/usr/include/tcl
+CFLAGS=$(OPTFLAGS) -Wall -I/usr/include/tcl8.3/ -I/usr/include/tcl
all: libfilecmp.so.0.0
libfilecmp.so.0.0: filecmp.c
- $(CC) $(CFLAGS) -shared -o $@ filecmp.c
+ $(CC) $(CFLAGS) -fPIC -shared -o $@ filecmp.c
install: dirdiff libfilecmp.so.0.0
- $(INSTALL) -c dirdiff $(BINDIR)
- $(INSTALL) -c libfilecmp.so.0.0 $(LIBDIR)
+ mkdir -p $(DESTDIR)$(BINDIR)
+ mkdir -p $(DESTDIR)$(LIBDIR)
+ $(INSTALL) -c dirdiff $(DESTDIR)$(BINDIR)
+ $(INSTALL) -c libfilecmp.so.0.0 $(DESTDIR)$(LIBDIR)
clean:
rm -f libfilecmp.so.0.0
Index: dirdiff-2.1/filecmp.c
===================================================================
--- dirdiff-2.1.orig/filecmp.c
+++ dirdiff-2.1/filecmp.c
@@ -10,6 +10,7 @@
#include <string.h>
#include <ctype.h>
#include <tcl.h>
+#include <unistd.h>
#include <sys/fcntl.h>
#define BSIZE 32768
@@ -28,6 +29,8 @@ char *rcs_ignores[] = {
"Date",
"State",
"Header",
+ "XFree86",
+ "Xorg",
NULL
};
@@ -48,9 +51,9 @@ tag_length(p, n)
char *p;
int n;
{
- int i, j, k, l;
+ int i, j, l;
int maybe;
- char *t, *cl;
+ char *t;
/* check through list of tags */
for (i = 0; (t = rcs_ignores[i]) != NULL; ++i) {
@@ -125,7 +128,7 @@ int rcscmp(char *p1, int *k1p, char *p2,
p2 += i;
k2 -= i;
/* 4 == strlen("<dollar>Id<dollar>") */
- if (k1 < 4 && !e1 || k2 < 4 && !e2)
+ if (((k1 < 4) && (!e1)) || ((k2 < 4) && (!e2)))
break;
if (k1 < 4 || k2 < 4) {
/* near the end of one or both files */
@@ -195,7 +198,7 @@ int bkcmp(char *p1, int *k1p, char *p2,
k2 -= i;
if (match < BKTAGLEN) {
/* we have run out of one or other buffer */
- if (k1 == 0 && e1 || k2 == 0 && e2) {
+ if (((k1 == 0) && e1) || ((k2 == 0) && e2)) {
if (k1 == k2)
break;
return 0;
@@ -219,7 +222,7 @@ int bkcmp(char *p1, int *k1p, char *p2,
continue;
}
/* ran out before eol on one or both files */
- if (t1 == k1 && e1 || t2 == k2 && e2) {
+ if (((t1 == k1) && e1) || ((t2 == k2) && e2)) {
k1 -= t1;
k2 -= t2;
if (k1 == k2)
@@ -243,7 +246,7 @@ FileCmpCmd(clientData, interp, argc, arg
int argc;
char **argv;
{
- int i, fi;
+ int fi;
int f1, f2;
char *b1, *b2;
int n1, n2, same;