Teach file about DragonFly's ELF ABI tagging.
authorJoerg Sonnenberger <joerg@dragonflybsd.org>
Wed, 1 Jun 2005 15:09:11 +0000 (15:09 +0000)
committerJoerg Sonnenberger <joerg@dragonflybsd.org>
Wed, 1 Jun 2005 15:09:11 +0000 (15:09 +0000)
Go ahead for local patch by maintainer.

lib/libmagic/Makefile
lib/libmagic/patches/readelf.c.patch [new file with mode: 0644]
lib/libmagic/patches/readelf.h.patch [new file with mode: 0644]

index d9f8bc4..57ea1c9 100644 (file)
@@ -1,8 +1,10 @@
-# $DragonFly: src/lib/libmagic/Makefile,v 1.8 2005/06/01 14:34:46 joerg Exp $
+# $DragonFly: src/lib/libmagic/Makefile,v 1.9 2005/06/01 15:09:11 joerg Exp $
 
 MAGICDIR= ${.CURDIR}/../../contrib/file-4/magic
-SRCDIR=        ${.CURDIR}/../../contrib/file-4/src
-.PATH: ${SRCDIR}
+PATCHES!=      echo ${.CURDIR}/patches/*.patch
+CONTRIBDIR=    ${.CURDIR}/../../contrib/file-4/src
+.PATH: ${CONTRIBDIR}
+
 
 MAGIC= /usr/share/misc/magic
 
@@ -11,10 +13,11 @@ SHLIB_MAJOR=        2
 
 SRCS=  apprentice.c apptype.c ascmagic.c compress.c fsmagic.c funcs.c\
        is_tar.c magic.c print.c readelf.c softmagic.c
+SRCS+= ${PATCHES}
 INCS=  magic.h
 
 CFLAGS+= -DHAVE_CONFIG_H -DMAGIC=\"${MAGIC}\"
-CFLAGS+= -I${.CURDIR} -I${SRCDIR}
+CFLAGS+= -I${.CURDIR} -I${CONTRIBDIR}
 
 
 
@@ -40,7 +43,7 @@ magic.mime.mgc: mkmagic.nx ${MAGICDIR}/magic.mime
 CLEANFILES+=   mkmagic.nx
 build-tools: mkmagic.nx
 
-NXCFLAGS+=     -DHAVE_CONFIG_H -DCOMPILE_ONLY -I${.CURDIR} -I${SRCDIR}
+NXCFLAGS+=     -DHAVE_CONFIG_H -DCOMPILE_ONLY -I${.CURDIR} -I${CONTRIBDIR}
 mkmagic.nx: apprentice.c funcs.c magic.c print.c
        ${NXCC} ${NXCFLAGS} ${NXLDFLAGS} ${.ALLSRC} ${NXLDLIBS} -o ${.TARGET}
 
diff --git a/lib/libmagic/patches/readelf.c.patch b/lib/libmagic/patches/readelf.c.patch
new file mode 100644 (file)
index 0000000..2e87cd5
--- /dev/null
@@ -0,0 +1,24 @@
+$DragonFly: src/lib/libmagic/patches/Attic/readelf.c.patch,v 1.1 2005/06/01 15:09:11 joerg Exp $
+
+--- readelf.c  18 Dec 2004 17:18:06 -0000      1.1
++++ readelf.c  1 Jun 2005 13:53:21 -0000
+@@ -487,6 +487,19 @@
+               return size;
+       }
++      if (namesz == 10 && strcmp((char *)&nbuf[noff], "DragonFly") == 0 &&
++          nh_type == NT_DRAGONFLY_VERSION && descsz == 4) {
++              if (file_printf(ms, ", for DragonFly") == -1)
++                      return size;
++              uint32_t desc;
++              (void)memcpy(&desc, &nbuf[doff], sizeof(desc));
++              desc = getu32(swap, desc);
++              if (file_printf(ms, " %d.%d.%d", desc / 100000,
++                  desc / 10000 % 10, desc % 10000) == -1)
++                      return size;
++              return size;
++      }
++
+       /*
+        * Sigh.  The 2.0.36 kernel in Debian 2.1, at
+        * least, doesn't correctly implement name
diff --git a/lib/libmagic/patches/readelf.h.patch b/lib/libmagic/patches/readelf.h.patch
new file mode 100644 (file)
index 0000000..dedf95f
--- /dev/null
@@ -0,0 +1,12 @@
+$DragonFly: src/lib/libmagic/patches/Attic/readelf.h.patch,v 1.1 2005/06/01 15:09:11 joerg Exp $
+
+--- readelf.h  18 Dec 2004 17:18:06 -0000      1.1
++++ readelf.h  31 May 2005 23:00:18 -0000
+@@ -223,6 +223,7 @@
+ #define NT_NETBSD_EMULATION   2
+ #define NT_FREEBSD_VERSION    1
+ #define NT_OPENBSD_VERSION    1
++#define NT_DRAGONFLY_VERSION  1
+ /* GNU executables (name = "GNU") */
+ #define NT_GNU_VERSION                1