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