summaryrefslogtreecommitdiff
path: root/zsh.spec
blob: 52336a63bf1cde513985660ac3a4a5691a22bcc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
%define _bindir /bin

Name:                 zsh
Version:              5.9
Release:              3
Summary:              A shell designed for interactive use
License:              MIT
URL:                  http://zsh.sourceforge.net
Source0:              https://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.xz

# There are five startup files that zsh will read commands from
# http://zsh.sourceforge.net/Intro/intro_3.html
Source1:              zlogin
Source2:              zlogout
Source3:              zprofile
Source4:              zshrc
Source5:              zshenv
Source6:              dotzshrc
Patch0:               zsh-5.9-fix-egrep-test-error.patch

BuildRequires:        autoconf coreutils gawk gdbm-devel libcap-devel make
BuildRequires:        ncurses-devel pcre-devel sed texinfo hostname gcc

Requires(post):       info grep
Requires(preun):      info
Requires(postun):     coreutils grep

Provides:             /bin/zsh

%description
The zsh is a shell designed for interactive use, and it is also a powerful scripting language. Many of
the useful features of bash, ksh, and tcsh were incorporated into zsh. It can match files by file extension
without running an external program, share command history with any shell, and more.

%package              help
Summary:              zsh shell manual in html format
BuildArch:            noarch

Provides:             zsh-html
Obsoletes:            zsh-html

%description          help
This package contains the zsh manual in html format.

%prep
%autosetup -p1
autoreconf -fiv

sed -e 's|^\.NOTPARALLEL|#.NOTPARALLEL|' -i 'Config/defs.mk.in'

%build
%undefine _strict_symbol_defs_build

export LIBLDFLAGS='-z lazy -fstack-protector-strong'

%configure --enable-etcdir=%{_sysconfdir} --with-tcsetpgrp --enable-maildir-support --enable-pcre

make -C Src headers
make -C Src -f Makemod zsh{path,xmod}s.h version.h
%make_build all html

%check
make check

%install
%make_install install.info fndir=%{_datadir}/%{name}/%{version}/functions sitefndir=%{_datadir}/%{name}/site-functions \
                           scriptdir=%{_datadir}/%{name}/%{version}/scripts sitescriptdir=%{_datadir}/%{name}/scripts \
                           runhelpdir=%{_datadir}/%{name}/%{version}/help

rm -f $RPM_BUILD_ROOT%{_bindir}/zsh-%{version}
rm -f $RPM_BUILD_ROOT%{_infodir}/dir

install -d ${RPM_BUILD_ROOT}%{_sysconfdir}
for i in %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5}; do
    install -m 644 $i $RPM_BUILD_ROOT%{_sysconfdir}/"${i##*/}"
done

install -d $RPM_BUILD_ROOT%{_sysconfdir}/skel
install -m 644 %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/skel/.zshrc

for i in checkmail harden run-help zcalc zkbd test-repo-git-rebase-apply test-repo-git-rebase-merge; do
    sed -i -e 's!/usr/local/bin/zsh!%{_bindir}/zsh!' $RPM_BUILD_ROOT%{_datadir}/zsh/%{version}/functions/$i
    chmod +x $RPM_BUILD_ROOT%{_datadir}/zsh/%{version}/functions/$i
done

%post
if [ "$1" = 1 ]; then
  if [ ! -f %{_sysconfdir}/shells ] ; then
    echo "%{_bindir}/%{name}" > %{_sysconfdir}/shells
    echo "/bin/%{name}" >> %{_sysconfdir}/shells
  else
    grep -q "^%{_bindir}/%{name}$" %{_sysconfdir}/shells || echo "%{_bindir}/%{name}" >> %{_sysconfdir}/shells
    grep -q "^/bin/%{name}$" %{_sysconfdir}/shells || echo "/bin/%{name}" >> %{_sysconfdir}/shells
  fi
fi

if [ -f %{_infodir}/zsh.info.gz ]; then
/sbin/install-info %{_infodir}/zsh.info.gz %{_infodir}/dir \
  --entry="* zsh: (zsh).                        An enhanced bourne shell."
fi

%preun
if [ "$1" = 0 ] ; then
    if [ -f %{_infodir}/zsh.info.gz ]; then
    /sbin/install-info --delete %{_infodir}/zsh.info.gz %{_infodir}/dir \
      --entry="* zsh: (zsh).                    An enhanced bourne shell."
    fi
fi

%postun
if [ "$1" = 0 ] && [ -f %{_sysconfdir}/shells ] ; then
  sed -i '\!^%{_bindir}/%{name}$!d' %{_sysconfdir}/shells
  sed -i '\!^/bin/%{name}$!d' %{_sysconfdir}/shells
fi

%files
%doc README LICENCE Etc/* FEATURES MACHINES NEWS
%attr(755,root,root) %{_bindir}/zsh

%{_libdir}/zsh

%config(noreplace) %{_sysconfdir}/skel/.z*
%config(noreplace) %{_sysconfdir}/z*
%{_datadir}/zsh

%files help
%doc Doc/*.html
%{_mandir}/*/*
%{_infodir}/*

%changelog
* Mon Jan 30 2023 Cao Jingbo <caojb@chinatelecom.cn> - 5.9-3
- Fix when use grep 3.8 build error.

* Tue Jan 17 2023 dillon chen < dillon.chen@gmail.com> - 5.9-2
- /usr/local/bin/zsh => /bin/zsh

* Sun Oct  9 2022 dillon chen < dillon.chen@gmail.com> - 5.9-1
- update to 5.9

* Tue Mar 1 2022 wangjie <wangjie375@h-partners.com> - 5.8-3
- Type: CVE
- ID: CVE-2021-45444
- SUG: NA
- DESC: fix CVE-2021-45444

* Sat Mar 20 2021 shenyangyang <shenyangyang4@huawei.com> - 5.8-2
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:add -fstack-protector-strong for so file

* Fri Jan 29 2021 zoulin <zoulin13@huawei.com> - 5.8-1
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:update version to 5.8

* Wed Jun 24 2020 xuping <xuping21@huawei.com> - 5.7.1-5
- Type:cves
- ID:CVE-2019-20044
- SUG:NA
- DESC:fix CVE-2019-20044

* Thu Feb 6 2020 openEuler Buildteam <buildteam@openeuler.org> - 5.7.1-4
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:add buildrequires of gcc and make

* Mon Feb 3 2020 openEuler Buildteam <buildteam@openeuler.org> - 5.7.1-3
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:fix missing files 

* Wed Jan 15 2020 openEuler Buildteam <buildteam@openeuler.org> - 5.7.1-2
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:revise buildrequires

* Wed Jan 8 2020 openEuler Buildteam <buildteam@openeuler.org> - 5.7.1-1
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:update version to 5.7.1

* Wed Dec 18 2019 jiangchuangang <jiangchuangang@huawei.com> - 5.6.2-3
- Type:enhancement
- ID:NA
- SUG:restart
- DESC:Synchronize a patch

* Wed Sep 18 2019 dongjian <dongjian13@huawei.com> - 5.6.2-2
- modify summary