]> git.pld-linux.org Git - packages/ash.git/blobdiff - ash.spec
- fixed for uclibc
[packages/ash.git] / ash.spec
index 45a716d6fa4a6b68f84966c350807d0e423bf1f7..04c1c1e0052e47dcb596378112d24ad1620960ee 100644 (file)
--- a/ash.spec
+++ b/ash.spec
@@ -1,5 +1,6 @@
+# Branch: HEAD
 # conditional build:
-# if BOOT is defined, build BOOT package too
+# _without_embed - don't build uClibc version
 Summary:       Small bourne shell from Berkeley
 Summary(de):   Kleine Bourne-Shell von Berkeley
 Summary(fr):   Shell Bourne réduit de Berkeley
@@ -7,39 +8,49 @@ Summary(pl):  Ma
 Summary(tr):   Ufak bir bourne kabuðu
 Name:          ash
 Version:       0.4.0
-Release:       1
+Release:       5
 License:       BSD
 Group:         Applications/Shells
 Group(de):     Applikationen/Shells
 Group(pl):     Aplikacje/Pow³oki
-Source:        ash-%{version}.tar.gz
-Patch0:                ash-builtin.patch
-Patch1:                ash-echo.patch
-Patch2:                ash-getcwd.patch
-Patch3:                ash-getopt.patch
-Patch4:                ash-glob.patch
-Patch5:                ash-jobs.patch
-Patch6:                ash-kill.patch
-Patch7:                ash-makefile.patch
-Patch8:                ash-manpage.patch
-Patch9:                ash-hetio.patch
-Patch10:       ash-memout.patch
-Patch11:       ash-misc.patch
-Patch12:       ash-redir.patch
-Patch13:       ash-setmode.patch
-Patch14:       ash-syntax.patch
-Patch15:       ash-test.patch
-Patch16:       ash-times.patch
-Patch17:       ash-debian.patch
-Patch18:       ash-ppid.patch
-Patch19:       ash-freebsd.patch
+Source:        %{name}-%{version}.tar.gz
+Patch0:                %{name}-builtin.patch
+Patch1:                %{name}-echo.patch
+Patch2:                %{name}-getcwd.patch
+Patch3:                %{name}-getopt.patch
+Patch4:                %{name}-glob.patch
+Patch5:                %{name}-jobs.patch
+Patch6:                %{name}-kill.patch
+Patch7:                %{name}-makefile.patch
+Patch8:                %{name}-manpage.patch
+Patch9:                %{name}-hetio.patch
+Patch10:       %{name}-memout.patch
+Patch11:       %{name}-misc.patch
+Patch12:       %{name}-redir.patch
+Patch13:       %{name}-setmode.patch
+Patch14:       %{name}-syntax.patch
+Patch15:       %{name}-test.patch
+Patch16:       %{name}-times.patch
+Patch17:       %{name}-debian.patch
+Patch18:       %{name}-ppid.patch
+Patch19:       %{name}-freebsd.patch
+Patch20:       %{name}-sighup.patch
 Prereq:                fileutils
 Prereq:                grep
 BuildRequires: glibc-static
-%{?BOOT:BuildRequires: uClibc-devel-BOOT}
+BuildRequires: flex
+BuildRequires: byacc
+%if %{!?_without_embed:1}%{?_without_embed:0}
+BuildRequires: uClibc-devel
+BuildRequires: uClibc-static
+%endif
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 Conflicts:     mkinitrd <= 1.7
 
+%define embed_path     /usr/lib/embed
+%define embed_cc       %{_arch}-uclibc-cc
+%define embed_cflags   %{rpmcflags} -Os
+
 %define                _bindir         /bin
 
 %description
@@ -103,8 +114,7 @@ ash, Berkeley'in bir bourne kabu
 komutlarýnýn tümünü destekler ve bash kabuðundan daha küçük olma
 avantajýna sahiptir.
 
-%if %{?BOOT:1}%{!?BOOT:0}
-%package BOOT
+%package embed
 Summary:       Small bourne shell from Berkeley
 Summary(de):   Kleine Bourne-Shell von Berkeley
 Summary(fr):   Shell Bourne réduit de Berkeley
@@ -114,16 +124,14 @@ Group:            Applications/Shells
 Group(de):     Applikationen/Shells
 Group(pl):     Aplikacje/Pow³oki
 
-%description BOOT
+%description embed
 ash is a bourne shell clone from Berkeley. It supports all of the
 standard Bourne shell commands and has the advantage of supporting
 them while remaining considerably smaller than bash.
-Version for bootdisk
-
-%endif
+Version for embedded systems.
 
 %prep
-%setup -q -n ash-%{version}
+%setup -q
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
@@ -145,35 +153,41 @@ Version for bootdisk
 %patch17 -p1
 %patch18 -p1
 %patch19 -p1
+%patch20 -p1
 
 %build
 # BOOT
-%if %{?BOOT:1}%{!?BOOT:0}
+%if %{!?_without_embed:1}%{?_without_embed:0}
+# some of this utilities does not compile with uClibc
+# and it is not necessary
+%{__make} mksignames mkbuiltins mknodes mksignames mksyntax mktokens
+%{__make} \
+       OPT_FLAGS="%{embed_cflags}" \
+       CC=%{embed_cc}
+mv -f sh ash-embed-shared
 %{__make} \
