2007-01-12 17:45:13 +01:00
|
|
|
#
|
2011-04-05 08:31:12 +02:00
|
|
|
# spec file for package ksh
|
2007-01-12 17:45:13 +01:00
|
|
|
#
|
2013-01-15 14:35:32 +01:00
|
|
|
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
2007-01-12 17:45:13 +01:00
|
|
|
#
|
2008-09-24 17:01:34 +02:00
|
|
|
# All modifications and additions to the file contributed by third parties
|
|
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
|
|
# upon. The license for this file, and modifications and additions to the
|
|
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
|
|
# license for the pristine package is not an Open Source License, in which
|
|
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
|
|
# published by the Open Source Initiative.
|
|
|
|
|
2007-01-12 17:45:13 +01:00
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
|
|
#
|
|
|
|
|
2012-02-17 11:11:52 +01:00
|
|
|
|
2007-01-12 17:45:13 +01:00
|
|
|
Name: ksh
|
2013-02-05 18:51:33 +01:00
|
|
|
%global date 2012-08-01
|
2012-02-16 14:19:50 +01:00
|
|
|
%global use_suid_exe 0
|
2012-02-10 17:47:32 +01:00
|
|
|
%if %suse_version > 1210
|
|
|
|
%global use_opt_bins 1
|
|
|
|
%else
|
|
|
|
%global use_opt_bins 0
|
|
|
|
%endif
|
|
|
|
%if !0%{?qemu_user_space_build:1}
|
|
|
|
%global do_tests 1
|
|
|
|
%else
|
|
|
|
%global do_tests 0
|
|
|
|
%endif
|
|
|
|
%global use_locale 0
|
2012-03-15 13:44:41 +01:00
|
|
|
BuildRequires: bind-utils
|
|
|
|
BuildRequires: bison
|
|
|
|
BuildRequires: flex
|
|
|
|
BuildRequires: gdbm-devel
|
|
|
|
BuildRequires: glibc-devel
|
2012-10-27 17:03:41 +02:00
|
|
|
BuildRequires: groff
|
2012-03-15 13:44:41 +01:00
|
|
|
BuildRequires: ncurses-devel
|
|
|
|
BuildRequires: procps
|
|
|
|
BuildRequires: psmisc
|
|
|
|
BuildRequires: pwdutils
|
|
|
|
BuildRequires: zlib-devel
|
2009-12-11 16:15:17 +01:00
|
|
|
%if %suse_version > 1020
|
2012-03-15 13:44:41 +01:00
|
|
|
BuildRequires: bind-libs
|
|
|
|
BuildRequires: libbz2-devel
|
2009-12-11 16:15:17 +01:00
|
|
|
%endif
|
2010-03-07 10:57:52 +01:00
|
|
|
%if %suse_version > 1120
|
|
|
|
BuildRequires: update-alternatives
|
|
|
|
%endif
|
2012-01-20 18:45:26 +01:00
|
|
|
# /bin/ex and /bin/ed required for build
|
2012-02-03 10:46:17 +01:00
|
|
|
BuildRequires: awk
|
2012-01-20 18:45:26 +01:00
|
|
|
BuildRequires: ed
|
2012-02-03 10:46:17 +01:00
|
|
|
BuildRequires: strace
|
2012-01-20 18:45:26 +01:00
|
|
|
BuildRequires: vim
|
2007-10-03 01:02:00 +02:00
|
|
|
Url: http://www.research.att.com/~gsf/download/
|
2010-04-14 15:17:22 +02:00
|
|
|
Requires(post): /bin/ln /bin/rm /etc/bash.bashrc /bin/true
|
|
|
|
Requires(postun): /bin/ln /bin/rm /etc/bash.bashrc /bin/true
|
2010-03-07 10:57:52 +01:00
|
|
|
%if %suse_version > 1120
|
2010-04-14 15:17:22 +02:00
|
|
|
Requires(post): update-alternatives
|
|
|
|
Requires(preun): update-alternatives
|
2010-03-07 10:57:52 +01:00
|
|
|
%endif
|
2012-02-10 17:47:32 +01:00
|
|
|
%if %use_suid_exe
|
|
|
|
PreReq: permissions
|
|
|
|
%endif
|
2011-09-02 14:19:30 +02:00
|
|
|
Version: 93u
|
2012-03-15 13:44:41 +01:00
|
|
|
Release: 0
|
2007-01-12 17:45:13 +01:00
|
|
|
Summary: Korn Shell
|
2012-10-27 17:03:41 +02:00
|
|
|
License: CPL-1.0 and EPL-1.0
|
2012-03-15 13:44:41 +01:00
|
|
|
Group: System/Shells
|
2007-01-12 17:45:13 +01:00
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
2012-02-10 17:47:32 +01:00
|
|
|
Source: INIT.%{date}.tar.bz2
|
2012-03-15 13:44:41 +01:00
|
|
|
Source1: ast-base.%{date}.tar.bz2
|
|
|
|
Source3: EPL
|
2012-02-10 17:47:32 +01:00
|
|
|
Source4: CPL
|
2009-08-13 17:23:42 +02:00
|
|
|
Source10: leak1.sh
|
|
|
|
Source11: leak2.sh
|
2010-10-11 16:30:14 +02:00
|
|
|
Source12: ifs-crash.sh
|
2012-02-03 10:46:17 +01:00
|
|
|
Source13: ulimit.sh
|
|
|
|
Source14: leak3.sh
|
2008-02-15 01:27:23 +01:00
|
|
|
Source20: Agreement
|
|
|
|
Source21: Warning
|
2007-05-25 17:26:52 +02:00
|
|
|
Source30: rpmlintrc
|
2012-02-03 10:46:17 +01:00
|
|
|
Source31: vmbalance
|
2010-03-10 15:26:16 +01:00
|
|
|
Source42: sigexec.c
|
2007-01-12 17:45:13 +01:00
|
|
|
Patch: ksh93.dif
|
|
|
|
Patch1: workaround-stupid-build-system.diff
|
|
|
|
Patch2: ksh-qemu.patch
|
|
|
|
Patch3: ksh93-shift_ijs.dif
|
|
|
|
Patch4: ksh93-gmt2utc.dif
|
|
|
|
Patch5: ksh93-uname.dif
|
|
|
|
Patch6: ksh93-vi.dif
|
|
|
|
Patch7: ksh93-profile.dif
|
2007-04-03 21:36:49 +02:00
|
|
|
Patch8: ksh93-test.dif
|
|
|
|
Patch9: ksh93-compat.dif
|
|
|
|
Patch10: ksh93-suid_exec.dif
|
2008-02-15 01:27:23 +01:00
|
|
|
Patch11: ksh93-signals.dif
|
|
|
|
Patch12: ksh93-limits.dif
|
2011-09-02 14:19:30 +02:00
|
|
|
Patch13: ksh93-unset-f.dif
|
2008-12-18 15:28:49 +01:00
|
|
|
Patch14: ksh93-ia64.dif
|
|
|
|
Patch15: ksh93-s390.dif
|
2011-09-02 14:19:30 +02:00
|
|
|
Patch16: ksh93-gcc.dif
|
|
|
|
Patch17: ksh93-heredoc.dif
|
|
|
|
Patch18: ksh93-jobs.dif
|
|
|
|
Patch19: ksh93-reg.dif
|
2012-01-20 18:45:26 +01:00
|
|
|
Patch20: ksh93-aso.dif
|
|
|
|
Patch21: ksh93-vm.dif
|
2012-02-02 13:07:46 +01:00
|
|
|
Patch22: ksh93-limit-name-len.dif
|
2012-02-09 10:56:55 +01:00
|
|
|
Patch23: ksh93-foreground-prgrp.dif
|
2012-02-10 18:12:19 +01:00
|
|
|
Patch24: ksh93-builtin.dif
|
2013-02-01 10:04:37 +01:00
|
|
|
# PATCH-FIX-UPSTREAM ksh93-read-dont-ignore-esc.dif [bnc#765171]
|
2013-02-05 18:51:33 +01:00
|
|
|
# is part of ksh93u+ 2012-06-28
|
2013-02-01 10:04:37 +01:00
|
|
|
# PATCH-EXTEND-UPSTREAM astksh_builtin_poll20120806_001.diff [bnc#779888]
|
2012-09-18 16:18:04 +02:00
|
|
|
Patch27: astksh_builtin_poll20120806_001.diff
|
2013-02-15 15:44:53 +01:00
|
|
|
# PATCH-FIX-UPSTREAM ksh93-env.dif [bnc#785266, bnc#803613]
|
2012-10-17 11:34:22 +02:00
|
|
|
Patch28: ksh93-env.dif
|
2013-03-19 17:49:41 +01:00
|
|
|
# PATCH-FIX-UPSTREAM ksh93-typedef.dif
|
|
|
|
Patch29: ksh93-typedef.dif
|
2013-02-05 18:51:33 +01:00
|
|
|
# PATCH-EXTEND-UPSTREAM ksh93-pathtemp.dif [bnc#786134]
|
|
|
|
# the fix is part of ksh93u+ 2012-06-28
|
|
|
|
# nevertheless the /dev/shm extension is useful
|
2012-10-23 18:04:15 +02:00
|
|
|
Patch30: ksh93-pathtemp.dif
|
2013-02-01 10:04:37 +01:00
|
|
|
# PATCH-FIX-UPSTREAM ksh93-dttree-crash.dif [bnc#795324]
|
2012-12-20 15:03:59 +01:00
|
|
|
Patch31: ksh93-dttree-crash.dif
|
2013-02-28 14:39:26 +01:00
|
|
|
# PATCH-FIX-UPSTREAM ksh93-heredoclex.dif [bnc#804998]
|
|
|
|
Patch32: ksh93-heredoclex.dif
|
2013-04-23 14:38:14 +02:00
|
|
|
# PATCH-FIX-UPSTREAM ksh93-fdstatus.dif [bnc#808449, bnc#814135]
|
|
|
|
# this is a backport from the alpha version ksh93v-2013-04-22
|
|
|
|
Patch33: ksh93-fdstatus.dif
|
2013-06-11 18:56:35 +02:00
|
|
|
# PATCH-FIX-UPSTREAM ksh93-alias-k.dif [bnc#824187]
|
|
|
|
Patch34: ksh93-alias-k.dif
|
2013-10-18 12:46:51 +02:00
|
|
|
# PATCH-FIX-SUSE Reduce warnings about uninitialized varaibles (most of them are handled correct)
|
|
|
|
Patch35: ksh93-uninitialized.dif
|
|
|
|
# PATCH-FIX-SUSE Do not use mount(2) system call instead of fs3d_mount(3ast)
|
|
|
|
Patch36: ksh93-fs3d.dif
|
2013-10-18 14:23:51 +02:00
|
|
|
# PATCH-FIX-UPSTREAM Ouch ... use memmove instead of memcopy on overlapping areas
|
|
|
|
Patch37: ksh93-sfio.dif
|
2013-11-29 17:03:44 +01:00
|
|
|
# PATCH-FIX-SUSE Do not crash wenn cwd is gone [bnc#852160]
|
2013-11-29 16:45:40 +01:00
|
|
|
Patch38: ksh93-pwd.dif
|
2011-07-07 15:17:49 +02:00
|
|
|
Patch42: ksh-locale.patch
|
2007-01-12 17:45:13 +01:00
|
|
|
|
|
|
|
%description
|
|
|
|
The original Korn Shell. The ksh is an sh-compatible command
|
|
|
|
interpreter that executes commands read from standard input or from a
|
|
|
|
file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Authors:
|
|
|
|
--------
|
|
|
|
David Korn <dgk@research.att.com>
|
|
|
|
Glenn Fowler <gsf@research.att.com>
|
|
|
|
Phong Vo <kpv@research.att.com>
|
|
|
|
|
|
|
|
%package -n ksh-devel
|
|
|
|
Summary: Korn Shell development environment
|
2012-03-15 13:44:41 +01:00
|
|
|
License: CPL-1.0
|
2007-01-12 17:45:13 +01:00
|
|
|
Group: Development/Libraries/C and C++
|
2007-05-25 17:26:52 +02:00
|
|
|
Requires: ksh = %{version}-%{release}
|
2007-01-12 17:45:13 +01:00
|
|
|
|
|
|
|
%description -n ksh-devel
|
|
|
|
The package includes C header files and the static libraries together
|
|
|
|
with the shared libraries for linking with other projects. Please be
|
|
|
|
aware that the CPL licensed code can not be used within GPL licensed
|
|
|
|
project.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Authors:
|
|
|
|
--------
|
|
|
|
David Korn <dgk@research.att.com>
|
|
|
|
Glenn Fowler <gsf@research.att.com>
|
|
|
|
Phong Vo <kpv@research.att.com>
|
|
|
|
|
|
|
|
%prep
|
2012-02-03 10:46:17 +01:00
|
|
|
chmod +x %{S:31}
|
2012-03-15 13:44:41 +01:00
|
|
|
%setup -q -n ksh93 -T -c -a 0
|
|
|
|
tar --use-compress-program=bzcat -xf %{S:1} \
|
|
|
|
lib/package/ \
|
|
|
|
src/cmd/ksh93/ src/lib/libast/ src/lib/libcmd/ src/lib/libcoshell/ src/lib/libdll/ src/lib/libsum/ \
|
|
|
|
src/cmd/builtin/ src/cmd/msgcc/ src/lib/libpp/ src/lib/libuu/
|
2012-02-06 13:36:57 +01:00
|
|
|
if test -d share ; then
|
|
|
|
find share/ \( -name chef -o -name fudd -o -name piglatin -o -name valley \) -a -type d |\
|
|
|
|
xargs -r rm -vrf
|
|
|
|
find share/ ! \( -name libast -o -name libcmd -o -name libdll -o -name libshell \) -a -type f |\
|
|
|
|
xargs -r rm -vf
|
|
|
|
find share/ -type d -a -empty | xargs -r rm -vrf
|
|
|
|
find share/ -type d -a -empty | xargs -r rm -vrf
|
|
|
|
fi
|
2007-01-12 17:45:13 +01:00
|
|
|
%patch
|
2011-07-07 15:17:49 +02:00
|
|
|
%patch42
|
2007-01-12 17:45:13 +01:00
|
|
|
%patch1
|
|
|
|
%ifarch %arm
|
|
|
|
%patch2
|
|
|
|
%endif
|
|
|
|
%patch3
|
|
|
|
%patch4
|
|
|
|
%patch5
|
|
|
|
%patch6
|
|
|
|
%patch7
|
|
|
|
%patch8
|
|
|
|
%patch9
|
|
|
|
%patch10
|
2007-10-03 01:02:00 +02:00
|
|
|
%patch11
|
|
|
|
%patch12
|
2010-04-14 15:17:22 +02:00
|
|
|
%patch13
|
2008-12-18 15:28:49 +01:00
|
|
|
%ifarch ia64
|
|
|
|
%patch14
|
|
|
|
%endif
|
|
|
|
%patch15
|
2010-06-29 16:10:04 +02:00
|
|
|
%patch16
|
2010-10-08 14:55:02 +02:00
|
|
|
%patch17
|
2010-10-19 13:12:50 +02:00
|
|
|
%patch18
|
2010-10-21 12:37:38 +02:00
|
|
|
%patch19
|
2012-01-20 18:45:26 +01:00
|
|
|
%patch20
|
|
|
|
%patch21
|
2012-02-02 13:07:46 +01:00
|
|
|
%patch22
|
2012-02-09 10:56:55 +01:00
|
|
|
%patch23
|
2012-02-10 18:12:19 +01:00
|
|
|
%patch24
|
2012-09-18 16:18:04 +02:00
|
|
|
%patch27
|
2012-10-17 11:34:22 +02:00
|
|
|
%patch28
|
2013-03-19 17:49:41 +01:00
|
|
|
%patch29
|
2012-10-23 18:04:15 +02:00
|
|
|
%patch30
|
2012-12-20 15:03:59 +01:00
|
|
|
%patch31
|
2013-02-28 14:39:26 +01:00
|
|
|
%patch32
|
2013-04-23 14:38:14 +02:00
|
|
|
%patch33
|
2013-06-11 18:56:35 +02:00
|
|
|
%patch34
|
2013-10-18 12:46:51 +02:00
|
|
|
%patch35
|
|
|
|
%patch36
|
2013-10-18 14:23:51 +02:00
|
|
|
%patch37
|
2013-11-29 16:45:40 +01:00
|
|
|
%patch38
|
2007-01-12 17:45:13 +01:00
|
|
|
|
|
|
|
%build
|
2012-01-20 18:45:26 +01:00
|
|
|
#
|
|
|
|
# Check for a clean signal environment for runtime tests
|
|
|
|
#
|
2010-03-08 17:20:52 +01:00
|
|
|
typeset -i IGNORED=0x$(ps --no-headers -o ignored $$)
|
2012-01-20 18:45:26 +01:00
|
|
|
typeset -i SIGMASK=0x0
|
2012-03-15 13:44:41 +01:00
|
|
|
typeset -i usesigexec=0
|
2012-01-20 18:45:26 +01:00
|
|
|
|
|
|
|
let "SIGMASK|=(1<<($(kill -l PIPE)-1))"
|
|
|
|
let "SIGMASK|=(1<<($(kill -l URG) -1))"
|
|
|
|
let "SIGMASK|=(1<<($(kill -l XFSZ)-1))"
|
|
|
|
|
2012-03-15 13:44:41 +01:00
|
|
|
((IGNORED & SIGMASK)) && let ++usesigexec || true
|
|
|
|
test -t 0 || let ++usesigexec
|
|
|
|
|
2012-07-25 09:13:53 +02:00
|
|
|
%if 0%{?qemu_user_space_build:1}
|
|
|
|
# agraf: In a qemu user space build, ps can not find the actual sigmask
|
|
|
|
# of processes, so we run into an endless loop. Disable sigexec.
|
|
|
|
usesigexec=0
|
|
|
|
%endif
|
|
|
|
|
2012-03-15 13:44:41 +01:00
|
|
|
if ((usesigexec > 0)) ; then
|
2012-01-23 15:16:26 +01:00
|
|
|
${CC:-gcc} ${RPM_OPT_FLAGS} -o sigexec %{S:42} -lutil
|
2010-03-10 15:26:16 +01:00
|
|
|
for fd in /proc/$$/fd/*; do
|
2012-03-15 13:44:41 +01:00
|
|
|
test -s $fd -a ! -c $fd && break || true
|
2010-03-10 15:26:16 +01:00
|
|
|
done
|
|
|
|
set -- $(readlink $fd)
|
2012-03-15 13:44:41 +01:00
|
|
|
exec ./sigexec $SHELL ${1+"$@"}
|
2010-03-08 17:20:52 +01:00
|
|
|
fi
|
2012-02-06 13:36:57 +01:00
|
|
|
IGNORED=0x$(ps --no-headers -o ignored $$)
|
2012-01-23 15:16:26 +01:00
|
|
|
|
|
|
|
AR="ar"
|
|
|
|
CC=gcc
|
|
|
|
PATH=${PWD}:$PATH
|
|
|
|
LANG=POSIX
|
|
|
|
TMPDIR=$(mktemp -d /tmp/ksh-build.XXXXXX) || exit 1
|
|
|
|
SUSE_ASNEEDED=0
|
|
|
|
export AR CC PATH LANG TMPDIR SUSE_ASNEEDED
|
|
|
|
#
|
|
|
|
# Remove optimizer which cause runtime leaks in ksh
|
|
|
|
#
|
|
|
|
RPM_OPT_FLAGS="${RPM_OPT_FLAGS//-funwind-tables/}"
|
|
|
|
RPM_OPT_FLAGS="${RPM_OPT_FLAGS//-fasynchronous-unwind-tables/}"
|
2009-08-06 17:44:17 +02:00
|
|
|
# This package failed when testing with -Wl,-as-needed being default.
|
2010-03-08 17:20:52 +01:00
|
|
|
# So we disable it here, if you want to retest, just delete this
|
|
|
|
# comment and the line below.
|
2013-01-17 12:30:07 +01:00
|
|
|
RPM_OPT_FLAGS="${RPM_OPT_FLAGS//-as-needed/-no-as-needed/}"
|
|
|
|
# Use POSIX as environment
|
2008-02-15 01:27:23 +01:00
|
|
|
test -n "${!LC_*}" && unset "${!LC_*}"
|
2008-09-24 17:01:34 +02:00
|
|
|
cflags ()
|
|
|
|
{
|
2012-02-10 17:47:32 +01:00
|
|
|
set +x
|
2008-09-24 17:01:34 +02:00
|
|
|
local flag=$1; shift
|
2010-03-08 17:20:52 +01:00
|
|
|
local var=$1; shift
|
|
|
|
test -n "${flag}" -a -n "${var}" || return
|
|
|
|
case "${!var}" in
|
2008-09-24 17:01:34 +02:00
|
|
|
*${flag}*) return
|
|
|
|
esac
|
2012-01-20 18:45:26 +01:00
|
|
|
set -o noclobber
|
2009-12-11 16:15:17 +01:00
|
|
|
case "$flag" in
|
|
|
|
-Wl,*)
|
2012-01-20 18:45:26 +01:00
|
|
|
if echo 'int main () { return 0; }' | \
|
|
|
|
${CC:-gcc} -Werror $flag -o /dev/null -xc - > /dev/null 2>&1 ; then
|
2009-12-11 16:15:17 +01:00
|
|
|
eval $var=\${$var:+\$$var\ }$flag
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
2012-01-20 18:45:26 +01:00
|
|
|
if ${CC:-gcc} -Werror $flag -S -o /dev/null -xc /dev/null > /dev/null 2>&1 ; then
|
2009-12-11 16:15:17 +01:00
|
|
|
eval $var=\${$var:+\$$var\ }$flag
|
|
|
|
fi
|
|
|
|
esac
|
2012-01-20 18:45:26 +01:00
|
|
|
set +o noclobber
|
2012-02-10 17:47:32 +01:00
|
|
|
set -x
|
|
|
|
}
|
|
|
|
relink ()
|
|
|
|
{
|
|
|
|
set +x
|
|
|
|
local search=$1; shift
|
|
|
|
local target=$1; shift
|
|
|
|
test -n "${search}" -a -n "${target}" || exit 1
|
|
|
|
local object=$(find ${root:-/tmp}/src/cmd/ -name ${search}.o)
|
|
|
|
local cmd=$(
|
|
|
|
grep -e "-o $search" ${log:-/dev/null} | tail -n 1 | \
|
|
|
|
sed -r -e "s@\+ g?cc@${CC:-gcc}@" \
|
|
|
|
-e "s@-o $search@-o ${root:-/tmp}$target@" \
|
|
|
|
-e "s@[[:blank:]]${search}.o[[:blank:]]@ $object @" \
|
|
|
|
-e "s@[[:blank:]](/[^[:blank:]]*)?lib([[:alnum:]]+)\.a@ -l\2@g" \
|
|
|
|
-e "s@'@@g")
|
|
|
|
set -x
|
|
|
|
$cmd ${1+"$@"}
|
2008-09-24 17:01:34 +02:00
|
|
|
}
|
|
|
|
#
|
2007-01-12 17:45:13 +01:00
|
|
|
# If _you_ are knowing how to fix this in the autogenerated
|
|
|
|
# sources of ksh/ast without breaking them, then let me know.
|
|
|
|
#
|
2010-03-08 17:20:52 +01:00
|
|
|
cflags -Wno-missing-braces IGNORE
|
|
|
|
cflags -Wno-unknown-pragmas IGNORE
|
|
|
|
cflags -Wno-parentheses IGNORE
|
|
|
|
cflags -Wno-char-subscripts IGNORE
|
|
|
|
cflags -Wno-uninitialized IGNORE
|
|
|
|
cflags -Wno-implicit IGNORE
|
|
|
|
cflags -Wno-unused-value IGNORE
|
|
|
|
cflags -Wno-type-limits IGNORE
|
2013-10-22 13:59:47 +02:00
|
|
|
cflags -Wclobbered RPM_OPT_FLAGS
|
2007-01-12 17:45:13 +01:00
|
|
|
#
|
2007-10-03 01:02:00 +02:00
|
|
|
# Do not use -DSHOPT_SPAWN=1 and/or -DSHOPT_AMP=1 this would cause
|
|
|
|
# errors due race conditions while executing the test suite.
|
2007-01-12 17:45:13 +01:00
|
|
|
#
|
2013-02-05 18:51:33 +01:00
|
|
|
feature=${PWD}/.feature.h
|
2010-03-07 10:57:52 +01:00
|
|
|
set -C
|
|
|
|
(cat > $feature)<<-'EOF'
|
2011-06-08 15:18:04 +02:00
|
|
|
#define SHOPT_FS_3D 0
|
2010-03-07 10:57:52 +01:00
|
|
|
#define SHOPT_SYSRC 1
|
|
|
|
#define SHOPT_REMOTE 1
|
|
|
|
#define SHOPT_CMDLIB_BLTIN 1
|
2013-02-05 18:51:33 +01:00
|
|
|
#define SHOPT_CMDLIB_HDR <cmdlist.h>
|
|
|
|
#define SHOPT_CMDLIB_DIR "/%{_lib}/ast/bin"
|
2010-03-07 10:57:52 +01:00
|
|
|
#define SH_CMDLIB_DIR "/%{_lib}/ast/bin"
|
|
|
|
#define THISPROG "/%{_lib}/ast/bin/suid_exec"
|
|
|
|
#define _AST_std_malloc 0
|
|
|
|
#define _map_malloc 1
|
|
|
|
EOF
|
|
|
|
set +C
|
|
|
|
FEATURE="-include $feature"
|
|
|
|
cat $feature
|
2007-01-12 17:45:13 +01:00
|
|
|
#
|
|
|
|
#
|
2011-06-10 17:31:51 +02:00
|
|
|
LARGEFILE="$(getconf LFS_CFLAGS)"
|
2011-05-24 18:36:50 +02:00
|
|
|
case "$RPM_ARCH" in
|
2011-06-10 17:31:51 +02:00
|
|
|
i[3456]86)
|
2012-01-20 18:45:26 +01:00
|
|
|
RPM_OPT_FLAGS="${RPM_OPT_FLAGS//-O[s0-9]/-O2}"
|
|
|
|
cflags -m32 RPM_OPT_FLAGS
|
2011-06-10 17:31:51 +02:00
|
|
|
HOSTTYPE=linux.i386
|
|
|
|
;;
|
|
|
|
x86_64)
|
2012-01-20 18:45:26 +01:00
|
|
|
RPM_OPT_FLAGS="${RPM_OPT_FLAGS//-O[s0-9]/-O2}"
|
|
|
|
cflags -m64 RPM_OPT_FLAGS
|
2011-06-10 17:31:51 +02:00
|
|
|
HOSTTYPE=linux.i386-64
|
|
|
|
;;
|
|
|
|
ia64)
|
|
|
|
RPM_OPT_FLAGS="${RPM_OPT_FLAGS//-O[s0-9]/-O}"
|
2012-01-20 18:45:26 +01:00
|
|
|
cflags -mlp64 RPM_OPT_FLAGS
|
|
|
|
cflags -mno-volatile-asm-stop RPM_OPT_FLAGS
|
2011-06-10 17:31:51 +02:00
|
|
|
HOSTTYPE=linux.ia64
|
|
|
|
;;
|
|
|
|
s390)
|
2012-01-20 18:45:26 +01:00
|
|
|
RPM_OPT_FLAGS="${RPM_OPT_FLAGS//-O[s0-9]/-O}"
|
|
|
|
cflags -m31 RPM_OPT_FLAGS
|
2011-06-10 17:31:51 +02:00
|
|
|
HOSTTYPE=linux.s390
|
|
|
|
;;
|
|
|
|
s390*)
|
2012-01-20 18:45:26 +01:00
|
|
|
RPM_OPT_FLAGS="${RPM_OPT_FLAGS//-O[s0-9]/-O}"
|
|
|
|
cflags -m64 RPM_OPT_FLAGS
|
2011-06-10 17:31:51 +02:00
|
|
|
HOSTTYPE=linux.s390-64
|
|
|
|
;;
|
2011-05-24 18:36:50 +02:00
|
|
|
ppc|powerpc)
|
2012-01-20 18:45:26 +01:00
|
|
|
RPM_OPT_FLAGS="${RPM_OPT_FLAGS//-O[s0-9]/-O}"
|
|
|
|
cflags -mno-powerpc64 RPM_OPT_FLAGS
|
2011-06-10 17:31:51 +02:00
|
|
|
HOSTTYPE=linux.powerpc
|
2013-02-15 15:44:53 +01:00
|
|
|
_PACKAGE_HOSTTYPE_=linux.powerpc
|
|
|
|
export _PACKAGE_HOSTTYPE_
|
2011-06-10 17:31:51 +02:00
|
|
|
;;
|
|
|
|
ppc64|powerpc64)
|
2012-01-20 18:45:26 +01:00
|
|
|
RPM_OPT_FLAGS="${RPM_OPT_FLAGS//-O[s0-9]/-O}"
|
|
|
|
cflags -mpowerpc64 RPM_OPT_FLAGS
|
2011-06-10 17:31:51 +02:00
|
|
|
HOSTTYPE=linux.powerpc64
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
RPM_OPT_FLAGS="${RPM_OPT_FLAGS//-O[s0-9]/-O}"
|
|
|
|
HOSTTYPE=linux.$RPM_ARCH
|
|
|
|
;;
|
2011-05-24 18:36:50 +02:00
|
|
|
esac
|
2012-02-17 14:29:02 +01:00
|
|
|
MEMORY=execve
|
2012-02-06 13:36:57 +01:00
|
|
|
for mm in mmap mmap2 mmap64 munmap munmap2 munmap64 ; do
|
|
|
|
if strace -e $mm /bin/true > /dev/null 2>&1 ; then
|
|
|
|
MEMORY="${MEMORY:+${MEMORY},}$mm"
|
|
|
|
fi
|
|
|
|
done
|
2012-02-17 14:25:26 +01:00
|
|
|
MEMORY="-s 128 ${MEMORY:+-e ${MEMORY}}"
|
2013-03-19 16:31:13 +01:00
|
|
|
RPM_OPT_FLAGS=$(echo "${RPM_OPT_FLAGS}"|sed -r 's/([[:blank:]]+)-g[[:digit:]]+/\1-g2/g;s/([[:blank:]]+)-g([[:blank:]]+|$)/\1-g2\2/g')
|
2008-12-18 15:28:49 +01:00
|
|
|
UNIVERSE=att
|
2009-08-13 17:23:42 +02:00
|
|
|
LDFLAGS="-lm"
|
2009-12-11 16:15:17 +01:00
|
|
|
LDSOFLG=""
|
2013-01-17 12:30:07 +01:00
|
|
|
cflags -std=gnu99 RPM_OPT_FLAGS
|
|
|
|
cflags -fPIC RPM_OPT_FLAGS
|
|
|
|
cflags -fno-strict-aliasing RPM_OPT_FLAGS
|
|
|
|
cflags -fno-zero-initialized-in-bss RPM_OPT_FLAGS
|
|
|
|
cflags -fno-delete-null-pointer-checks RPM_OPT_FLAGS
|
|
|
|
cflags -fno-unsafe-loop-optimizations RPM_OPT_FLAGS
|
|
|
|
cflags -fsigned-bitfields RPM_OPT_FLAGS
|
|
|
|
cflags -fsigned-chars RPM_OPT_FLAGS
|
|
|
|
cflags -fsigned-zeros RPM_OPT_FLAGS
|
2012-01-24 19:43:43 +01:00
|
|
|
case "$(gcc --version | head -n 1)" in
|
2013-01-17 12:48:29 +01:00
|
|
|
*4.[012345].*)
|
|
|
|
cflags -fno-tree-sink RPM_OPT_FLAGS ;;
|
2013-01-17 12:30:07 +01:00
|
|
|
*) cflags -ftree-loop-linear RPM_OPT_FLAGS ;;
|
2012-01-24 19:43:43 +01:00
|
|
|
esac
|
2013-01-17 12:30:07 +01:00
|
|
|
cflags -g2 RPM_OPT_FLAGS
|
|
|
|
cflags -pipe RPM_OPT_FLAGS
|
|
|
|
cflags -Wl,-O2 LDFLAGS
|
|
|
|
cflags -Wl,--hash-size=16699 LDFLAGS
|
|
|
|
cflags -Wl,-O2 LDSOFLG
|
|
|
|
cflags -Wl,-warn-common LDSOFLG
|
|
|
|
cflags -Wl,--as-needed LDSOFLG
|
|
|
|
cflags -Wl,--hash-size=8599 LDSOFLG
|
|
|
|
cflags -Wl,-Bsymbolic-functions LDSOFLG
|
|
|
|
cflags -Wl,-rpath,/%{_lib}/ast LDSOFLG
|
2008-12-18 15:28:49 +01:00
|
|
|
RPM_OPT_FLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE $LARGEFILE"
|
|
|
|
RPM_OPT_FLAGS="$RPM_OPT_FLAGS $IGNORE $FEATURE"
|
2007-01-12 17:45:13 +01:00
|
|
|
mam_cc_L=use
|
2008-12-18 15:28:49 +01:00
|
|
|
mam_cc_OPTIMIZE=-pipe
|
|
|
|
export mam_cc_L mam_cc_OPTIMIZE HOSTTYPE LDFLAGS RPM_OPT_FLAGS UNIVERSE
|
2011-07-07 15:17:49 +02:00
|
|
|
printenv
|
2012-01-20 18:45:26 +01:00
|
|
|
getconf PAGESIZE
|
|
|
|
|
2013-01-17 12:30:07 +01:00
|
|
|
#
|
|
|
|
# Build libast first and then determine the library functions used
|
2013-01-17 12:36:55 +01:00
|
|
|
# by this library simply to avoid that gcc will overwrites those with
|
|
|
|
# its own builtin functions.
|
2013-01-17 12:30:07 +01:00
|
|
|
#
|
2013-02-05 18:51:33 +01:00
|
|
|
bin/package view
|
2013-01-17 12:30:07 +01:00
|
|
|
root=$(echo ${PWD}/arch/linux*)
|
2013-02-05 18:51:33 +01:00
|
|
|
bin/package make ast-ast CCFLAGS="$RPM_OPT_FLAGS -fno-builtin -I${root}/include" HOSTTYPE="$HOSTTYPE" AR="$AR" CC="$CC"
|
2013-01-17 12:30:07 +01:00
|
|
|
test -d $root || exit 1
|
|
|
|
log=${root}/lib/package/gen/make.out
|
|
|
|
test -s $log || exit 1
|
|
|
|
for lib in libast ; do
|
|
|
|
test -s ${root}/lib/${lib}.a || exit 1
|
|
|
|
obj=$(ar t ${root}/lib/${lib}.a)
|
|
|
|
test $? -eq 0 || exit 1
|
|
|
|
case "$lib" in
|
|
|
|
libast)
|
|
|
|
base=src/lib/$lib
|
|
|
|
vers=$(grep :LIBRARY: ${base}/Makefile | sed "s@.*\([0-9]\+\.[0-9]\+\).*@\1@")
|
|
|
|
link="-L${root}/lib/ -Wl,-rpath-link,${root}/lib -Wl,-rpath,/%{_lib}/ast $LDSOFLG"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
soname="-Wl,-soname,${lib}.so.${vers%.*},-stats"
|
|
|
|
pushd ${root}/${base}
|
|
|
|
$CC -shared $soname -o ${root}/lib/${lib}.so.${vers} ${obj} $link
|
|
|
|
ln -sf ${lib}.so.${vers} ${root}/lib/${lib}.so.${vers%.*}
|
|
|
|
ln -sf ${lib}.so.${vers} ${root}/lib/${lib}.so
|
|
|
|
popd
|
|
|
|
done
|
2013-02-05 18:51:33 +01:00
|
|
|
nobuiltin=${PWD}/.nobuiltin
|
2013-01-17 12:30:07 +01:00
|
|
|
nm -D ${root}/lib/libast.so | \
|
2013-10-18 12:46:51 +02:00
|
|
|
grep -E 'T[[:blank:]](_ast_)?(str|mem|(get|put|set)env|free|(c|m|re|v|vm)alloc)' | \
|
2013-01-17 12:30:07 +01:00
|
|
|
sed -r 's/[[:xdigit:]]+[[:blank:]]+T[[:blank:]]+(_ast_)?([^[:blank:]]*)/-fno-builtin-\2/' | \
|
|
|
|
sort -u > $nobuiltin
|
2013-01-17 13:00:22 +01:00
|
|
|
rm -rf $root
|
2013-01-17 13:37:40 +01:00
|
|
|
case "$(gcc --version | head -n 1)" in
|
|
|
|
*4.[01].*)
|
|
|
|
set +x
|
|
|
|
for opt in $(cat $nobuiltin) ; do
|
|
|
|
cflags $opt RPM_OPT_FLAGS
|
|
|
|
done
|
|
|
|
set -x
|
|
|
|
;;
|
|
|
|
*) cflags @$nobuiltin RPM_OPT_FLAGS
|
|
|
|
esac
|
2013-01-17 12:30:07 +01:00
|
|
|
|
2013-10-22 14:00:35 +02:00
|
|
|
export | grep -vE 'PROFILEREAD|PWD|MAIL|HOME|HOST|HIST|LESS|TMP' > .env
|
2013-02-05 18:51:33 +01:00
|
|
|
bin/package make CCFLAGS="$RPM_OPT_FLAGS -I${root}/include" HOSTTYPE="$HOSTTYPE" AR="$AR" CC="$CC"
|
2007-01-12 17:45:13 +01:00
|
|
|
root=$(echo ${PWD}/arch/linux*)
|
|
|
|
test -d $root || exit 1
|
|
|
|
log=${root}/lib/package/gen/make.out
|
|
|
|
test -s $log || exit 1
|
|
|
|
for lib in libast libcmd libdll libshell ; do
|
2009-12-11 16:15:17 +01:00
|
|
|
test -s ${root}/lib/${lib}.a || exit 1
|
|
|
|
obj=$(ar t ${root}/lib/${lib}.a)
|
2007-01-12 17:45:13 +01:00
|
|
|
test $? -eq 0 || exit 1
|
|
|
|
case "$lib" in
|
|
|
|
libshell)
|
|
|
|
base=src/cmd/ksh93
|
|
|
|
vers=$(grep ^VERSION ${base}/Makefile | sed "s@.*\([0-9]\+\.[0-9]\+\).*@\1@")
|
2009-12-21 23:11:48 +01:00
|
|
|
link="-L${root}/lib/ -Wl,-rpath-link,${root}/lib -Wl,-rpath,/%{_lib}/ast $LDSOFLG $LDFLAGS -ldll -lcmd -last -lm -ldl"
|
2007-01-12 17:45:13 +01:00
|
|
|
;;
|
|
|
|
libdll)
|
|
|
|
base=src/lib/$lib
|
|
|
|
vers=$(grep :LIBRARY: ${base}/Makefile | sed "s@.*\([0-9]\+\.[0-9]\+\).*@\1@")
|
2009-12-21 23:11:48 +01:00
|
|
|
link="-L${root}/lib/ -Wl,-rpath-link,${root}/lib -Wl,-rpath,/%{_lib}/ast $LDSOFLG -ldl -last"
|
2007-01-12 17:45:13 +01:00
|
|
|
;;
|
|
|
|
libcmd)
|
|
|
|
base=src/lib/$lib
|
|
|
|
vers=$(grep :LIBRARY: ${base}/Makefile | sed "s@.*\([0-9]\+\.[0-9]\+\).*@\1@")
|
2009-12-21 23:11:48 +01:00
|
|
|
link="-L${root}/lib/ -Wl,-rpath-link,${root}/lib -Wl,-rpath,/%{_lib}/ast $LDSOFLG -last"
|
2007-01-12 17:45:13 +01:00
|
|
|
;;
|
|
|
|
libast)
|
|
|
|
base=src/lib/$lib
|
|
|
|
vers=$(grep :LIBRARY: ${base}/Makefile | sed "s@.*\([0-9]\+\.[0-9]\+\).*@\1@")
|
2009-12-21 23:11:48 +01:00
|
|
|
link="-L${root}/lib/ -Wl,-rpath-link,${root}/lib -Wl,-rpath,/%{_lib}/ast $LDSOFLG"
|
2007-01-12 17:45:13 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
soname="-Wl,-soname,${lib}.so.${vers%.*},-stats"
|
|
|
|
pushd ${root}/${base}
|
|
|
|
$CC -shared $soname -o ${root}/lib/${lib}.so.${vers} ${obj} $link
|
|
|
|
ln -sf ${lib}.so.${vers} ${root}/lib/${lib}.so.${vers%.*}
|
|
|
|
ln -sf ${lib}.so.${vers} ${root}/lib/${lib}.so
|
|
|
|
popd
|
|
|
|
done
|
|
|
|
base=src/cmd/ksh93
|
|
|
|
test=${PWD}/${base}/tests
|
2011-07-07 15:17:49 +02:00
|
|
|
OPATH=$PATH
|
|
|
|
OSHELL=$SHELL
|
|
|
|
PATH=$PATH:${root}/bin
|
2012-02-10 17:47:32 +01:00
|
|
|
SHELL=${root}/bin/ksh
|
|
|
|
SHCOMP=${root}/bin/shcomp
|
2011-07-07 15:17:49 +02:00
|
|
|
export PATH SHCOMP SHELL
|
2012-02-10 17:47:32 +01:00
|
|
|
%if %do_tests
|
2011-07-07 15:17:49 +02:00
|
|
|
pushd ${test}
|
|
|
|
typeset -i failed=0
|
|
|
|
ln -sf ${root}/lib ${test}/../
|
2012-02-20 16:42:00 +01:00
|
|
|
sed -ri '/^L[[:blank:]]/a \t 8000' pty.sh
|
2013-09-17 18:54:23 +02:00
|
|
|
sed -ri 's/(SECONDS[[:blank:]]*>[[:blank:]]*)([[:digit:]]+)/\18/' signal.sh
|
2012-02-20 15:35:23 +01:00
|
|
|
unset ${!LESS*}
|
2013-10-25 16:09:12 +02:00
|
|
|
printf '\033[1m'
|
|
|
|
grep -E '^(model name|flags)[[:blank:]]*:' /proc/cpuinfo | sort -ur | fold -s
|
|
|
|
printf '\033(B\033[m'
|
2012-02-10 17:47:32 +01:00
|
|
|
${SHELL} shtests
|
2013-10-23 17:44:36 +02:00
|
|
|
result=$(${SHELL} -k -c 'd=`/bin/echo x y=z`; echo $d x y=z')
|
|
|
|
test "$result" = 'x x' || exit 1
|
|
|
|
result=$(${SHELL} -c 'echo | echo "x`/bin/echo y`"')
|
|
|
|
test "$result" = xy || exit 1
|
|
|
|
result=$(${SHELL} -c 'echo | echo "x$(/bin/echo y)"')
|
|
|
|
test "$result" = xy || exit 1
|
2013-11-20 15:28:55 +01:00
|
|
|
${SHELL} -c 'trap "exit 0" EXIT; typeset -T X=(typeset x; function x.get { :; }); X -a xs=((x=yo) (x=jo))'
|
2012-02-17 14:25:26 +01:00
|
|
|
exec 3> ${TMPDIR:-/tmp}/log
|
2012-02-06 13:36:57 +01:00
|
|
|
LANG=POSIX
|
2012-02-10 17:47:32 +01:00
|
|
|
strace $MEMORY -o '!%{S:31}' ${SHELL} %{S:10} 400
|
|
|
|
strace $MEMORY -o '!%{S:31}' ${SHELL} %{S:10} 4000
|
|
|
|
strace $MEMORY -o '!%{S:31}' ${SHELL} %{S:11} 400
|
|
|
|
strace $MEMORY -o '!%{S:31}' ${SHELL} %{S:11} 4000
|
2012-02-20 15:35:23 +01:00
|
|
|
strace $MEMORY -o '!%{S:31}' ${SHELL} %{S:12} 4
|
|
|
|
strace $MEMORY -o '!%{S:31}' ${SHELL} %{S:12} 40
|
2012-02-10 17:47:32 +01:00
|
|
|
strace $MEMORY -o '!%{S:31}' ${SHELL} %{S:13} 400
|
|
|
|
strace $MEMORY -o '!%{S:31}' ${SHELL} %{S:13} 4000
|
|
|
|
strace $MEMORY -o '!%{S:31}' ${SHELL} %{S:14} 400
|
|
|
|
strace $MEMORY -o '!%{S:31}' ${SHELL} %{S:14} 4000
|
2012-02-06 13:36:57 +01:00
|
|
|
if test $((IGNORED & SIGPIPE)) -eq 0 ; then
|
2012-02-10 17:47:32 +01:00
|
|
|
${SHELL} -c 'g="false"; trap "print -u2 PIPED; \$g && exit 0 ; g=true" PIPE ; while true ; do echo hello ; done' | head -n 10
|
2012-02-06 13:36:57 +01:00
|
|
|
fi
|
|
|
|
LANG=en_US.UTF-8
|
2012-02-10 17:47:32 +01:00
|
|
|
strace $MEMORY -o '!%{S:31}' ${SHELL} %{S:10} 400
|
|
|
|
strace $MEMORY -o '!%{S:31}' ${SHELL} %{S:10} 4000
|
|
|
|
strace $MEMORY -o '!%{S:31}' ${SHELL} %{S:11} 400
|
|
|
|
strace $MEMORY -o '!%{S:31}' ${SHELL} %{S:11} 4000
|
2012-02-20 15:35:23 +01:00
|
|
|
strace $MEMORY -o '!%{S:31}' ${SHELL} %{S:12} 4
|
|
|
|
strace $MEMORY -o '!%{S:31}' ${SHELL} %{S:12} 40
|
2012-02-10 17:47:32 +01:00
|
|
|
strace $MEMORY -o '!%{S:31}' ${SHELL} %{S:13} 400
|
|
|
|
strace $MEMORY -o '!%{S:31}' ${SHELL} %{S:13} 4000
|
|
|
|
strace $MEMORY -o '!%{S:31}' ${SHELL} %{S:14} 400
|
|
|
|
strace $MEMORY -o '!%{S:31}' ${SHELL} %{S:14} 4000
|
2011-07-07 15:17:49 +02:00
|
|
|
if test $((IGNORED & SIGPIPE)) -eq 0 ; then
|
2012-02-10 17:47:32 +01:00
|
|
|
${SHELL} -c 'g="false"; trap "print -u2 PIPED; \$g && exit 0 ; g=true" PIPE ; while true ; do echo hello ; done' | head -n 10
|
2011-07-07 15:17:49 +02:00
|
|
|
fi
|
2012-02-06 13:36:57 +01:00
|
|
|
LANG=POSIX
|
2012-02-17 14:25:26 +01:00
|
|
|
exec 3>&-
|
2013-10-25 16:09:12 +02:00
|
|
|
printf '\033[1m'
|
2012-02-17 14:25:26 +01:00
|
|
|
uniq -c ${TMPDIR:-/tmp}/log
|
2013-10-25 16:09:12 +02:00
|
|
|
printf '\033(B\033[m'
|
2012-02-10 17:47:32 +01:00
|
|
|
killall -q -s 9 ${SHELL} || true
|
2011-07-07 15:17:49 +02:00
|
|
|
popd
|
2011-12-26 19:08:14 +01:00
|
|
|
%endif
|
2012-02-10 17:47:32 +01:00
|
|
|
pushd ${root}/${base}
|
|
|
|
rm -f libshell.a
|
|
|
|
rm -f ${root}/bin/ksh
|
|
|
|
rm -f ${root}/bin/shcomp
|
|
|
|
for bin in ksh shcomp pty what mime asa dlls suid_exec ; do
|
|
|
|
relink $bin /bin/$bin -Wl,-rpath-link,${root}/lib -Wl,-rpath,/%{_lib}/ast
|
|
|
|
done
|
|
|
|
popd
|
|
|
|
LD_LIBRARY_PATH=${root}/lib
|
|
|
|
export LD_LIBRARY_PATH
|
2011-07-07 15:17:49 +02:00
|
|
|
mkdir -p share/locale/C/LC_MESSAGES
|
2012-01-20 18:45:26 +01:00
|
|
|
includes="-I$(cpp -print-search-dirs | sed -rn 's@^install:[[:blank:]]@@p')include"
|
|
|
|
includes="$includes $(find $root -name FEATURE -printf ' -I%h')"
|
|
|
|
includes="$includes -I/usr/include/linux"
|
2011-07-07 15:17:49 +02:00
|
|
|
sed -rn "\@mamake -C cmd/ksh93@,\@mamake -C@ {
|
2012-01-20 18:45:26 +01:00
|
|
|
s@^\+ g?cc@$SHELL msgcc -M-set=ast $includes@
|
2011-07-07 15:17:49 +02:00
|
|
|
s@[[:blank:]]-c[[:blank:]]([^[:blank:]\.]+/([^[:blank:]\.\/]+))\.c@ -c \1\.c -o msgs/\2\.mso@p
|
|
|
|
}" ${root}/lib/package/gen/make.out > src/cmd/ksh93/doit
|
|
|
|
pushd src/cmd/ksh93
|
|
|
|
mkdir msgs
|
2012-01-20 18:45:26 +01:00
|
|
|
${root}/lib/probe/C/pp/probe $(type -p gcc) > pp_default.h
|
|
|
|
$SHELL ./doit
|
|
|
|
$SHELL msgcc -o libshell.msg msgs/*.mso
|
2011-07-07 15:17:49 +02:00
|
|
|
rm -rf msgs/
|
|
|
|
popd
|
|
|
|
msggen share/locale/C/LC_MESSAGES/libshell src/cmd/ksh93/libshell.msg
|
|
|
|
pushd ${root}/bin
|
|
|
|
PATH=$PATH:.
|
2012-02-10 17:47:32 +01:00
|
|
|
set -- $(shcomp --version 2>&1)
|
2011-07-07 15:17:49 +02:00
|
|
|
eval version=\${$#}
|
2012-02-10 17:47:32 +01:00
|
|
|
for bin in shcomp pty what mime asa dlls ; do
|
2013-08-01 14:33:45 +02:00
|
|
|
$bin --nroff 2>&1 | sed 's/\(\.TH .*\)/\1 "%{date}" "" "Korn shell utilities"/' > ../man/man1/$bin.1ast
|
2012-02-10 17:47:32 +01:00
|
|
|
done
|
2011-07-07 15:17:49 +02:00
|
|
|
popd
|
2013-01-30 12:20:06 +01:00
|
|
|
test -d /tmp -a /tmp -ef ${TMPDIR} || rm -rf ${TMPDIR}
|
2011-07-07 15:17:49 +02:00
|
|
|
SHELL=$OSHELL
|
|
|
|
PATH=$OPATH
|
2007-01-12 17:45:13 +01:00
|
|
|
|
|
|
|
%install
|
|
|
|
root=$(echo ${PWD}/arch/linux*)
|
|
|
|
test -d $root || exit 1
|
2012-02-10 17:47:32 +01:00
|
|
|
pushd $root || exit 1
|
2007-04-03 21:36:49 +02:00
|
|
|
mkdir -p %{buildroot}/bin
|
2007-05-25 17:26:52 +02:00
|
|
|
mkdir -p %{buildroot}%{_bindir}
|
2007-04-03 21:36:49 +02:00
|
|
|
mkdir -p %{buildroot}/%{_lib}/ast/bin
|
2007-05-25 17:26:52 +02:00
|
|
|
mkdir -p %{buildroot}%{_includedir}/ast
|
2007-04-03 21:36:49 +02:00
|
|
|
mkdir -p %{buildroot}%{_libdir}/ast
|
|
|
|
mkdir -p %{buildroot}%{_mandir}
|
|
|
|
mkdir %{buildroot}%{_mandir}/man1
|
|
|
|
mkdir %{buildroot}%{_mandir}/man3
|
2011-09-02 14:19:30 +02:00
|
|
|
%if %use_locale
|
2008-02-15 01:27:23 +01:00
|
|
|
mkdir -p %{buildroot}%{_datadir}/locale
|
2011-09-02 14:19:30 +02:00
|
|
|
%endif
|
2008-09-24 17:01:34 +02:00
|
|
|
mkdir -p %{buildroot}%{_datadir}/ksh/fun
|
2007-04-03 21:36:49 +02:00
|
|
|
mkdir -p %{buildroot}%{_sysconfdir}/permissions.d
|
2012-02-10 17:47:32 +01:00
|
|
|
install bin/ksh %{buildroot}/bin/ksh93
|
|
|
|
install bin/shcomp %{buildroot}%{_bindir}/shcomp
|
|
|
|
%if %use_opt_bins
|
|
|
|
for bin in pty what mime asa dlls ; do
|
|
|
|
install bin/$bin %{buildroot}/%{_bindir}/$bin
|
|
|
|
done
|
|
|
|
%endif
|
2008-09-24 17:01:34 +02:00
|
|
|
%if %use_suid_exe
|
|
|
|
install bin/suid_exec %{buildroot}/%{_lib}/ast/bin/
|
|
|
|
%endif
|
2010-03-07 10:57:52 +01:00
|
|
|
# create ghost files
|
2012-02-10 17:47:32 +01:00
|
|
|
ln -sf /bin/true %{buildroot}/bin/ksh
|
|
|
|
ln -sf /bin/true %{buildroot}%{_bindir}/ksh
|
|
|
|
ln -sf /bin/ksh93 %{buildroot}%{_bindir}/rksh
|
|
|
|
ln -sf /bin/ksh93 %{buildroot}/%{_lib}/ast/ksh
|
|
|
|
ln -sf ast %{buildroot}/%{_lib}/ksh
|
|
|
|
cp -a lib/*.so* %{buildroot}/%{_lib}/ast/
|
|
|
|
cp -a fun/* %{buildroot}%{_datadir}/ksh/fun/
|
|
|
|
if cmp -s %{buildroot}%{_datadir}/ksh/fun/pushd %{buildroot}%{_datadir}/ksh/fun/popd ; then
|
|
|
|
ln -sf pushd %{buildroot}%{_datadir}/ksh/fun/popd
|
|
|
|
fi
|
2007-04-03 21:36:49 +02:00
|
|
|
for so in %{buildroot}/%{_lib}/ast/*.so.*.* ; do
|
2007-01-12 17:45:13 +01:00
|
|
|
so=${so##*/}
|
2007-04-03 21:36:49 +02:00
|
|
|
ln -sf /%{_lib}/ast/$so %{buildroot}%{_libdir}/ast/${so%%%%.*}.so
|
2007-01-12 17:45:13 +01:00
|
|
|
done
|
2007-04-03 21:36:49 +02:00
|
|
|
rm -f %{buildroot}%{_libdir}/ast/*.so.*
|
2013-11-11 15:05:53 +01:00
|
|
|
%if %suse_version >= 1320
|
|
|
|
ln -s %{_sysconfdir}/bash.bashrc %{buildroot}%{_sysconfdir}/ksh.kshrc
|
|
|
|
%endif
|
2011-07-07 15:17:49 +02:00
|
|
|
sed -rn '/^\.de Af/,/^\.\./p;/^\.de aF/,/^\.\./p' man/man3/int.3 > af.man
|
|
|
|
for man in $(grep -l '\.}S' man/man[138]/*.[138]); do
|
|
|
|
sed -ri '1r af.man' $man
|
|
|
|
done
|
|
|
|
for man in man/man[138]/*.[138] ; do
|
|
|
|
sed -ri 's/\\f5/\\fB/g;s/^\.H/\.P\n\.H/g;s/\.}S/\.aF/;s/^\.LI/\.LR/;s/\\\(le/\\\(<=/' $man
|
2010-10-11 14:37:47 +02:00
|
|
|
done
|
2007-05-25 17:26:52 +02:00
|
|
|
install -m 0644 lib/*.a %{buildroot}%{_libdir}/ast/
|
2010-03-07 10:57:52 +01:00
|
|
|
%if %suse_version > 1120
|
2013-08-01 14:33:45 +02:00
|
|
|
install -m 0644 man/man1/sh.1 %{buildroot}%{_mandir}/man1/ksh93.1ast
|
|
|
|
ln -sf ../man1/ksh93.1ast.gz %{buildroot}/%{_mandir}/man1/ksh.1ast.gz
|
|
|
|
ln -sf ../man1/ksh93.1ast.gz %{buildroot}/%{_mandir}/man1/rksh.1ast.gz
|
2010-03-07 10:57:52 +01:00
|
|
|
%else
|
2013-09-18 11:28:24 +02:00
|
|
|
install -m 0644 man/man1/sh.1 %{buildroot}%{_mandir}/man1/ksh.1ast
|
2013-08-01 14:33:45 +02:00
|
|
|
ln -sf ../man1/ksh.1ast.gz %{buildroot}/%{_mandir}/man1/rksh.1ast.gz
|
2010-03-07 10:57:52 +01:00
|
|
|
%endif
|
2013-08-01 14:33:45 +02:00
|
|
|
install -m 0644 man/man1/shcomp.1ast %{buildroot}%{_mandir}/man1/shcomp.1ast
|
2012-02-10 17:47:32 +01:00
|
|
|
%if %use_opt_bins
|
|
|
|
for bin in pty what mime asa dlls ; do
|
2013-08-01 14:33:45 +02:00
|
|
|
install -m 0644 man/man1/$bin.1ast %{buildroot}%{_mandir}/man1/$bin.1ast
|
2012-02-10 17:47:32 +01:00
|
|
|
done
|
|
|
|
%endif
|
2007-01-12 17:45:13 +01:00
|
|
|
for man in man/man3/*.3 ; do
|
|
|
|
man=${man##*/}
|
|
|
|
ast=${man}ast
|
2007-05-25 17:26:52 +02:00
|
|
|
install -m 0644 man/man3/${man} %{buildroot}%{_mandir}/man3/${ast}
|
2007-01-12 17:45:13 +01:00
|
|
|
done
|
2007-05-25 17:26:52 +02:00
|
|
|
install -m 0644 include/ast/* %{buildroot}%{_includedir}/ast/
|
2012-02-10 17:47:32 +01:00
|
|
|
if cmp -s %{buildroot}%{_includedir}/ast/namval.h %{buildroot}%{_includedir}/ast/ast_namval.h ; then
|
|
|
|
ln -sf ast_namval.h %{buildroot}%{_includedir}/ast/namval.h
|
|
|
|
fi
|
2007-01-12 17:45:13 +01:00
|
|
|
popd
|
2008-10-09 18:50:19 +02:00
|
|
|
%if %use_locale
|
2011-07-07 15:17:49 +02:00
|
|
|
for msg in share/locale/* ; do
|
|
|
|
test -d $msg || continue
|
|
|
|
mkdir -p %{buildroot}%{_datadir}/locale/${msg##*/}/LC_MESSAGES
|
|
|
|
cp -vp ${msg}/LC_MESSAGES/* %{buildroot}%{_datadir}/locale/${msg##*/}/LC_MESSAGES/
|
|
|
|
done
|
2008-02-15 01:27:23 +01:00
|
|
|
echo %%dir %{_datadir}/locale/C > ksh.lang
|
|
|
|
echo %%dir %{_datadir}/locale/C/LC_MESSAGES >> ksh.lang
|
2011-09-02 14:19:30 +02:00
|
|
|
%endif
|
2008-02-15 01:27:23 +01:00
|
|
|
find %{buildroot}/ -type f -o -type l | sed -r '
|
|
|
|
s:%{buildroot}::
|
|
|
|
s:(%{_datadir}/locale/)([^/_]+)(.*$):%%lang\(\2\) \1\2\3:
|
|
|
|
s:^([^%%].*)::
|
|
|
|
s:%%lang\(C\) ::
|
|
|
|
/^ *$/d' >> ksh.lang
|
2010-10-11 14:37:47 +02:00
|
|
|
if test -s lib/package/LICENSES/ast ; then
|
|
|
|
cp lib/package/LICENSES/ast LICENSE
|
|
|
|
else
|
2012-03-15 13:44:41 +01:00
|
|
|
cp %{S:3} EPL-1.0
|
|
|
|
cp %{S:4} CPL-1.0
|
2013-10-18 12:46:51 +02:00
|
|
|
ln -sf EPL-1.0 LICENSE
|
2010-10-11 14:37:47 +02:00
|
|
|
fi
|
2007-01-12 17:45:13 +01:00
|
|
|
mv src/cmd/ksh93/OBSOLETE src/cmd/ksh93/OBSOLETE.mm
|
2011-07-07 15:17:49 +02:00
|
|
|
echo '.VERBON 22' > grep.mm
|
|
|
|
sed -rn '/function grep/,/^}/p' src/cmd/ksh93/tests/grep.sh >> grep.mm
|
|
|
|
echo '.VERBOFF' >> grep.mm
|
|
|
|
tdevice=ascii8
|
|
|
|
troff -Tascii8 < /dev/null > /dev/null 2>&1 || tdevice=utf8
|
|
|
|
cat src/cmd/ksh93/builtins.mm | sed 's/\\f5/\\fB/g;s/^\.H/\.P\n\.H/g' | troff -T$tdevice -t -mm | grotty -bou > Builtins
|
|
|
|
cat src/cmd/ksh93/PROMO.mm | sed 's/\\f5/\\fB/g;s/^\.H/\.P\n\.H/g' | troff -T$tdevice -t -mm | grotty -bou > PROMO
|
|
|
|
cat src/cmd/ksh93/OBSOLETE.mm | sed 's/\\f5/\\fB/g;s/^\.H/\.P\n\.H/g' | troff -T$tdevice -t -mm | grotty -bou > OBSOLETE
|
|
|
|
cat src/cmd/ksh93/sh.memo | sed 's/\\f5/\\fB/g;s/^\.H/\.P\n\.H/g' | troff -T$tdevice -t -mm | grotty -bou > MEMORANDUM
|
2008-02-15 01:27:23 +01:00
|
|
|
cp %{S:21} .
|
2008-09-24 17:01:34 +02:00
|
|
|
%if %use_suid_exe
|
2011-05-24 18:36:50 +02:00
|
|
|
set -C
|
2008-09-24 17:01:34 +02:00
|
|
|
(cat > %{buildroot}%{_sysconfdir}/permissions.d/ksh) <<-EOF
|
|
|
|
/%{_lib}/ast/bin/suid_exec root:root 4755
|
|
|
|
EOF
|
|
|
|
(cat > %{buildroot}%{_sysconfdir}/permissions.d/ksh.paranoid) <<-EOF
|
|
|
|
/%{_lib}/ast/bin/suid_exec root:root 0755
|
|
|
|
EOF
|
2011-05-24 18:36:50 +02:00
|
|
|
set +C
|
2008-09-24 17:01:34 +02:00
|
|
|
%endif
|
2007-01-12 17:45:13 +01:00
|
|
|
|
2012-02-10 17:47:32 +01:00
|
|
|
%if %use_suid_exe
|
|
|
|
%if %{defined verify_permissions}
|
|
|
|
%verifyscript
|
|
|
|
%verify_permissions -e /%{_lib}/ast/bin/suid_exec
|
|
|
|
%endif
|
|
|
|
%endif
|
|
|
|
|
2007-01-12 17:45:13 +01:00
|
|
|
%post
|
2013-11-11 15:05:53 +01:00
|
|
|
%if %suse_version < 1320
|
2007-01-12 17:45:13 +01:00
|
|
|
test -e etc/bash.bashrc && ln -sf bash.bashrc etc/ksh.kshrc || true
|
2013-11-11 15:05:53 +01:00
|
|
|
%endif
|
2012-02-10 17:47:32 +01:00
|
|
|
%if %use_suid_exe
|
|
|
|
%if %{defined set_permissions}
|
|
|
|
%set_permissions /%{_lib}/ast/bin/suid_exec
|
|
|
|
%endif
|
|
|
|
%endif
|
2010-03-07 10:57:52 +01:00
|
|
|
%if %suse_version > 1120
|
2012-02-10 17:47:32 +01:00
|
|
|
if test -x /%{_lib}/ast/bin/ksh ; then
|
|
|
|
%{_sbindir}/update-alternatives \
|
|
|
|
--quiet \
|
|
|
|
%if %suse_version > 1210
|
|
|
|
--force \
|
|
|
|
%endif
|
|
|
|
--remove ksh /%{_lib}/ast/bin/ksh
|
|
|
|
rm -f /%{_lib}/ast/bin/ksh
|
|
|
|
rm -f /%{_lib}/ast/bin/shcomp
|
|
|
|
fi
|
2010-03-07 10:57:52 +01:00
|
|
|
%{_sbindir}/update-alternatives \
|
2012-02-10 17:47:32 +01:00
|
|
|
--quiet \
|
2012-01-20 18:45:26 +01:00
|
|
|
%if %suse_version > 1210
|
2012-02-10 17:47:32 +01:00
|
|
|
--force \
|
2012-01-20 18:45:26 +01:00
|
|
|
%endif
|
2012-02-10 17:47:32 +01:00
|
|
|
--install /bin/ksh ksh /bin/ksh93 20 \
|
|
|
|
--slave %{_bindir}/ksh usr-bin-ksh /bin/ksh93 \
|
2013-08-01 14:33:45 +02:00
|
|
|
--slave %{_mandir}/man1/ksh.1ast.gz ksh.1.gz %{_mandir}/man1/ksh93.1ast.gz \
|
|
|
|
--slave %{_mandir}/man1/rksh.1ast.gz rksh.1.gz %{_mandir}/man1/ksh93.1ast.gz
|
2010-03-07 10:57:52 +01:00
|
|
|
%else
|
2012-02-10 17:47:32 +01:00
|
|
|
if test -x /%{_lib}/ast/bin/ksh ; then
|
|
|
|
rm -f /%{_lib}/ast/bin/ksh
|
|
|
|
rm -f /%{_lib}/ast/bin/shcomp
|
|
|
|
fi
|
|
|
|
if test -x /bin/ksh93 ; then
|
2007-01-12 17:45:13 +01:00
|
|
|
rm -f bin/ksh
|
2012-02-10 17:47:32 +01:00
|
|
|
ln -sf /bin/ksh93 bin/ksh
|
2010-03-07 10:57:52 +01:00
|
|
|
rm -f %{_exec_prefix}/bin/ksh
|
2012-02-10 17:47:32 +01:00
|
|
|
ln -sf /bin/ksh93 %{_exec_prefix}/bin/ksh
|
2010-03-07 10:57:52 +01:00
|
|
|
fi
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%if %suse_version > 1120
|
|
|
|
|
|
|
|
%preun
|
2010-03-08 17:20:52 +01:00
|
|
|
if test $1 -eq 0 ; then
|
2012-02-10 17:47:32 +01:00
|
|
|
%{_sbindir}/update-alternatives --quiet --remove ksh /bin/ksh93
|
2007-01-12 17:45:13 +01:00
|
|
|
fi
|
2010-03-07 10:57:52 +01:00
|
|
|
%endif
|
2010-03-07 09:01:54 +01:00
|
|
|
|
2007-01-12 17:45:13 +01:00
|
|
|
%postun
|
2013-11-11 15:05:53 +01:00
|
|
|
%if %suse_version < 1320
|
2012-05-23 12:35:27 +02:00
|
|
|
if test $1 -eq 0 -a ! -x bin/ksh ; then
|
2007-01-12 17:45:13 +01:00
|
|
|
if test ! -x bin/pdksh ; then
|
|
|
|
rm -f etc/ksh.kshrc
|
|
|
|
fi
|
2010-03-07 10:57:52 +01:00
|
|
|
%if %suse_version <= 1120
|
2012-02-10 17:47:32 +01:00
|
|
|
rm -f bin/ksh %{_exec_prefix}/bin/ksh
|
2010-03-07 10:57:52 +01:00
|
|
|
%endif
|
2007-01-12 17:45:13 +01:00
|
|
|
fi
|
2013-11-11 15:05:53 +01:00
|
|
|
%endif
|
2007-01-12 17:45:13 +01:00
|
|
|
|
2012-05-23 12:35:27 +02:00
|
|
|
%posttrans
|
2013-11-11 15:05:53 +01:00
|
|
|
%if %suse_version < 1320
|
2012-05-23 12:35:27 +02:00
|
|
|
if test -x bin/ksh -o -x bin/pdksh ; then
|
|
|
|
test -e etc/bash.bashrc && ln -sf bash.bashrc etc/ksh.kshrc || true
|
|
|
|
fi
|
2013-11-11 15:05:53 +01:00
|
|
|
%endif
|
2012-05-23 12:35:27 +02:00
|
|
|
|
2008-02-15 01:27:23 +01:00
|
|
|
%files -f ksh.lang
|
2007-01-12 17:45:13 +01:00
|
|
|
%defattr(-,root,root)
|
2008-09-24 17:01:34 +02:00
|
|
|
%if %use_suid_exe
|
2012-02-10 17:47:32 +01:00
|
|
|
%config %attr(0644,root,root) %{_sysconfdir}/permissions.d/ksh
|
|
|
|
%config %attr(0644,root,root) %{_sysconfdir}/permissions.d/ksh.paranoid
|
2008-09-24 17:01:34 +02:00
|
|
|
%endif
|
2012-03-15 13:44:41 +01:00
|
|
|
%doc LICENSE EPL-1.0 CPL-1.0 src/cmd/ksh93/COMPATIBILITY src/cmd/ksh93/RELEASE*
|
2007-01-12 17:45:13 +01:00
|
|
|
%doc Builtins PROMO OBSOLETE MEMORANDUM
|
2012-02-10 17:47:32 +01:00
|
|
|
/bin/ksh93
|
2007-01-12 17:45:13 +01:00
|
|
|
%ghost %verify(not link) /bin/ksh
|
2007-05-25 17:26:52 +02:00
|
|
|
%ghost %verify(not link) %{_bindir}/ksh
|
2010-03-07 10:57:52 +01:00
|
|
|
%if %suse_version > 1120
|
2013-08-01 14:33:45 +02:00
|
|
|
%ghost %verify(not link) %{_mandir}/man1/ksh.1ast.gz
|
|
|
|
%ghost %verify(not link) %{_mandir}/man1/rksh.1ast.gz
|
|
|
|
%doc %{_mandir}/man1/ksh93.1ast.gz
|
2010-03-07 10:57:52 +01:00
|
|
|
%else
|
2013-08-01 14:33:45 +02:00
|
|
|
%doc %{_mandir}/man1/ksh.1ast.gz
|
|
|
|
%doc %{_mandir}/man1/rksh.1ast.gz
|
2012-02-10 17:47:32 +01:00
|
|
|
%endif
|
2013-08-01 14:33:45 +02:00
|
|
|
%doc %{_mandir}/man1/shcomp.1ast.gz
|
2012-02-10 17:47:32 +01:00
|
|
|
%if %use_opt_bins
|
2013-08-01 14:33:45 +02:00
|
|
|
%doc %{_mandir}/man1/pty.1ast.gz
|
|
|
|
%doc %{_mandir}/man1/what.1ast.gz
|
|
|
|
%doc %{_mandir}/man1/mime.1ast.gz
|
|
|
|
%doc %{_mandir}/man1/asa.1ast.gz
|
|
|
|
%doc %{_mandir}/man1/dlls.1ast.gz
|
2010-03-07 10:57:52 +01:00
|
|
|
%endif
|
2012-02-10 17:47:32 +01:00
|
|
|
%{_bindir}/*
|
2007-04-03 21:36:49 +02:00
|
|
|
%dir /%{_lib}/ast
|
|
|
|
%dir /%{_lib}/ast/bin
|
2008-09-24 17:01:34 +02:00
|
|
|
%if %use_suid_exe
|
|
|
|
%attr(4755,root,root) /%{_lib}/ast/bin/suid_exec
|
|
|
|
%endif
|
2009-12-11 16:15:17 +01:00
|
|
|
/%{_lib}/ast/*.so*
|
2012-02-10 17:47:32 +01:00
|
|
|
/%{_lib}/ast/ksh
|
2009-12-11 16:15:17 +01:00
|
|
|
/%{_lib}/ksh
|
2008-09-24 17:01:34 +02:00
|
|
|
%dir %{_datadir}/ksh
|
|
|
|
%dir %{_datadir}/ksh/fun
|
|
|
|
%{_datadir}/ksh/fun/*
|
2013-11-11 15:05:53 +01:00
|
|
|
%if %suse_version >= 1320
|
|
|
|
%{_sysconfdir}/ksh.kshrc
|
|
|
|
%endif
|
2007-01-12 17:45:13 +01:00
|
|
|
|
|
|
|
%files -n ksh-devel
|
|
|
|
%defattr(-,root,root)
|
|
|
|
%doc LICENSE Warning
|
|
|
|
%dir %{_libdir}/ast/
|
|
|
|
%{_libdir}/ast/*.so
|
|
|
|
%{_libdir}/ast/*.a
|
|
|
|
%doc %{_mandir}/man3/*
|
2007-05-25 17:26:52 +02:00
|
|
|
%{_includedir}/ast/
|
2007-11-23 02:11:50 +01:00
|
|
|
|
2007-03-29 00:44:12 +02:00
|
|
|
%changelog
|