]> git.pld-linux.org Git - packages/util-linux.git/commitdiff
- enhanced diet patch (allow to disable few more utils, fix build without widechar)
authorJakub Bogusz <qboosh@pld-linux.org>
Sun, 14 Oct 2012 07:59:45 +0000 (09:59 +0200)
committerJakub Bogusz <qboosh@pld-linux.org>
Sun, 14 Oct 2012 07:59:45 +0000 (09:59 +0200)
- adjusted initrd build wrt. new buildsystem; now it builds

util-linux-diet.patch
util-linux.spec

index b027ee0bc866328658ff1f677ec93838f06ad0f1..b0085b0de95cd56be510883d7af626d10b143e3e 100644 (file)
        if (n <= 0)
                return 0;
  
+--- util-linux-2.22.1/lib/Makemodule.am.orig   2012-09-20 15:16:51.344635140 +0200
++++ util-linux-2.22.1/lib/Makemodule.am        2012-10-13 16:15:53.662070426 +0200
+@@ -5,7 +5,6 @@
+       lib/at.c \
+       lib/blkdev.c \
+       lib/canonicalize.c \
+-      lib/cpuset.c \
+       lib/crc32.c \
+       lib/env.c \
+       lib/fileutils.c \
+@@ -15,7 +14,6 @@
+       lib/mbsalign.c \
+       lib/md5.c \
+       lib/pager.c \
+-      lib/path.c \
+       lib/procutils.c \
+       lib/randutils.c \
+       lib/setproctitle.c \
+@@ -25,6 +23,12 @@
+       lib/wholedisk.c \
+       lib/xgetpass.c
++if HAVE_CPU_SET_T
++libcommon_la_SOURCES += \
++      lib/cpuset.c \
++      lib/path.c
++endif
++
+ if LINUX
+ libcommon_la_SOURCES += \
+       lib/linux_version.c \
+--- util-linux-2.22.1/lib/tt.c.orig    2012-09-20 15:16:51.349635172 +0200
++++ util-linux-2.22.1/lib/tt.c 2012-10-13 16:58:37.331962836 +0200
+@@ -59,11 +59,13 @@
+  */
+ static size_t mbs_safe_width(const char *s)
+ {
+-      mbstate_t st;
+       const char *p = s;
+       size_t width = 0;
++#ifdef HAVE_WIDECHAR
++      mbstate_t st;
+       memset(&st, 0, sizeof(st));
++#endif
+       while (p && *p) {
+               if (iscntrl((unsigned char) *p)) {
+@@ -108,7 +110,9 @@
+  */
+ static char *mbs_safe_encode(const char *s, size_t *width)
+ {
++#ifdef HAVE_WIDECHAR
+       mbstate_t st;
++#endif
+       const char *p = s;
+       char *res, *r;
+       size_t sz = s ? strlen(s) : 0;
+@@ -117,8 +121,9 @@
+       if (!sz)
+               return NULL;
++#ifdef HAVE_WIDECHAR
+       memset(&st, 0, sizeof(st));
+-
++#endif
+       res = malloc((sz * 4) + 1);
+       if (!res)
+               return NULL;
+--- util-linux-2.22.1/include/ttyutils.h.orig  2012-09-20 15:16:51.343635134 +0200
++++ util-linux-2.22.1/include/ttyutils.h       2012-10-13 16:58:53.058628843 +0200
+@@ -11,6 +11,7 @@
+ #define UL_TTY_KEEPCFLAGS     (1 << 1)
+ #define UL_TTY_UTF8           (1 << 2)
++#ifndef __dietlibc__
+ static inline void reset_virtual_console(struct termios *tp, int flags)
+ {
+       /* Use defaults of <sys/ttydefaults.h> for base settings */
+@@ -78,6 +79,7 @@
+       tp->c_cc[VLNEXT]   = CLNEXT;
+       tp->c_cc[VEOL2]    = _POSIX_VDISABLE;
+ }
++#endif
+ static inline int get_terminal_width(void)
+ {
+--- util-linux-2.22.1/configure.ac.orig        2012-10-13 17:14:16.488590090 +0200
++++ util-linux-2.22.1/configure.ac     2012-10-13 22:11:41.324507881 +0200
+@@ -915,6 +915,9 @@
+ UL_REQUIRES_HAVE([cramfs], [z], [z library])
+ AM_CONDITIONAL(BUILD_CRAMFS, test "x$build_cramfs" = xyes)
++AC_ARG_ENABLE([minix], AS_HELP_STRING([--disable-minix], [do not build fsck.minix]), [], enable_minix=yes)
++UL_BUILD_INIT([minix])
++AM_CONDITIONAL(BUILD_MINIX, test "x$build_minix" = xyes)
+ if test "x$have_io" = xyes -o "x$linux_os" = xyes; then
+   build_hwclock=yes
+@@ -1193,6 +1196,12 @@
+       [sched_getaffinity])
+ AM_CONDITIONAL(BUILD_TASKSET, test "x$build_taskset" = xyes)
++AC_ARG_ENABLE([setarch], AS_HELP_STRING([--disable-setarch], [do not build setarch]), [], enable_setarch=yes)
++UL_BUILD_INIT([setarch])
++AM_CONDITIONAL(BUILD_SETARCH, test "x$build_setarch" = xyes)
++AC_ARG_ENABLE([ldattach], AS_HELP_STRING([--disable-ldattach], [do not build ldattach]), [], enable_ldattach=yes)
++UL_BUILD_INIT([ldattach])
++AM_CONDITIONAL(BUILD_LDATTACH, test "x$build_ldattach" = xyes)
+ AC_ARG_ENABLE([wall],
+   AS_HELP_STRING([--disable-wall], [do not build wall]),
+--- util-linux-2.22.1/disk-utils/Makemodule.am.orig    2012-09-20 15:16:51.321634997 +0200
++++ util-linux-2.22.1/disk-utils/Makemodule.am 2012-10-13 22:12:29.384505863 +0200
+@@ -1,4 +1,4 @@
+-
++if BUILD_MINIX
+ sbin_PROGRAMS += fsck.minix
+ dist_man_MANS += disk-utils/fsck.minix.8
+ fsck_minix_SOURCES = \
+@@ -6,6 +6,7 @@
+       disk-utils/minix_programs.h \
+       lib/ismounted.c
+ fsck_minix_LDADD = $(LDADD) libcommon.la
++endif
+ sbin_PROGRAMS += mkfs.minix
+ dist_man_MANS += disk-utils/mkfs.minix.8
+--- util-linux-2.22.1/sys-utils/Makemodule.am.orig     2012-10-10 14:14:06.515276813 +0200
++++ util-linux-2.22.1/sys-utils/Makemodule.am  2012-10-13 22:18:31.467824001 +0200
+@@ -59,10 +59,12 @@
+ cytune_SOURCES = sys-utils/cytune.c sys-utils/cyclades.h
+ cytune_LDADD = $(LDADD) libcommon.la
++if BUILD_LDATTACH
+ usrsbin_exec_PROGRAMS += ldattach
+ dist_man_MANS += sys-utils/ldattach.8
+ ldattach_SOURCES = sys-utils/ldattach.c
+ ldattach_LDADD = $(LDADD) libcommon.la
++endif
+ usrsbin_exec_PROGRAMS += tunelp
+ dist_man_MANS += sys-utils/tunelp.8
+@@ -73,6 +75,7 @@
+ rtcwake_SOURCES = sys-utils/rtcwake.c
+ rtcwake_LDADD = $(LDADD) libcommon.la
++if BUILD_SETARCH
+ usrbin_exec_PROGRAMS += setarch
+ dist_man_MANS += sys-utils/setarch.8
+ setarch_SOURCES = sys-utils/setarch.c
+@@ -123,6 +124,7 @@
+ INSTALL_EXEC_HOOKS += install-exec-hook-setarch
+ UNINSTALL_HOOKS += uninstall-hook-setarch
++endif
+ endif # LINUX
index 454c0667f5a80394b01231b2348edbfed1c529a5..e5eba689ace7cc208ce07bdc54dd6369a02fca05 100644 (file)
@@ -1,8 +1,10 @@
 # TODO
-# - unpackaged files:
-#      /usr/share/getopt/getopt-parse.bash
-#      /usr/share/getopt/getopt-parse.tcsh
-# - fix initrd build
+# - verify initrd tools set:
+#   - I've taken list from 2.21.3 package, but there was no explicit list, so
+#     there are probably some unneeded tools
+#   - chrt is not built now (because of --disable-schedutils), but it's probably not needed
+#   - fsck is not built now (because of --disable-libmount)
+#   - maybe we want some more now?
 # - some sysvinit binaries moved here: su(1):, sulogin(8),
 #    utmpdump(1): - has been merged from coreutils into util-linux
 #
@@ -11,9 +13,9 @@
 %bcond_without dietlibc        # link initrd version with dietlibc instead of uClibc
 %bcond_without selinux         # SELinux support
 %if "%{pld_release}" == "ac"
-%bcond_with            initrd          # don't build initrd version
-%bcond_with            fallocate       # fallocate utility (needs glibc 2.11 to compile)
-%bcond_with            partx           # partx utility (needs glibc 2.10 for openat to compile)
+%bcond_with    initrd          # don't build initrd version
+%bcond_with    fallocate       # fallocate utility (needs glibc 2.11 to compile)
+%bcond_with    partx           # partx utility (needs glibc 2.10 for openat to compile)
 %else
 %bcond_without initrd          # don't build initrd version
 %bcond_without fallocate       # fallocate utility (needs glibc 2.11 to compile)
@@ -664,29 +666,40 @@ export CPPFLAGS="%{rpmcppflags} -I/usr/include/ncurses -DHAVE_LSEEK64_PROTOTYPE
 %{?with_dietlibc:xCC="%{__cc}"; xCC="diet ${xCC#*ccache }"}
 %configure \
 %if %{with dietlibc}
-       ac_cv_header_crypt_h="no" \
+       ac_cv_header_crypt_h=no \
+       ac_cv_header_stdio_ext_h=no \
 %endif
        CC="$xCC" \
 %if "%{?configure_cache}" == "1"
        --cache-file=%{?configure_cache_file}%{!?configure_cache_file:configure}-initrd.cache \
 %endif
+       --exec-prefix= \
+       --bindir=/bin \
+       --sbindir=/sbin \
+       --libdir=/%{_lib} \
        --disable-shared \
        --enable-static \
-       --disable-libblkid \
-       --disable-fsck \
+       --disable-agetty \
+       --disable-chfn-chsh \
        --disable-cramfs \
-       --disable-raw \
+       --disable-kill \
+       --disable-ldattach \
        --disable-libmount \
-       --disable-su \
-       --disable-sulogin \
-       --disable-chfn-chsh \
        --disable-login \
+       --disable-losetup \
+       --disable-minix \
        --disable-newgrp \
-       --disable-vipw \
+       --disable-partx \
+       --disable-raw \
        --disable-schedutils \
+       --disable-setarch \
        --disable-silent-rules \
+       --disable-su \
+       --disable-sulogin \
        --disable-use-tty-group \
        --disable-utmpdump \
+       --disable-uuidd \
+       --disable-vipw \
        --disable-wall \
        --without-audit \
        --without-ncurses \
@@ -695,18 +708,17 @@ export CPPFLAGS="%{rpmcppflags} -I/usr/include/ncurses -DHAVE_LSEEK64_PROTOTYPE
 # configure gets it unconditionally wrong
 %{__sed} -i -e 's/#define HAVE_WIDECHAR 1//' config.h
 
-for dir in libblkid libuuid disk-utils misc-utils fsck fdisk schedutils hwclock; do
-       %{__make} -C $dir \
-       %if %{with uClibc}
-               LDFLAGS="-Wl,-static"
-       %endif
-       %if %{with dietlibc}
-               CPPFLAGS="$CPPFLAGS -D_BSD_SOURCE" \
-               LDFLAGS="-lcompat"
-       %endif
-       # empty line required because there is a backslash up there
-       %{__make} -C $dir install DESTDIR=$(pwd)/initrd
-done
+%{__make} \
+%if %{with uClibc}
+       LDFLAGS="-Wl,-static"
+%endif
+%if %{with dietlibc}
+       CPPFLAGS="$CPPFLAGS -D_BSD_SOURCE" \
+       LDFLAGS="-lcompat"
+%endif
+
+%{__make} install \
+       DESTDIR=$(pwd)/initrd
 
 %{__make} clean
 %endif
@@ -718,23 +730,23 @@ done
        --disable-silent-rules \
        --disable-use-tty-group \
        --disable-wall \
-       --enable-su \
-       --enable-sulogin \
-       --enable-utmpdump \
-       --enable-libblkid \
+       --enable-chfn-chsh \
        --enable-chkdupexe \
        --enable-ddate \
-       --enable-chfn-chsh \
-       --enable-login \
-       --enable-newgrp \
-       --enable-vipw \
-       --enable-line \
        --enable-kill \
+       --enable-libblkid \
+       --enable-line \
+       --enable-login \
        --enable-login-chown-vcs \
+       --enable-newgrp \
        --enable-partx \
+       --enable-su \
+       --enable-sulogin \
+       --enable-utmpdump \
+       --enable-vipw \
        --enable-write \
        --with-audit \
-       --with%{!?with_selinux:out}-selinux
+       --with-selinux%{!?with_selinux:=no}
 
 %{__make}
 
@@ -794,21 +806,25 @@ done
        $RPM_BUILD_ROOT%{_mandir}/*/man5/nfs.5 \
        $RPM_BUILD_ROOT%{_mandir}/*/man8/{elvtune,setfdprm,sln,ramsize,raw,rdev,rootflags,vidmode}.8
 
-%ifarch sparc sparc64
+%ifarch sparc sparcv9 sparc64
+# programs not built on sparc
 %{__rm} $RPM_BUILD_ROOT%{_mandir}/*/man8/{cfdisk,sfdisk}.8
 %endif
 
+# examples
+%{__rm} $RPM_BUILD_ROOT%{_datadir}/getopt/getopt-parse.*sh
+
 %if %{with initrd}
 install -d $RPM_BUILD_ROOT%{_libdir}/initrd
-install -p initrd%{_bindir}/* $RPM_BUILD_ROOT%{_libdir}/initrd/
-install -p initrd%{_sbindir}/* $RPM_BUILD_ROOT%{_libdir}/initrd/
+install -p initrd/bin/* $RPM_BUILD_ROOT%{_libdir}/initrd
+install -p initrd/sbin/* $RPM_BUILD_ROOT%{_libdir}/initrd
 ln -s fsck $RPM_BUILD_ROOT%{_libdir}/initrd/e2fsck
 
 # We don't need those
-%{__rm} $RPM_BUILD_ROOT%{_libdir}/initrd/{chkdupexe,uuidd,mcookie,whereis,mkfs*,fsck.minix,isosize,logger}
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/initrd/{cal,col,colcrt,colrm,column,ctrlaltdel,cytune,dmesg,flock,fsfreeze,fstrim,getopt,hexdump,ipcmk,ipcrm,ipcs,isosize,logger,lslocks,mcookie,mkfs*,readprofile,renice,rev,rtcwake,script,scriptreplay,setsid,tailf,tunelp,wdctl,whereis}
 
 %if %{with dietlibc}
-cp -a initrd%{_libdir}/lib*.a $RPM_BUILD_ROOT%{dietlibdir}
+cp -a initrd/%{_lib}/lib*.a $RPM_BUILD_ROOT%{dietlibdir}
 %endif
 %endif
 
@@ -854,7 +870,7 @@ fi
 
 %files -f %{name}.lang
 %defattr(644,root,root,755)
-%doc */README.* NEWS
+%doc AUTHORS ChangeLog NEWS README README.licensing Documentation misc-utils/getopt-parse.{bash,tcsh}
 
 %attr(755,root,root) /sbin/clock
 %attr(755,root,root) /sbin/hwclock*
@@ -1008,6 +1024,7 @@ fi
 %{_mandir}/man1/script.1*
 %{_mandir}/man1/scriptreplay.1*
 %{_mandir}/man1/setterm.1*
+%{_mandir}/man1/su.1*
 %{_mandir}/man1/tailf.1*
 %{_mandir}/man1/taskset.1*
 %{_mandir}/man1/ul.1*
@@ -1470,5 +1487,25 @@ fi
 %if %{with initrd}
 %files initrd
 %defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/initrd/*
+%attr(755,root,root) %{_libdir}/initrd/blkid
+%attr(755,root,root) %{_libdir}/initrd/blockdev
+%attr(755,root,root) %{_libdir}/initrd/fdformat
+%attr(755,root,root) %{_libdir}/initrd/fdisk
+%attr(755,root,root) %{_libdir}/initrd/findfs
+%attr(755,root,root) %{_libdir}/initrd/hwclock
+%attr(755,root,root) %{_libdir}/initrd/look
+%attr(755,root,root) %{_libdir}/initrd/mkswap
+%attr(755,root,root) %{_libdir}/initrd/namei
+%attr(755,root,root) %{_libdir}/initrd/rename
+%ifnarch sparc sparcv9 sparc64
+%attr(755,root,root) %{_libdir}/initrd/sfdisk
+%endif
+%attr(755,root,root) %{_libdir}/initrd/swaplabel
+%attr(755,root,root) %{_libdir}/initrd/uuidgen
+%attr(755,root,root) %{_libdir}/initrd/wipefs
+# not needed?
+#%attr(755,root,root) %{_libdir}/initrd/chrt
+# not built because of disabled libmount
+#%attr(755,root,root) %{_libdir}/initrd/e2fsck
+#%attr(755,root,root) %{_libdir}/initrd/fsck
 %endif
This page took 0.169703 seconds and 4 git commands to generate.