]> git.pld-linux.org Git - packages/python3-adblock.git/blame - python3-adblock.spec
reduce opt-level on %{ix86} to fix build
[packages/python3-adblock.git] / python3-adblock.spec
CommitLineData
11e4f1ce
JP
1%define crates_ver 0.4.4
2%define module adblock
3
4Summary: Brave's adblock library in Python
5Name: python3-%{module}
6Version: 0.4.4
7Release: 1
8License: MIT or Apache v2.0
9Group: Libraries/Python
10Source0: https://files.pythonhosted.org/packages/source/a/adblock/%{module}-%{version}.tar.gz
11# Source0-md5: 6958de33e5034c1241a69c91989f0e86
12# ./create-crates.sh
13Source1: %{name}-crates-%{crates_ver}.tar.xz
14# Source1-md5: 932c699a7fa6016098e56026ae389322
15URL: https://github.com/ArniDagur/python-adblock
16BuildRequires: cargo
17BuildRequires: maturin >= 0.10
18BuildRequires: python3-devel >= 1:3.6
19BuildRequires: rpm-pythonprov
20BuildRequires: rpmbuild(macros) >= 2.004
21BuildRequires: rust >= 1.45
22ExclusiveArch: %{rust_arches}
23BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
24
2a8ce8c0
JP
25%ifarch x32
26%define cargo_outdir target/x86_64-unknown-linux-gnux32
27%else
28%define cargo_outdir target
29%endif
30
11e4f1ce
JP
31%description
32Python wrapper for Brave's adblocking library, which is written in
33Rust.
34
35%prep
36%setup -q -n %{module}-%{version} -a1
37
38%{__mv} %{module}-%{crates_ver}/* .
39sed -i -e 's/@@VERSION@@/%{version}/' Cargo.lock
40
41# use our offline registry
42export CARGO_HOME="$(pwd)/.cargo"
43
44mkdir -p "$CARGO_HOME"
45cat >.cargo/config <<EOF
46[source.crates-io]
47registry = 'https://github.com/rust-lang/crates.io-index'
48replace-with = 'vendored-sources'
49
50[source.vendored-sources]
51directory = '$PWD/vendor'
52EOF
53
54%build
f679bd2f
JP
55export CARGO_HOME="$(pwd)/.cargo"
56export CARGO_NET_OFFLINE=true
57export CARGO_TERM_VERBOSE=true
58%{?__jobs:export CARGO_BUILD_JOBS="%{__jobs}"}
59export RUSTFLAGS="%{rpmrustflags}"
60%ifarch %{ix86}
61export RUSTFLAGS="$RUSTFLAGS -C opt-level=1"
62%endif
11e4f1ce
JP
63/usr/bin/maturin build --release --no-sdist \
64%ifarch x32
65 --target x86_64-unknown-linux-gnux32
66%endif
67
68%install
69rm -rf $RPM_BUILD_ROOT
70
71install -d $RPM_BUILD_ROOT%{py3_sitedir}
2a8ce8c0 72cp -p %{cargo_outdir}/release/libadblock.so $RPM_BUILD_ROOT%{py3_sitedir}/%{module}.so
11e4f1ce
JP
73
74%clean
75rm -rf $RPM_BUILD_ROOT
76
77%files -n python3-%{module}
78%defattr(644,root,root,755)
79%doc CHANGELOG.md README.md
80%attr(755,root,root) %{py3_sitedir}/%{module}.so
This page took 0.093164 seconds and 4 git commands to generate.