Version bump. Change default crypto to loop-aes (since its actually maintained upstr...
authorMike Frysinger <vapier@gentoo.org>
Mon, 10 Jan 2005 04:34:23 +0000 (04:34 +0000)
committerMike Frysinger <vapier@gentoo.org>
Mon, 10 Jan 2005 04:34:23 +0000 (04:34 +0000)
sys-apps/util-linux/ChangeLog
sys-apps/util-linux/Manifest
sys-apps/util-linux/files/digest-util-linux-2.12p [new file with mode: 0644]
sys-apps/util-linux/files/util-linux-2.12p-fat-LABEL-support.patch [new file with mode: 0644]
sys-apps/util-linux/files/util-linux-2.12p-swapon-check-symlinks.patch [new file with mode: 0644]
sys-apps/util-linux/util-linux-2.12p.ebuild [new file with mode: 0644]

index cefde539ef5a8f661980a792b68689cce065eade..6d8864edca9745f87f1401894fbf55484a0c4f03 100644 (file)
@@ -1,6 +1,15 @@
 # ChangeLog for sys-apps/util-linux
 # Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/util-linux/ChangeLog,v 1.95 2005/01/10 01:36:32 weeve Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/util-linux/ChangeLog,v 1.96 2005/01/10 04:34:23 vapier Exp $
+
+*util-linux-2.12p (09 Jan 2005)
+
+  09 Jan 2005; Mike Frysinger <vapier@gentoo.org>
+  +files/util-linux-2.12p-fat-LABEL-support.patch,
+  +files/util-linux-2.12p-swapon-check-symlinks.patch,
+  +util-linux-2.12p.ebuild:
+  Version bump. Change default crypto to loop-aes (since its actually
+  maintained upstream) #69082 by Arnvid L. Karstad.
 
   09 Jan 2005; Jason Wever <weeve@gentoo.org> util-linux-2.12i-r1.ebuild:
   Stable on sparc, resolves bug #77295.
index 588cc0f6c1e096c3b124f3ca664e1ffe63f27312..3644f91e961fd7d0c90f3421efca0d124c27afbc 100644 (file)
@@ -1,9 +1,10 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-MD5 57673b282c25d0c720a58f6b279abf60 ChangeLog 16014
+MD5 a3d2fec802d92a0054cf3ccf1fc9d502 ChangeLog 16355
 MD5 9a09f8d531c582e78977dbfd96edc1f2 metadata.xml 164
 MD5 05bbf2629f4d1ab30d95e051cc923add util-linux-2.12i-r1.ebuild 3678
+MD5 6285cd723a19d84e43e70924fd12a7c8 util-linux-2.12p.ebuild 4421
 MD5 26220b8883c0ebc90c7caeb8ae21e6f3 util-linux-2.12-r5.ebuild 4195
 MD5 e3697bc8fd6a344e8cba1c7d32e34790 files/util-linux-2.11z-parallel-make.patch 369
 MD5 6aa1c240dd789327ea92e36309052950 files/no-symlink-resolve.patch 316
@@ -20,14 +21,17 @@ MD5 73c0cb6f9aa5fa84e701fc68d0478aac files/util-linux-2.12i-nfsv4.patch 12854
 MD5 8d4f1146f0699deb1e6872e1c81293e3 files/util-linux-2.12-selinux.diff.bz2 2558
 MD5 61beee95fb4696a6af11ffb84ddb055c files/util-linux-2.12i-ignore-managed.patch 506
 MD5 482305a63e330c809dc808af25ecfe33 files/util-linux-2.12i-pic.patch 2522
+MD5 d448f3b1b3ea21db4c2c4f303b48c1c8 files/digest-util-linux-2.12p 294
 MD5 5a1bf3d383850b6c8ca05cc4fe76c813 files/digest-util-linux-2.12-r5 154
 MD5 a9bc06c292401d6f2d27e8e4ebf7e6ae files/util-linux-2.12i-fat-LABEL-support.patch 2304
+MD5 08a8f7d810ef0413ab5226883daf9d87 files/util-linux-2.12p-fat-LABEL-support.patch 11349
+MD5 a4ffbd0d6a9a7b839c293623e417a326 files/util-linux-2.12p-swapon-check-symlinks.patch 911
 MD5 33ddd96078cf91030b80f73eb70f5371 files/util-linux-2.12i-swapon-check-symlinks.patch 875
 MD5 cfa3960fd97ca16c85b0d1b87e6ba226 files/digest-util-linux-2.12i-r1 156
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.9.14 (GNU/Linux)
 
-iD8DBQFB4e8ProRuSHgZdywRAjJcAJ46FqqHgNqMiqKjirgJJOLOCPkB1ACfYa8i
-pOSn2omBLrO3Prd04rqhZwg=
-=5xE5
+iD8DBQFB4gXproRuSHgZdywRAl0xAJ9h9+r4mrEqhlwSTfiDo03LK0/+jgCfdtYx
+gsibQZh53BGP7OuHabimP3A=
+=hH7x
 -----END PGP SIGNATURE-----
diff --git a/sys-apps/util-linux/files/digest-util-linux-2.12p b/sys-apps/util-linux/files/digest-util-linux-2.12p
new file mode 100644 (file)
index 0000000..6fc34d2
--- /dev/null
@@ -0,0 +1,4 @@
+MD5 d47e820f6880c21c8b4c0c7e8a7376cc util-linux-2.12p.tar.gz 2001658
+MD5 6e0deccf97db98d2ae751577d019efa4 util-linux-2.12i.tar.gz 1975468
+MD5 dee120b17425e1edf0a0c64f0e249c20 util-linux-2.12i-cryptoapi-losetup.patch.bz2 4800
+MD5 96110562e89bfaa501aeebc6e525e1ca util-linux-2.12p.diff.bz2 35205
diff --git a/sys-apps/util-linux/files/util-linux-2.12p-fat-LABEL-support.patch b/sys-apps/util-linux/files/util-linux-2.12p-fat-LABEL-support.patch
new file mode 100644 (file)
index 0000000..bc7d429
--- /dev/null
@@ -0,0 +1,312 @@
+diff -uNr util-linux-2.12/mount/get_label_uuid.c ../patch/util-linux-2.12/mount/get_label_uuid.c
+--- util-linux-2.12/mount/get_label_uuid.c     2002-11-26 12:18:01.000000000 +0100
++++ ../patch/util-linux-2.12/mount/get_label_uuid.c    2003-10-20 18:27:56.000000000 +0200
+@@ -94,6 +94,137 @@
+       return 0;
+ }
+           
++/* Remove trailing spaces */
++static void remtrailspc(char *label) {
++    char *c;
++
++    c = strchr(label, 0)-1;
++    while (c >= label && *c == ' ')
++        *(c--) = 0;
++}
++
++static int handle_fat_dirent(struct fat_dirent *dirent, char **label) {
++    size_t namesize;
++    
++    /* end-of-directory marker */
++    if (!dirent->s_filename[0])
++        return -1;
++
++    /* valid volume label */
++    if ((dirent->s_attr == 0x08 || dirent->s_attr == 0x28) && dirent->s_filename[0] != 0xe5) {
++        
++        /* sanity check */
++        if (dirent->s_size[0] || dirent->s_size[1] || dirent->s_size[2] || dirent->s_size[3] ||
++            dirent->s_cluster[0] || dirent->s_cluster[1])
++            return -1;
++            
++        namesize = sizeof(dirent->s_filename);
++        if (!(*label = calloc(namesize + 1, 1)))
++            return -1;
++        memcpy(*label, dirent->s_filename, namesize);
++        (*label)[namesize] = 0;
++        remtrailspc(*label);
++        
++        return 0;
++    }
++
++    return 1;
++}
++
++static int read_volume_label_fat(int fd, struct fat_super_block *fatsb, char **label) {
++    unsigned i, m;
++    off_t o;
++
++    m = assemble2le(fatsb->s_dirents);   /* root directory entries */  
++
++    o = (off_t) assemble2le(fatsb->s_ssec) *     /* bytes per sector */
++        ((off_t) assemble2le(fatsb->s_rsecs) +   /* reserved sectors */
++         (off_t) assemble2le(fatsb->s_spfat) *   /* sectors per fat */
++         (off_t) fatsb->s_nfats);                /* number of fats */ 
++    
++    for (i = 0; i < m; i++) {
++        struct fat_dirent dirent;
++        int rv;
++
++        if (lseek(fd, o, SEEK_SET) != o ||
++            read(fd, &dirent, sizeof(dirent)) != sizeof(dirent))
++            return -1;
++
++        if ((rv = handle_fat_dirent(&dirent, label)) != 1)
++            return rv;
++        
++        o += sizeof(dirent);
++    }
++    
++    return -1;
++}
++
++static int read_volume_label_fat32(int fd, struct fat32_super_block *fat32sb, char **label) {
++    unsigned c;
++    off_t fo, b, o;
++    int i, ifat;
++    size_t m, cs;
++    
++    ifat = fat32sb->s_mirror[0] & 128 ? (fat32sb->s_mirror[0] & 0xF) : 0;
++
++    if (ifat >= fat32sb->s_nfats)
++        return -1;
++    
++    fo = (off_t) assemble2le(fat32sb->s_ssec) *    /* bytes per sector */
++        ((off_t) assemble2le(fat32sb->s_rsecs) +   /* reserved sectors */
++         (off_t) assemble4le(fat32sb->s_spfat) *   /* sectors per fat */
++         (off_t) ifat);                            /* number of FAT used */
++
++    b = (off_t) assemble2le(fat32sb->s_ssec) *     /* bytes per sector */
++        ((off_t) assemble2le(fat32sb->s_rsecs) +   /* reserved sectors */
++         (off_t) assemble4le(fat32sb->s_spfat) *   /* sectors per fat */
++         (off_t) fat32sb->s_nfats);                /* number of FATs */
++
++    c = assemble4le(fat32sb->s_rcluster) & 0x0fffffffL;
++    if (c < 2 || c >= 0x0ffffff0)
++        return -1;
++
++    m = cs = assemble2le(fat32sb->s_ssec) * (size_t) fat32sb->s_scluster;
++    o = b + (off_t) cs*(c-2);
++
++    for (i = 0; i < 0xFFFF; i++) { /* safety against DoS attack */
++        struct fat_dirent dirent;
++        int rv;
++
++        if (lseek(fd, o, SEEK_SET) != o ||
++            read(fd, &dirent, sizeof(dirent)) != sizeof(dirent))
++            return -1;
++
++        if ((rv = handle_fat_dirent(&dirent, label)) != 1)
++            return rv;
++        
++        if (m > sizeof(dirent)) {
++            m -= sizeof(dirent);
++            o += sizeof(dirent);
++        } else {
++            off_t d;
++
++            /* next cluster */
++            
++            d = fo+4*c;
++            if (lseek(fd, d, SEEK_SET) != d ||
++                read(fd, &c, 4) != 4)
++                return -1;
++
++            c = assemble4le((char*) &c) & 0x0fffffffL;
++            if (c < 2 || c >= 0x0ffffff0) {
++                return -1;
++            }
++
++            m = cs;
++            o = b + cs*(c-2);
++        }
++    }
++    
++    
++    return -1;
++}
++
+ 
+ /*
+  * Get both label and uuid.
+@@ -111,6 +186,8 @@
+       struct ocfs_volume_label olbl;
+       struct ocfs2_super_block osb;
+       struct reiserfs_super_block reiserfssb;
++      struct fat_super_block fatsb;
++      struct fat32_super_block fat32sb;
+       int blksize;
+       int rv = 0;
+ 
+@@ -184,6 +245,87 @@
+               }
+               goto done;
+       }
++        if (lseek(fd, 0, SEEK_SET) == 0
++                   && read(fd, (char*) &fat32sb, sizeof(fat32sb)) == sizeof(fat32sb)
++                   && fat32sb.s_sig[0] == 0x55
++                   && fat32sb.s_sig[1] == 0xAA
++                   && (fat32sb.s_media & 0xF0) == 0xF0
++                   && (fat32sb.s_spfat_old[0] == 0)
++                   && (fat32sb.s_spfat_old[1] == 0)
++                   && fat32sb.s_extsig == 0x29
++                   && (memcmp(fat32sb.s_fs, "FAT32   ", 8) == 0)) {
++
++            *label = NULL;
++
++            /* If no root directory entry volume name was found use the one from the boot sector */
++            if (read_volume_label_fat32(fd, &fat32sb, label) != 0) {
++                if (memcmp(fat32sb.s_label, "NO NAME    ", 11) != 0 &&
++                    memcmp(fat32sb.s_label, "           ", 11) != 0 &&
++                    memcmp(fat32sb.s_label, "\0\0\0\0\0\0\0\0", 8) != 0) {
++                    
++                    namesize = sizeof(fat32sb.s_label);
++                    if ((*label = calloc(namesize + 1, 1)) != NULL) {
++                        memcpy(*label, fat32sb.s_label, namesize);
++                        (*label)[namesize] = 0;
++                        remtrailspc(*label);
++                    }
++                }
++            }
++
++            if (*label) {
++                
++                /* Set UUID from serial */
++                uuid[0] = fat32sb.s_serial[3];
++                uuid[1] = fat32sb.s_serial[2];
++                uuid[2] = fat32sb.s_serial[1];
++                uuid[3] = fat32sb.s_serial[0];
++                memset(uuid+4, 0, 12);
++                
++                rv = 0;
++            }
++      } else if (lseek(fd, 0, SEEK_SET) == 0
++                   && read(fd, (char*) &fatsb, sizeof(fatsb)) == sizeof(fatsb)
++                   && fatsb.s_sig[0] == 0x55
++                   && fatsb.s_sig[1] == 0xAA
++                   && (fatsb.s_media & 0xF0) == 0xF0
++                   && fatsb.s_extsig == 0x29
++                   && (memcmp(fatsb.s_fs, "FAT12   ", 8) == 0
++                       || memcmp(fatsb.s_fs, "FAT16   ", 8) == 0
++                       || memcmp(fatsb.s_fs, "FAT     ", 8) == 0
++                       || memcmp(fatsb.s_fs, "\0\0\0\0\0\0\0\0", 8) == 0)
++                   && memcmp(fatsb.s_fs2, "FAT32   ", 8) != 0) {
++
++            *label = NULL;
++            
++            if (read_volume_label_fat(fd, &fatsb, label) != 0) {
++
++                /* If no root directory entry volume name was found use the one from the boot sector */
++                if (memcmp(fatsb.s_label, "NO NAME    ", 11) != 0 &&
++                    memcmp(fatsb.s_label, "           ", 11) != 0 &&
++                    memcmp(fatsb.s_label, "\0\0\0\0\0\0\0\0", 8) != 0) {
++                    
++                    namesize = sizeof(fatsb.s_label);
++                    if ((*label = calloc(namesize + 1, 1)) != NULL) {
++                        memcpy(*label, fatsb.s_label, namesize);
++                        (*label)[namesize] = 0;
++                        remtrailspc(*label);
++                    }
++
++                }
++            }
++
++            if (*label) {
++
++                /* Set UUID from serial */
++                uuid[0] = fatsb.s_serial[3];
++                uuid[1] = fatsb.s_serial[2];
++                uuid[2] = fatsb.s_serial[1];
++                uuid[3] = fatsb.s_serial[0];
++                memset(uuid+4, 0, 12);
++                
++                rv = 0;
++            }
++        }
+ 
+       if (lseek(fd, REISERFS_DISK_OFFSET_IN_BYTES, SEEK_SET)
+           == REISERFS_DISK_OFFSET_IN_BYTES
+diff -uNr util-linux-2.12/mount/linux_fs.h ../patch/util-linux-2.12/mount/linux_fs.h
+--- util-linux-2.12/mount/linux_fs.h   2003-07-05 22:16:32.000000000 +0200
++++ ../patch/util-linux-2.12/mount/linux_fs.h  2003-10-20 18:07:06.000000000 +0200
+@@ -137,13 +137,65 @@
+     u_char    s_dummy[3];
+     u_char    s_os[8];                /* "MSDOS5.0" or "MSWIN4.0" or "MSWIN4.1" */
+                               /* mtools-3.9.4 writes "MTOOL394" */
+-    u_char    s_dummy2[32];
++    u_char    s_ssec[2];        /* bytes per sector */
++    u_char    s_scluster;       /* sectors per cluster */
++    u_char    s_rsecs[2];       /* reserved sectors */
++    u_char    s_nfats;          /* number of FATs */
++    u_char    s_dirents[2];     /* maximum root directory entries */
++    u_char    s_nsecs[2];       /* total number of sectors */
++    u_char    s_media;          /* media type, upper nibble is 0xF */
++    u_char    s_spfat[2];       /* sectors per fat */
++
++    u_char    s_dummy2[14];
++    u_char    s_extsig;         /* extended signature */
++    u_char    s_serial[4];      /* serial number */
+     u_char    s_label[11];    /* for DOS? */
+-    u_char    s_fs[8];                /* "FAT12   " or "FAT16   " or all zero   */
++    u_char    s_fs[8];                /* "FAT12   " or "FAT16   " or all zero   */
+                                 /* OS/2 BM has "FAT     " here. */
+-    u_char    s_dummy3[9];
+-    u_char    s_label2[11];   /* for Windows? */
+-    u_char    s_fs2[8];               /* garbage or "FAT32   " */
++
++    u_char    s_dummy3[20];
++    u_char    s_fs2[8];         /* "FAT32   " */
++
++    u_char    s_dummy4[420];
++    u_char    s_sig[2];         /* 55 AA */
++};
++
++struct fat32_super_block {
++    u_char    s_dummy[3];
++    u_char    s_os[8];                /* "MSDOS5.0" or "MSWIN4.0" or "MSWIN4.1" */
++                              /* mtools-3.9.4 writes "MTOOL394" */
++
++    u_char    s_ssec[2];        /* bytes per sector */
++    u_char    s_scluster;       /* sectors per cluster */
++    u_char    s_rsecs[2];       /* reserved sectors */
++    u_char    s_nfats;          /* number of FATs */
++    u_char    s_dirents[2];     /* maximum root directory entries */
++    u_char    s_nsecs[2];       /* total number of sectors */
++    u_char    s_media;          /* media type, upper nibble is 0xF */
++    u_char    s_spfat_old[2];   /* sectors per fat */
++
++    u_char    s_dummy2[12];
++    u_char    s_spfat[4];       /* sectors per FAT */
++    u_char    s_mirror[2];      /* mirror flag */
++    u_char    s_version[2];     /* fs version */
++    u_char    s_rcluster[4];    /* root directory cluster */
++
++    u_char    s_dummy3[18];
++    u_char    s_extsig;         /* extended signature 0x29 */
++    u_char    s_serial[4];      /* serial number */
++    u_char    s_label[11];      /* label */
++    u_char    s_fs[8];          /* filesystem type "FAT32   " */
++
++    u_char    s_dummy4[420];
++    u_char    s_sig[2];         /* 55 AA */
++};
++
++struct fat_dirent {
++    u_char    s_filename[11];   /* Filename with extension */
++    u_char    s_attr;           /* File attribute flags */
++    u_char    s_dummy[14];   
++    u_char    s_cluster[2];     /* Starting cluster */
++    u_char    s_size[4];        /* File size */
+ };
+ 
+ #define XFS_SUPER_MAGIC "XFSB"
diff --git a/sys-apps/util-linux/files/util-linux-2.12p-swapon-check-symlinks.patch b/sys-apps/util-linux/files/util-linux-2.12p-swapon-check-symlinks.patch
new file mode 100644 (file)
index 0000000..e53b84e
--- /dev/null
@@ -0,0 +1,33 @@
+--- util-linux-2.12b/mount/swapon.c.orig       2004-10-28 10:02:44.320023600 -0400
++++ util-linux-2.12b/mount/swapon.c    2004-10-28 10:02:14.384574000 -0400
+@@ -7,2 +7,3 @@
+ #include <stdlib.h>
++#include <sys/param.h>
+ #include <stdio.h>
+@@ -137,10 +138,26 @@
+ static int
+ is_in_proc_swaps(const char *fname) {
+       int i;
++      struct stat fstatbuf;
+ 
+       for (i = 0; i < numSwaps; i++)
+               if (swapFiles[i] && !strcmp(fname, swapFiles[i]))
+                       return 1;
++
++      /* fallback:
++       * if the device in /etc/fstab is a symlink, the entry
++       * in /proc/swaps won't match because the kernel stores
++       * absolute pathnames.  Here we compare dev_t's.
++       */
++      if (!lstat(fname, &fstatbuf))
++              if (S_ISLNK(fstatbuf.st_mode)) {
++                      struct stat swapstatbuf;
++                      for (i = 0; i < numSwaps; i++)
++                              if (swapFiles[i] && !stat(swapFiles[i], &swapstatbuf) && \
++                                  swapstatbuf.st_dev == fstatbuf.st_dev)
++                                      return 1;
++              }
++
+       return 0;
+ }
+ 
diff --git a/sys-apps/util-linux/util-linux-2.12p.ebuild b/sys-apps/util-linux/util-linux-2.12p.ebuild
new file mode 100644 (file)
index 0000000..466ea7d
--- /dev/null
@@ -0,0 +1,145 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/util-linux/util-linux-2.12p.ebuild,v 1.1 2005/01/10 04:34:23 vapier Exp $
+
+inherit eutils flag-o-matic toolchain-funcs
+
+OLD_CRYPT_VER=2.12i
+DESCRIPTION="Various useful Linux utilities"
+HOMEPAGE="http://www.kernel.org/pub/linux/utils/util-linux/"
+SRC_URI="mirror://kernel/linux/utils/${PN}/${P}.tar.gz
+       old-crypt? (
+               mirror://kernel/linux/utils/${PN}/${PN}-${OLD_CRYPT_VER}.tar.gz
+               mirror://gentoo/util-linux-${OLD_CRYPT_VER}-cryptoapi-losetup.patch.bz2
+       )
+       crypt? ( http://loop-aes.sourceforge.net/updates/util-linux-2.12p.diff.bz2 )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="crypt old-crypt nls static pam selinux perl"
+
+DEPEND="virtual/libc
+       >=sys-libs/ncurses-5.2-r2
+       >=sys-fs/e2fsprogs-1.34
+       selinux? ( sys-libs/libselinux )
+       pam? ( sys-apps/pam-login )
+       crypt? ( app-crypt/hashalot )"
+RDEPEND="${DEPEND}
+       perl? ( dev-lang/perl )
+       nls? ( sys-devel/gettext )"
+
+OLD_CRYPT_P=${WORKDIR}/${PN}-${OLD_CRYPT_VER}
+
+yesno() { useq $1 && echo yes || echo no; }
+
+src_unpack() {
+       unpack ${A}
+
+       # Old crypt support
+       if use old-crypt ; then
+               cd ${OLD_CRYPT_P}
+               epatch ${WORKDIR}/util-linux-${OLD_CRYPT_VER}-cryptoapi-losetup.patch
+       fi
+
+       cd ${S}
+
+       # crypto support
+       use crypt && epatch ${WORKDIR}/util-linux-2.12p.diff
+
+       # Fix rare failures with -j4 or higher
+       epatch ${FILESDIR}/${PN}-2.11z-parallel-make.patch
+
+       # Fix unreadable df output when using devfs ... this check is kind of 
+       # a hack, but whatever, the output isnt critical at all :P
+       [[ -e /dev/.devfs ]] && epatch ${FILESDIR}/no-symlink-resolve.patch
+
+       # Add the O option to agetty to display DNS domainname in the issue
+       # file, thanks to Marius Mauch <genone@genone.de>, bug #22275.
+       #
+       # NOTE:  Removing this will break future baselayout, so PLEASE
+       #        consult with me before doing so.
+       #
+       # <azarah@gentoo.org> (17 Jul 2003)
+       epatch ${FILESDIR}/${PN}-2.11z-agetty-domainname-option.patch
+
+       # Add NFS4 support (kernel 2.5/2.6)
+       epatch ${FILESDIR}/${PN}-2.12i-nfsv4.patch
+
+       # ignore managed/kudzu options #70873
+       epatch ${FILESDIR}/${PN}-2.12i-ignore-managed.patch
+
+       # Allow util-linux to be built with -fPIC
+       epatch ${FILESDIR}/${PN}-2.12i-pic.patch
+
+       # Add support to read fat/fat32 labels, bug #36722
+       epatch ${FILESDIR}/${PN}-2.12p-fat-LABEL-support.patch
+
+       # Install rdev on amd64 platform
+       epatch ${FILESDIR}/${PN}-2.12-amd64_rdev_installation.patch
+
+       # swapon gets confused by symlinks in /dev #69162
+       epatch ${FILESDIR}/${PN}-2.12p-swapon-check-symlinks.patch
+
+       # Enable random features
+       local mconfigs="MCONFIG"
+       use old-crypt && mconfigs="${OLD_CRYPT_P}/MCONFIG"
+       sed -i \
+               -e "/^HAVE_PAM=/s:no:$(yesno pam):" \
+               -e "/^HAVE_SELINUX=/s:no:$(yesno selinux):" \
+               -e "/^DISABLE_NLS=/s:no:$(yesno !nls):" \
+               -e "/^HAVE_KILL=/s:no:yes:" \
+               -e "/^HAVE_SLN=/s:no:yes:" \
+               -e "/^HAVE_TSORT/s:no:yes:" \
+               -e "s:-pipe -O2 \$(CPUOPT) -fomit-frame-pointer:${CFLAGS}:" \
+               -e "s:CPU=.*:CPU=${CHOST%%-*}:" \
+               -e "s:SUIDMODE=.*4755:SUIDMODE=4711:" \
+               ${mconfigs} || die "MCONFIG sed"
+}
+
+src_compile() {
+       append-ldflags -Wl,-z,now
+       use static && append-ldflags -static
+       export CC="$(tc-getCC)"
+
+       econf || die "configure failed"
+       emake || die "emake failed"
+
+       cd partx
+       has_version sys-kernel/linux26-headers && append-flags -include linux/compiler.h
+       emake CFLAGS="${CFLAGS}" || die "make partx failed"
+
+       if use old-crypt ; then
+               cd ${OLD_CRYPT_P}
+               econf || die "old configure failed"
+               emake -C lib || die "old lib failed"
+               emake -C mount losetup mount || die "old make failed"
+       fi
+}
+
+src_install() {
+       make install DESTDIR="${D}" || die "install failed"
+       dosbin partx/{addpart,delpart,partx} || die "dosbin"
+       use perl || rm -f "${D}"/usr/bin/chkdupexe
+
+       dodoc HISTORY MAINTAINER README VERSION
+       docinto examples
+       dodoc example.files/*
+
+       if use old-crypt ; then
+               cd ${OLD_CRYPT_P}/mount
+               into /
+               newsbin mount mount-old-crypt || die
+               newsbin losetup losetup-old-crypt || die
+       fi
+}
+
+pkg_postinst() {
+       if ! use old-crypt ; then
+               ewarn "This version of util-linux includes crypto support"
+               ewarn "for loop-aes instead of the old cryptoapi."
+               ewarn "If you need the older support, please re-emerge"
+               ewarn "util-linux with USE=old-crypt.  This will create"
+               ewarn "/sbin/mount-old-crypt and /sbin/losetup-old-crypt."
+       fi
+}