From 6a6b92c5abf82c622d0d6086530cb49a48c6d8f7 Mon Sep 17 00:00:00 2001
From: Yury V. Zaytsev <yury@shurup.com>
Date: Sat, 28 Nov 2009 01:12:54 +0100
Subject: [PATCH] Rewritten and simplified static build procedure for legacy distros.
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
---
contrib/dist/redhat/mc.spec.in | 111 +++++++++++++++++++---------------------
1 files changed, 53 insertions(+), 58 deletions(-)
diff --git a/contrib/dist/redhat/mc.spec.in b/contrib/dist/redhat/mc.spec.in
index 1abd6ab..2d87df6 100644
a
|
b
|
|
1 | 1 | # Note that this is NOT a relocatable package |
2 | 2 | |
3 | | %if 0%{?el4}%{?el3} |
| 3 | %define legacy_rhel 0%{?el4}%{?el3} |
| 4 | |
| 5 | %if %{legacy_rhel} |
4 | 6 | %define _with_screen --with-screen=ncurses |
5 | 7 | %define _with_glib_static --with-glib-static |
6 | | %define glib_version glib-2.12.3 |
| 8 | %define glib_version 2.12 |
| 9 | %define glib_stepping .3 |
7 | 10 | %else |
8 | 11 | %define _with_screen --with-screen=slang |
9 | 12 | %endif |
10 | 13 | |
11 | | Summary: User-friendly text console file manager and visual shell |
12 | | Name: mc |
13 | | Version: @RPM_VERSION@ |
14 | | Release: 1%{?dist} |
15 | | Epoch: 1 |
16 | | License: GPLv2 |
17 | | Group: System Environment/Shells |
18 | | Source0: %{name}-@VERSION@.tar.gz |
19 | | |
20 | | %if 0%{?el4}%{?el3} |
21 | | Source1: http://ftp.gnome.org/pub/gnome/sources/glib/2.12/%{glib_version}.tar.bz2 |
22 | | Patch0: glib2-CVE-2008-4316.patch |
| 14 | %define mc_version @RPM_VERSION@ |
| 15 | %define mc_tarball @VERSION@ |
| 16 | |
| 17 | Summary: User-friendly text console file manager and visual shell |
| 18 | Name: mc |
| 19 | Version: %{mc_version} |
| 20 | Release: 1%{?dist} |
| 21 | Epoch: 1 |
| 22 | License: GPLv2 |
| 23 | Group: System Environment/Shells |
| 24 | Source0: %{name}-%{mc_tarball}.tar.gz |
| 25 | |
| 26 | %if %{legacy_rhel} |
| 27 | Source1: http://ftp.gnome.org/pub/gnome/sources/glib/%{glib_version}/glib-%{glib_version}%{?glib_stepping}.tar.bz2 |
| 28 | Patch0: glib2-CVE-2008-4316.patch |
23 | 29 | %endif |
24 | 30 | |
25 | | URL: http://www.midnight-commander.org/ |
26 | | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) |
27 | | BuildRequires: glib2-devel e2fsprogs-devel gpm-devel |
| 31 | URL: http://www.midnight-commander.org/ |
| 32 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) |
| 33 | BuildRequires: e2fsprogs-devel gpm-devel |
28 | 34 | |
29 | | %if 0%{?el5}%{?el4}%{?el3} |
30 | | BuildRequires: pcre-devel |
31 | | %endif |
| 35 | %if %{legacy_rhel} |
| 36 | |
| 37 | BuildRequires: pcre-devel ncurses-devel |
| 38 | |
| 39 | # From Glib |
| 40 | BuildRequires: pkgconfig |
| 41 | BuildRequires: gettext |
32 | 42 | |
33 | | %if 0%{?el4}%{?el3} |
34 | | BuildRequires: gettext pkgconfig >= 0.8 ncurses-devel |
35 | 43 | %else |
36 | | BuildRequires: slang-devel |
| 44 | BuildRequires: glib2-devel slang-devel |
37 | 45 | %endif |
38 | 46 | |
39 | 47 | %description |
… |
… |
is supported on Linux console. VFS (Virtual Filesystem) allows you to |
45 | 53 | view archives and files on remote servers (via SAMBA, FTP or SSH). |
46 | 54 | |
47 | 55 | %prep |
48 | | %if 0%{?el4}%{?el3} |
49 | 56 | |
50 | | %setup -q -T -c -a 0 |
51 | | %setup -q -T -D -a 1 |
| 57 | %setup -q -n %{name}-%{mc_tarball} |
52 | 58 | |
53 | | cd %{glib_version} |
54 | | %patch0 -p1 -b .CVE-2008-4316 |
| 59 | %if %{legacy_rhel} |
55 | 60 | |
56 | | %else |
| 61 | %setup -q -T -D -a 1 -n %{name}-%{mc_tarball} |
57 | 62 | |
58 | | %setup -q -n %{name}-@VERSION@ |
| 63 | cd glib-%{glib_version}%{?glib_stepping} |
| 64 | %patch0 -p1 -b .CVE-2008-4316 |
59 | 65 | |
60 | 66 | %endif |
61 | 67 | |
62 | 68 | %build |
63 | | %if 0%{?el4}%{?el3} |
64 | | |
65 | | cd %{glib_version} |
66 | 69 | |
67 | | RESULT_DIR=`pwd`/result |
| 70 | %if %{legacy_rhel} |
68 | 71 | |
69 | | CFLAGS="%optflags -fno-strict-aliasing" \ |
70 | | ./configure \ |
71 | | --disable-gtk-doc \ |
72 | | --disable-shared \ |
73 | | --enable-static \ |
74 | | --prefix="$RESULT_DIR" \ |
75 | | --exec-prefix="$RESULT_DIR" \ |
76 | | --libdir="$RESULT_DIR/usr/%{_lib}" |
| 72 | pushd glib-%{glib_version}%{?glib_stepping} |
| 73 | RESULT_DIR=`pwd`/result |
77 | 74 | |
78 | | make install %{?_smp_mflags} |
| 75 | ./configure \ |
| 76 | --disable-gtk-doc \ |
| 77 | --disable-shared \ |
| 78 | --enable-static \ |
| 79 | --prefix="$RESULT_DIR" \ |
| 80 | --exec-prefix="$RESULT_DIR" \ |
| 81 | --libdir="$RESULT_DIR/usr/%{_lib}" |
79 | 82 | |
80 | | cd ../%{name}-@VERSION@ |
| 83 | %{__make} %{?_smp_mflags} CFLAGS="%{optflags} -fno-strict-aliasing" install |
| 84 | popd |
81 | 85 | |
82 | | %endif |
83 | | |
84 | | %if 0%{?el4}%{?el3} |
85 | | PKG_CONFIG_PATH="$RESULT_DIR/usr/%{_lib}/pkgconfig:$PKG_CONFIG_PATH" ; export PKG_CONFIG_PATH; |
| 86 | PKG_CONFIG_PATH="$RESULT_DIR/usr/%{_lib}/pkgconfig:$PKG_CONFIG_PATH" ; export PKG_CONFIG_PATH ; |
86 | 87 | %endif |
87 | 88 | |
88 | 89 | %configure \ |
… |
… |
cd %{glib_version} |
94 | 95 | --with-gpm-mouse \ |
95 | 96 | --disable-doxygen-doc |
96 | 97 | |
97 | | make %{?_smp_mflags} |
| 98 | %{__make} %{?_smp_mflags} CFLAGS="%{optflags}" |
98 | 99 | |
99 | 100 | %install |
100 | 101 | rm -rf $RPM_BUILD_ROOT |
101 | 102 | |
102 | | %if 0%{?el4}%{?el3} |
103 | | cd %{name}-@VERSION@ |
104 | | %endif |
105 | | |
106 | 103 | make install DESTDIR="$RPM_BUILD_ROOT" |
107 | 104 | |
108 | | %if 0%{?el4}%{?el3} |
109 | | mv ./* ./../ && cd ./../ |
110 | | rm -rf %{name}-@VERSION@ %{glib_version} |
111 | | %endif |
112 | | |
113 | 105 | install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d |
114 | 106 | install contrib/{mc.sh,mc.csh} $RPM_BUILD_ROOT%{_sysconfdir}/profile.d |
115 | 107 | |
… |
… |
rm -rf $RPM_BUILD_ROOT |
157 | 149 | %dir %{_libexecdir}/mc |
158 | 150 | |
159 | 151 | %changelog |
| 152 | * Fri Nov 27 2009 Yury V. Zaytsev <yury@shurup.com> |
| 153 | - Rewritten and simplified static build procedure. |
| 154 | |
160 | 155 | * Mon Oct 26 2009 Andrew Borodin <aborodin@vmail.ru> |
161 | 156 | - Add new %%{_sysconfdir}/mc/mc.keymap.* files. |
162 | 157 | |