-       OPT_FLAGS="-I/usr/lib/bootdisk%{_includedir} -Os" \
-       LDFLAGS="-nostdlib -s" \
-       LDLIBS="%{_libdir}/bootdisk%{_libdir}/crt0.o %{_libdir}/bootdisk%{_libdir}/libc.a -lgcc"
-mv -f sh ash.BOOT
+       OPT_FLAGS="%{embed_cflags}" \
+       LDFLAGS="-static" \
+       CC=%{embed_cc}
+mv -f sh ash-embed-static
 %{__make} clean
 %endif
 
 # other
-%{__make} OPT_FLAGS="%{?debug:-O0 -g}%{!?debug:$RPM_OPT_FLAGS}" \
-       LDFLAGS="-static %{!?debug:-s}"
+%{__make} OPT_FLAGS="%{rpmcflags}" LDFLAGS="-static %{rpmldflags}"
 mv -f sh ash.static
-%{__make} OPT_FLAGS="%{?debug:-O0 -g}%{!?debug:$RPM_OPT_FLAGS}" \
-       LDFLAGS="%{!?debug:-s}"
-
-
+%{__make} OPT_FLAGS="%{rpmcflags}" LDFLAGS="%{rpmldflags}"
 
 %install
 rm -rf $RPM_BUILD_ROOT
 
 # BOOT
-%if %{?BOOT:1}%{!?BOOT:0}
-install -d $RPM_BUILD_ROOT/usr/lib/bootdisk/bin
-install -s ash.BOOT $RPM_BUILD_ROOT/usr/lib/bootdisk/bin/ash
-ln -s ash $RPM_BUILD_ROOT/usr/lib/bootdisk/bin/sh
+%if %{!?_without_embed:1}%{?_without_embed:0}
+install -d $RPM_BUILD_ROOT/%{embed_path}/{shared,static}
+install ash-embed-static $RPM_BUILD_ROOT/%{embed_path}/static/ash
+install ash-embed-shared $RPM_BUILD_ROOT/%{embed_path}/shared/ash
+ln -sf ash $RPM_BUILD_ROOT/%{embed_path}/shared/sh
+ln -sf ash $RPM_BUILD_ROOT/%{embed_path}/static/sh
 %endif
 
 # other
@@ -189,10 +203,10 @@ if [ ! -f /etc/shells ]; then
         echo "%{_bindir}/ash" > /etc/shells
         echo "%{_bindir}/bsh" >> /etc/shells
 else
-        if ! grep '^%{_bindir}/ash$' /etc/shells > /dev/null; then
+        if ! grep -q '^%{_bindir}/ash$' /etc/shells ; then
                 echo "%{_bindir}/ash" >> /etc/shells
         fi
-        if ! grep '^%{_bindir}/bsh$' /etc/shells > /dev/null; then
+        if ! grep -q '^%{_bindir}/bsh$' /etc/shells ; then
                 echo "%{_bindir}/bsh" >> /etc/shells
         fi
 fi
@@ -201,27 +215,27 @@ fi
 if [ ! -f /etc/shells ]; then
         echo "%{_bindir}/ash.static" >> /etc/shells
 else
-        if ! grep '^%{_bindir}/ash.static$' /etc/shells > /dev/null; then
+        if ! grep -q '^%{_bindir}/ash.static$' /etc/shells ; then
                 echo "%{_bindir}/ash.static" >> /etc/shells
         fi
 fi
 
 %preun
-if [ "$0" = 0 ]; then
-        grep -v %{_bindir}/ash /etc/shells | grep -v %{_bindir}/bsh | grep -v %{_bindir}/ash.static > /etc/shells.new
+if [ "$1" = 0 ]; then
+        grep -v '^%{_bindir}/ash$' /etc/shells | grep -v '^%{_bindir}/bsh$' > /etc/shells.new
         mv -f /etc/shells.new /etc/shells
 fi
 
 %preun static
-if [ "$0" = 0 ]; then
-        grep -v %{_bindir}/ash /etc/shells | grep -v %{_bindir}/bsh > /etc/shells.new
+if [ "$1" = 0 ]; then
+        grep -v '^%{_bindir}/ash\.static$' /etc/shells > /etc/shells.new
         mv -f /etc/shells.new /etc/shells
 fi
 
 %verifyscript
-for n in ash bsh ash.static; do
+for n in ash bsh ; do
     echo -n "Looking for $n in /etc/shells... "
-    if ! grep "^%{_bindir}/${n}\$" /etc/shells > /dev/null; then
+    if ! grep -q "^%{_bindir}/${n}\$" /etc/shells ; then
        echo "missing"
        echo "${n} missing from /etc/shells" >&2
     else
@@ -229,6 +243,15 @@ for n in ash bsh ash.static; do
     fi
 done
 
+%verifyscript static
+echo -n "Looking for ash.static in /etc/shells... "
+if ! grep -q '^%{_bindir}/ash\.static$' /etc/shells ; then
+       echo "missing"
+       echo "ash.static missing from /etc/shells" >&2
+else
+       echo "found"
+fi
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -242,8 +265,8 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_bindir}/ash.static
 
-%if %{?BOOT:1}%{!?BOOT:0}
-%files BOOT
+%if %{!?_without_embed:1}%{?_without_embed:0}
+%files embed
 %defattr(644,root,root,755)
-%attr(755,root,root) /usr/lib/bootdisk/bin/*
+%attr(755,root,root) %{embed_path}/*/*
 %endif
This page took 0.563875 seconds and 4 git commands to generate.