##// END OF EJS Templates
packaging: make rpm relocatable...
Mathias De Mare -
r49155:5d08b289 6.0 stable
parent child Browse files
Show More
@@ -1,173 +1,174 b''
1 1 %global emacs_lispdir %{_datadir}/emacs/site-lisp
2 2
3 3 %define withpython %{nil}
4 4
5 5 %global pythonexe python3
6 6 %global pythondocutils python3-docutils
7 7
8 8 %if "%{?withpython}"
9 9
10 10 %global pythonver %{withpython}
11 11 %global pythonname Python-%{withpython}
12 12 %global docutilsname docutils-0.14
13 13 %global docutilsmd5 c53768d63db3873b7d452833553469de
14 14 %global pythonhg python-hg
15 15 %global hgpyprefix /opt/%{pythonhg}
16 16 # byte compilation will fail on some some Python /test/ files
17 17 %global _python_bytecompile_errors_terminate_build 0
18 18
19 19 %else
20 20
21 21 %global pythonver %(%{pythonexe} -c 'import sys;print(".".join(map(str, sys.version_info[:2])))')
22 22
23 23 %endif
24 24
25 25 Summary: A fast, lightweight Source Control Management system
26 26 Name: mercurial
27 27 Version: snapshot
28 28 Release: 0
29 29 License: GPLv2+
30 Prefix: /
30 31 Group: Development/Tools
31 32 URL: https://mercurial-scm.org/
32 33 Source0: %{name}-%{version}-%{release}.tar.gz
33 34 %if "%{?withpython}"
34 35 Source1: %{pythonname}.tgz
35 36 Source2: %{docutilsname}.tar.gz
36 37 %endif
37 38 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
38 39
39 40 BuildRequires: make, gcc, gettext
40 41 %if "%{?withpython}"
41 42 BuildRequires: readline-devel, openssl-devel, ncurses-devel, zlib-devel, bzip2-devel
42 43 %else
43 44 BuildRequires: %{pythonexe} >= %{pythonver}, %{pythonexe}-devel, %{pythondocutils}
44 45 Requires: %{pythonexe} >= %{pythonver}
45 46 %endif
46 47 # The hgk extension uses the wish tcl interpreter, but we don't enforce it
47 48 #Requires: tk
48 49
49 50 %description
50 51 Mercurial is a fast, lightweight source control management system designed
51 52 for efficient handling of very large distributed projects.
52 53
53 54 %prep
54 55
55 56 %if "%{?withpython}"
56 57 %setup -q -n mercurial-%{version}-%{release} -a1 -a2
57 58 # despite the comments in cgi.py, we do this to prevent rpmdeps from picking /usr/local/bin/python up
58 59 sed -i '1c#! /usr/bin/env %{pythonexe}' %{pythonname}/Lib/cgi.py
59 60 %else
60 61 %setup -q -n mercurial-%{version}-%{release}
61 62 %endif
62 63
63 64 %build
64 65
65 66 export HGPYTHON3=1
66 67
67 68 %if "%{?withpython}"
68 69
69 70 PYPATH=$PWD/%{pythonname}
70 71 cd $PYPATH
71 72 ./configure --prefix=%{hgpyprefix}
72 73 make all %{?_smp_mflags}
73 74 cd -
74 75
75 76 cd %{docutilsname}
76 77 LD_LIBRARY_PATH=$PYPATH $PYPATH/python setup.py build
77 78 cd -
78 79
79 80 # verify Python environment
80 81 LD_LIBRARY_PATH=$PYPATH PYTHONPATH=$PWD/%{docutilsname} $PYPATH/python -c 'import sys, zlib, bz2, ssl, curses, readline'
81 82
82 83 # set environment for make
83 84 export PATH=$PYPATH:$PATH
84 85 export LD_LIBRARY_PATH=$PYPATH
85 86 export CFLAGS="-L $PYPATH"
86 87 export PYTHONPATH=$PWD/%{docutilsname}
87 88
88 89 %endif
89 90
90 91 make all PYTHON=%{pythonexe}
91 92 make -C contrib/chg
92 93
93 94 sed -i -e '1s|#!/usr/bin/env python$|#!/usr/bin/env %{pythonexe}|' contrib/hg-ssh
94 95
95 96 %install
96 97 rm -rf $RPM_BUILD_ROOT
97 98
98 99 export HGPYTHON3=1
99 100
100 101 %if "%{?withpython}"
101 102
102 103 PYPATH=$PWD/%{pythonname}
103 104 cd $PYPATH
104 105 make install DESTDIR=$RPM_BUILD_ROOT
105 106 # these .a are not necessary and they are readonly and strip fails - kill them!
106 107 rm -f %{buildroot}%{hgpyprefix}/lib/{,python2.*/config}/libpython2.*.a
107 108 cd -
108 109
109 110 cd %{docutilsname}
110 111 LD_LIBRARY_PATH=$PYPATH $PYPATH/python setup.py install --root="$RPM_BUILD_ROOT"
111 112 cd -
112 113
113 114 PATH=$PYPATH:$PATH LD_LIBRARY_PATH=$PYPATH make install PYTHON=%{pythonexe} DESTDIR=$RPM_BUILD_ROOT PREFIX=%{hgpyprefix} MANDIR=%{_mandir} PURE="--rust"
114 115 mkdir -p $RPM_BUILD_ROOT%{_bindir}
115 116 ( cd $RPM_BUILD_ROOT%{_bindir}/ && ln -s ../..%{hgpyprefix}/bin/hg . )
116 117 ( cd $RPM_BUILD_ROOT%{_bindir}/ && ln -s ../..%{hgpyprefix}/bin/python2.? %{pythonhg} )
117 118
118 119 %else
119 120
120 121 make install PYTHON=%{pythonexe} DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} MANDIR=%{_mandir} PURE="--rust"
121 122
122 123 %endif
123 124
124 125 install -m 755 contrib/chg/chg $RPM_BUILD_ROOT%{_bindir}/
125 126 install -m 755 contrib/hgk $RPM_BUILD_ROOT%{_bindir}/
126 127 install -m 755 contrib/hg-ssh $RPM_BUILD_ROOT%{_bindir}/
127 128
128 129 bash_completion_dir=$RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d
129 130 mkdir -p $bash_completion_dir
130 131 install -m 644 contrib/bash_completion $bash_completion_dir/mercurial.sh
131 132
132 133 zsh_completion_dir=$RPM_BUILD_ROOT%{_datadir}/zsh/site-functions
133 134 mkdir -p $zsh_completion_dir
134 135 install -m 644 contrib/zsh_completion $zsh_completion_dir/_mercurial
135 136
136 137 mkdir -p $RPM_BUILD_ROOT%{emacs_lispdir}
137 138 install -m 644 contrib/mercurial.el $RPM_BUILD_ROOT%{emacs_lispdir}/
138 139 install -m 644 contrib/mq.el $RPM_BUILD_ROOT%{emacs_lispdir}/
139 140
140 141 mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/mercurial/hgrc.d
141 142
142 143 %clean
143 144 rm -rf $RPM_BUILD_ROOT
144 145
145 146 %files
146 147 %defattr(-,root,root,-)
147 148 %doc CONTRIBUTORS COPYING doc/README doc/hg*.txt doc/hg*.html *.cgi contrib/*.fcgi contrib/*.wsgi
148 149 %doc %attr(644,root,root) %{_mandir}/man?/hg*
149 150 %doc %attr(644,root,root) contrib/*.svg
150 151 %dir %{_datadir}/zsh/
151 152 %dir %{_datadir}/zsh/site-functions/
152 153 %{_datadir}/zsh/site-functions/_mercurial
153 154 %dir %{_datadir}/emacs/site-lisp/
154 155 %{_datadir}/emacs/site-lisp/mercurial.el
155 156 %{_datadir}/emacs/site-lisp/mq.el
156 157 %{_bindir}/hg
157 158 %{_bindir}/chg
158 159 %{_bindir}/hgk
159 160 %{_bindir}/hg-ssh
160 161 %dir %{_sysconfdir}/bash_completion.d/
161 162 %config(noreplace) %{_sysconfdir}/bash_completion.d/mercurial.sh
162 163 %dir %{_sysconfdir}/mercurial
163 164 %dir %{_sysconfdir}/mercurial/hgrc.d
164 165 %if "%{?withpython}"
165 166 %{_bindir}/%{pythonhg}
166 167 %{hgpyprefix}
167 168 %else
168 169 %{_libdir}/python%{pythonver}/site-packages/%{name}-*-py%{pythonver}.egg-info
169 170 %{_libdir}/python%{pythonver}/site-packages/%{name}
170 171 %{_libdir}/python%{pythonver}/site-packages/hgext
171 172 %{_libdir}/python%{pythonver}/site-packages/hgext3rd
172 173 %{_libdir}/python%{pythonver}/site-packages/hgdemandimport
173 174 %endif
General Comments 0
You need to be logged in to leave comments. Login now