/[packages]/cauldron/rust/current/SPECS/rust.spec
ViewVC logotype

Diff of /cauldron/rust/current/SPECS/rust.spec

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1766230 by akien, Sun Jan 2 20:49:42 2022 UTC revision 1769757 by akien, Tue Jan 25 15:13:17 2022 UTC
# Line 10  Line 10 
10  # The channel can be stable, beta, or nightly  # The channel can be stable, beta, or nightly
11  %{!?channel: %global channel stable}  %{!?channel: %global channel stable}
12    
13  # To bootstrap from scratch, set the channel and date from src/stage0.txt  # To bootstrap from scratch, set the channel and date from src/stage0.json
14  # e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24  # e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24
15  # or nightly wants some beta-YYYY-MM-DD  # or nightly wants some beta-YYYY-MM-DD
16  # Note that cargo matches the program version here, not its crate version.  # Note that cargo matches the program version here, not its crate version.
17  %global bootstrap_rust 1.56.1  %global bootstrap_rust 1.57.0
18  %global bootstrap_cargo 1.56.1  %global bootstrap_cargo 1.57.0
19  %global bootstrap_channel 1.56.1  %global bootstrap_channel 1.57.0
20  %global bootstrap_date 2021-11-01  %global bootstrap_date 2021-12-02
21    
22  # Only the specified arches will use bootstrap binaries.  # Only the specified arches will use bootstrap binaries.
23  #global bootstrap_arches %%{rust_arches}  #global bootstrap_arches %%{rust_arches}
# Line 38  Line 38 
38  # reproducible between hosts, so only x86_64 actually builds it.  # reproducible between hosts, so only x86_64 actually builds it.
39  %ifarch x86_64  %ifarch x86_64
40  %if 0%{?fedora} || 0%{?mageia}  %if 0%{?fedora} || 0%{?mageia}
41  %global cross_targets wasm32-unknown-unknown wasm32-wasi  %global mingw_targets i686-pc-windows-gnu x86_64-pc-windows-gnu
42    %endif
43    %if 0%{?fedora} || 0%{?rhel} >= 8 || 0%{?mageia}
44    %global wasm_targets wasm32-unknown-unknown wasm32-wasi
45  %endif  %endif
46  %endif  %endif
47    
48  # We need CRT files for *-wasi targets, at least as new as the commit in  # We need CRT files for *-wasi targets, at least as new as the commit in
49  # src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh  # src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh
50  %global forgeurl1 https://github.com/WebAssembly/wasi-libc  %global wasi_libc_url https://github.com/WebAssembly/wasi-libc
51  %global commit1 ad5133410f66b93a2381db5b542aad5e0964db96  %global wasi_libc_commit ad5133410f66b93a2381db5b542aad5e0964db96
52  %forgemeta -z 1  %global wasi_libc_name wasi-libc-%{wasi_libc_commit}
53  %undefine distprefix1  %global wasi_libc_source %{wasi_libc_url}/archive/%{wasi_libc_commit}/%{wasi_libc_name}.tar.gz
54  %global wasi_libc_source %{forgesource1}  %global wasi_libc_dir %{_builddir}/%{wasi_libc_name}
 %global wasi_libc_dir %{_builddir}/%{extractdir1}  
55    
56  # Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases.  # Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases.
57  %bcond_with llvm_static  %bcond_with llvm_static
58    
59  # We can also choose to just use Rust's bundled LLVM, in case the system LLVM  # We can also choose to just use Rust's bundled LLVM, in case the system LLVM
60  # is insufficient.  Rust currently requires LLVM 10.0+.  # is insufficient.  Rust currently requires LLVM 12.0+.
61    %global min_llvm_version 12.0.0
62    %global bundled_llvm_version 13.0.0
63  %bcond_with bundled_llvm  %bcond_with bundled_llvm
64  # (akien) Hacks below are needed on mga's buildsystem when we have to rebootstrap llvm.  # (akien) Hacks below are needed on mga's buildsystem when we have to rebootstrap llvm.
65  ## Bundled LLVM has underlinking issues:  ## Bundled LLVM has underlinking issues:
# Line 66  Line 70 
70  #%%endif  #%%endif
71    
72  # Requires stable libgit2 1.3  # Requires stable libgit2 1.3
73  # (akien) TODO: enable for mga9 once packaged.  %global min_libgit2_version 1.3.0
74  %if 0%{?fedora} >= 36  %global bundled_libgit2_version 1.3.0
75    %if 0%{?fedora} >= 36 || 0%{?mageia} >= 9
76  %bcond_with bundled_libgit2  %bcond_with bundled_libgit2
77  %else  %else
78  %bcond_without bundled_libgit2  %bcond_without bundled_libgit2
79  %endif  %endif
80    
81    # needs libssh2_userauth_publickey_frommemory
82    %global min_libssh2_version 1.6.0
83  %if 0%{?rhel}  %if 0%{?rhel}
84  # Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949)  # Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949)
85  %bcond_without disabled_libssh2  %bcond_without disabled_libssh2
# Line 99  Line 106 
106  %endif  %endif
107    
108  Name:           rust  Name:           rust
109  Version:        1.57.0  Version:        1.58.1
110  Release:        %mkrel 1  Release:        %mkrel 1
111  Summary:        The Rust Programming Language  Summary:        The Rust Programming Language
112  %if 0%{?mageia}  %if 0%{?mageia}
# Line 119  Source0:        https://static.rust-lang Line 126  Source0:        https://static.rust-lang
126  Source1:        %{wasi_libc_source}  Source1:        %{wasi_libc_source}
127  # Sources for bootstrap_arches are inserted by lua below  # Sources for bootstrap_arches are inserted by lua below
128    
 # Fix a bad typecast for LLVM globals, rhbz#1990657  
 # https://github.com/rust-lang/rust/pull/91070  
 Patch1:         rust-pr91070.patch  
   
129  # By default, rust tries to use "rust-lld" as a linker for WebAssembly.  # By default, rust tries to use "rust-lld" as a linker for WebAssembly.
130  Patch2:         0001-Use-lld-provided-by-system-for-wasm.patch  Patch1:         0001-Use-lld-provided-by-system-for-wasm.patch
131    
132  # (akien) Those tests fail on armv7 - on Fedora too, and jistone ignores them  # (akien) Those tests fail on armv7 - on Fedora too, and jistone ignores them
133  # https://github.com/rust-lang/rust/issues/83453  # https://github.com/rust-lang/rust/issues/83453
# Line 137  Patch100:       rustc-1.56.0-disable-lib Line 140  Patch100:       rustc-1.56.0-disable-lib
140    
141  # libcurl on RHEL7 doesn't have http2, but since cargo requests it, curl-sys  # libcurl on RHEL7 doesn't have http2, but since cargo requests it, curl-sys
142  # will try to build it statically -- instead we turn off the feature.  # will try to build it statically -- instead we turn off the feature.
143  Patch101:       rustc-1.57.0-disable-http2.patch  Patch101:       rustc-1.58.0-disable-http2.patch
144    
145  # kernel rh1410097 causes too-small stacks for PIE.  # kernel rh1410097 causes too-small stacks for PIE.
146  # (affects RHEL6 kernels when building for RHEL7)  # (affects RHEL6 kernels when building for RHEL7)
147  Patch102:       rustc-1.57.0-no-default-pie.patch  Patch102:       rustc-1.58.0-no-default-pie.patch
148    
149    
150  # Get the Rust triple for any arch.  # Get the Rust triple for any arch.
# Line 209  BuildRequires:  make Line 212  BuildRequires:  make
212  BuildRequires:  gcc  BuildRequires:  gcc
213  BuildRequires:  gcc-c++  BuildRequires:  gcc-c++
214  BuildRequires:  ncurses-devel  BuildRequires:  ncurses-devel
 BuildRequires:  curl  
215  # explicit curl-devel to avoid httpd24-curl (rhbz1540167)  # explicit curl-devel to avoid httpd24-curl (rhbz1540167)
216  BuildRequires:  curl-devel  BuildRequires:  curl-devel
217  BuildRequires:  pkgconfig(libcurl)  BuildRequires:  pkgconfig(libcurl)
# Line 218  BuildRequires:  pkgconfig(openssl) Line 220  BuildRequires:  pkgconfig(openssl)
220  BuildRequires:  pkgconfig(zlib)  BuildRequires:  pkgconfig(zlib)
221    
222  %if %{without bundled_libgit2}  %if %{without bundled_libgit2}
223  BuildRequires:  pkgconfig(libgit2) >= 1.3.0  BuildRequires:  pkgconfig(libgit2) >= %{min_libgit2_version}
224  %endif  %endif
225    
226  %if %{without disabled_libssh2}  %if %{without disabled_libssh2}
227  # needs libssh2_userauth_publickey_frommemory  BuildRequires:  pkgconfig(libssh2) >= %{min_libssh2_version}
 BuildRequires:  pkgconfig(libssh2) >= 1.6.0  
228  %endif  %endif
229    
230  %global python python3  %if 0%{?rhel} == 8
231  BuildRequires:  %{python}  BuildRequires:  platform-python
232    %else
233    BuildRequires:  python3
234    %endif
235    BuildRequires:  python3-rpm-macros
236    
237  %if %with bundled_llvm  %if %with bundled_llvm
238  BuildRequires:  cmake3 >= 3.13.4  BuildRequires:  cmake3 >= 3.13.4
239  BuildRequires:  ninja-build  BuildRequires:  ninja-build
240  Provides:       bundled(llvm) = 13.0.0  Provides:       bundled(llvm) = %{bundled_llvm_version}
241  %else  %else
242  BuildRequires:  cmake >= 2.8.11  BuildRequires:  cmake >= 2.8.11
243  %if 0%{?epel} == 7  %if 0%{?epel} == 7
244  %global llvm llvm11  %global llvm llvm13
245  %endif  %endif
246  %if %defined llvm  %if %defined llvm
247  %global llvm_root %{_libdir}/%{llvm}  %global llvm_root %{_libdir}/%{llvm}
# Line 244  BuildRequires:  cmake >= 2.8.11 Line 249  BuildRequires:  cmake >= 2.8.11
249  %global llvm llvm  %global llvm llvm
250  %global llvm_root %{_prefix}  %global llvm_root %{_prefix}
251  %endif  %endif
252  BuildRequires:  %{llvm}-devel >= 10.0  BuildRequires:  %{llvm}-devel >= %{min_llvm_version}
253  %if %with llvm_static  %if %with llvm_static
254  BuildRequires:  %{llvm}-static  BuildRequires:  %{llvm}-static
255  BuildRequires:  libffi-devel  BuildRequires:  libffi-devel
256  %endif  %endif
257  %endif  %endif
258    
259  # make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs  # make check needs "ps" for src/test/ui/wait-forked-but-failed-child.rs
260  BuildRequires:  procps-ng  BuildRequires:  procps-ng
261    
262  # debuginfo-gdb tests need gdb  # debuginfo-gdb tests need gdb
# Line 275  Requires:       /usr/bin/cc Line 280  Requires:       /usr/bin/cc
280    
281  %if 0%{?epel} == 7  %if 0%{?epel} == 7
282  %global devtoolset_name devtoolset-9  %global devtoolset_name devtoolset-9
283    BuildRequires:  %{devtoolset_name}-binutils
284  BuildRequires:  %{devtoolset_name}-gcc  BuildRequires:  %{devtoolset_name}-gcc
285  BuildRequires:  %{devtoolset_name}-gcc-c++  BuildRequires:  %{devtoolset_name}-gcc-c++
286  %global __cc /opt/rh/%{devtoolset_name}/root/usr/bin/gcc  %global devtoolset_bindir /opt/rh/%{devtoolset_name}/root/usr/bin
287  %global __cxx /opt/rh/%{devtoolset_name}/root/usr/bin/g++  %global __cc     %{devtoolset_bindir}/gcc
288    %global __cxx    %{devtoolset_bindir}/g++
289    %global __ar     %{devtoolset_bindir}/ar
290    %global __ranlib %{devtoolset_bindir}/ranlib
291    %global __strip  %{devtoolset_bindir}/strip
292    %else
293    %global __ranlib %{_bindir}/ranlib
294  %endif  %endif
295    
296  # ALL Rust libraries are private, because they don't keep an ABI.  # ALL Rust libraries are private, because they don't keep an ABI.
# Line 300  BuildRequires:  %{devtoolset_name}-gcc-c Line 312  BuildRequires:  %{devtoolset_name}-gcc-c
312  %global _find_debuginfo_opts --keep-section .rustc  %global _find_debuginfo_opts --keep-section .rustc
313  %endif  %endif
314    
 # Use hardening ldflags.  
 %global rustflags -Clink-arg=-Wl,-z,relro,-z,now  
   
315  %if %{without bundled_llvm}  %if %{without bundled_llvm}
316  %if "%{llvm_root}" == "%{_prefix}" || 0%{?scl:1}  %if "%{llvm_root}" == "%{_prefix}" || 0%{?scl:1}
317  %global llvm_has_filecheck 1  %global llvm_has_filecheck 1
# Line 314  BuildRequires:  %{devtoolset_name}-gcc-c Line 323  BuildRequires:  %{devtoolset_name}-gcc-c
323  %global common_libdir %{_prefix}/lib  %global common_libdir %{_prefix}/lib
324  %global rustlibdir %{common_libdir}/rustlib  %global rustlibdir %{common_libdir}/rustlib
325    
326  %if %defined cross_targets  %if %defined mingw_targets
327    BuildRequires:  mingw32-filesystem >= 95
328    BuildRequires:  mingw64-filesystem >= 95
329    BuildRequires:  mingw32-gcc
330    BuildRequires:  mingw64-gcc
331    %endif
332    
333    %if %defined wasm_targets
334  BuildRequires:  clang  BuildRequires:  clang
335  # brp-strip-static-archive breaks the archive index for wasm  # brp-strip-static-archive breaks the archive index for wasm
336  %global __os_install_post \  %global __os_install_post \
# Line 332  This package includes the Rust compiler Line 348  This package includes the Rust compiler
348    
349  %package std-static  %package std-static
350  Summary:        Standard library for Rust  Summary:        Standard library for Rust
351    Requires:       %{name} = %{version}-%{release}
352    Requires:       glibc-devel%{?_isa} >= 2.11
353    
354  %description std-static  %description std-static
355  This package includes the standard libraries for building applications  This package includes the standard libraries for building applications
356  written in Rust.  written in Rust.
357    
358  %if %defined cross_targets  %if %defined mingw_targets
359    %{lua: do
360      for triple in string.gmatch(rpm.expand("%{mingw_targets}"), "%S+") do
361        local subs = {
362          triple = triple,
363          name = rpm.expand("%{name}"),
364          verrel = rpm.expand("%{version}-%{release}"),
365          mingw = string.find(rpm.expand("%{ix86}"), string.sub(triple, 1, 4)) and "mingw32" or "mingw64",
366        }
367        local s = string.gsub([[
368    
369    %package std-static-{{triple}}
370    Summary:        Standard library for Rust {{triple}}
371    BuildArch:      noarch
372    Provides:       {{mingw}}-rust = {{verrel}}
373    Provides:       {{mingw}}-rustc = {{verrel}}
374    Requires:       {{mingw}}-crt
375    Requires:       {{mingw}}-gcc
376    Requires:       {{mingw}}-winpthreads-static
377    Requires:       {{name}} = {{verrel}}
378    
379    %description std-static-{{triple}}
380    This package includes the standard libraries for building applications
381    written in Rust for the MinGW target {{triple}}.
382    
383    ]], "{{(%w+)}}", subs)
384        print(s)
385      end
386    end}
387    %endif
388    
389    %if %defined wasm_targets
390  %{lua: do  %{lua: do
391    for triple in string.gmatch(rpm.expand("%{cross_targets}"), "%S+") do    for triple in string.gmatch(rpm.expand("%{wasm_targets}"), "%S+") do
392      local subs = {      local subs = {
393        triple = triple,        triple = triple,
394          name = rpm.expand("%{name}"),
395        verrel = rpm.expand("%{version}-%{release}"),        verrel = rpm.expand("%{version}-%{release}"),
       wasm = string.sub(triple, 1, 4) == "wasm" and 1 or 0,  
396        wasi = string.find(triple, "-wasi") and 1 or 0,        wasi = string.find(triple, "-wasi") and 1 or 0,
397      }      }
398      local s = string.gsub([[      local s = string.gsub([[
399    
400  %package std-static-{{triple}}  %package std-static-{{triple}}
401  Summary:        Standard library for Rust  Summary:        Standard library for Rust {{triple}}
402  BuildArch:      noarch  BuildArch:      noarch
403  Requires:       rust = {{verrel}}  Requires:       {{name}} = {{verrel}}
 %if {{wasm}}  
404  Requires:       lld >= 8.0  Requires:       lld >= 8.0
 %endif  
405  %if {{wasi}}  %if {{wasi}}
406  Provides:       bundled(wasi-libc)  Provides:       bundled(wasi-libc)
407  %endif  %endif
408    
409  %description std-static-{{triple}}  %description std-static-{{triple}}
410  This package includes the standard libraries for building applications  This package includes the standard libraries for building applications
411  written in Rust for the {{triple}} target.  written in Rust for the WebAssembly target {{triple}}.
412    
413  ]], "{{(%w+)}}", subs)  ]], "{{(%w+)}}", subs)
414      print(s)      print(s)
# Line 395  programs. Line 442  programs.
442  Summary:        LLDB pretty printers for Rust  Summary:        LLDB pretty printers for Rust
443  BuildArch:      noarch  BuildArch:      noarch
444  Requires:       lldb  Requires:       lldb
445  Requires:       %{python}-lldb  Requires:       python3-lldb
446  Requires:       %{name}-debugger-common = %{version}-%{release}  Requires:       %{name}-debugger-common = %{version}-%{release}
447    
448  %description lldb  %description lldb
# Line 420  its standard library. Line 467  its standard library.
467  %package -n cargo  %package -n cargo
468  Summary:        Rust's package manager and build tool  Summary:        Rust's package manager and build tool
469  %if %with bundled_libgit2  %if %with bundled_libgit2
470  Provides:       bundled(libgit2) = 1.3.0  Provides:       bundled(libgit2) = %{bundled_libgit2_version}
471  %endif  %endif
472  # For tests:  # For tests:
473  BuildRequires:  git  BuildRequires:  git-core
474  # Cargo is not much use without Rust  # Cargo is not much use without Rust
475  Requires:       rust  Requires:       %{name}
476    
477  # "cargo vendor" is a builtin command starting with 1.37.  The Obsoletes and  # "cargo vendor" is a builtin command starting with 1.37.  The Obsoletes and
478  # Provides are mostly relevant to RHEL, but harmless to have on Fedora/etc. too  # Provides are mostly relevant to RHEL, but harmless to have on Fedora/etc. too
# Line 442  Summary:        Documentation for Cargo Line 489  Summary:        Documentation for Cargo
489  BuildArch:      noarch  BuildArch:      noarch
490  # Cargo no longer builds its own documentation  # Cargo no longer builds its own documentation
491  # https://github.com/rust-lang/cargo/pull/4904  # https://github.com/rust-lang/cargo/pull/4904
492  Requires:       rust-doc = %{version}-%{release}  Requires:       %{name}-doc = %{version}-%{release}
493    
494  %description -n cargo-doc  %description -n cargo-doc
495  This package includes HTML documentation for Cargo.  This package includes HTML documentation for Cargo.
# Line 463  A tool for formatting Rust code accordin Line 510  A tool for formatting Rust code accordin
510  %package -n rls  %package -n rls
511  Summary:        Rust Language Server for IDE integration  Summary:        Rust Language Server for IDE integration
512  %if %with bundled_libgit2  %if %with bundled_libgit2
513  Provides:       bundled(libgit2) = 1.3.0  Provides:       bundled(libgit2) = %{bundled_libgit2_version}
514  %endif  %endif
515  Requires:       rust-analysis  Requires:       %{name}-analysis
516  # /usr/bin/rls is dynamically linked against internal rustc libs  # /usr/bin/rls is dynamically linked against internal rustc libs
517  Requires:       %{name}%{?_isa} = %{version}-%{release}  Requires:       %{name}%{?_isa} = %{version}-%{release}
518    
# Line 505  useful as a reference for code completio Line 552  useful as a reference for code completio
552    
553  %package analysis  %package analysis
554  Summary:        Compiler analysis data for the Rust standard library  Summary:        Compiler analysis data for the Rust standard library
555  Requires:       rust-std-static%{?_isa} = %{version}-%{release}  Requires:       %{name}-std-static%{?_isa} = %{version}-%{release}
556    
557  %description analysis  %description analysis
558  This package contains analysis data files produced with rustc's -Zsave-analysis  This package contains analysis data files produced with rustc's -Zsave-analysis
# Line 523  test -f '%{local_rust_root}/bin/cargo' Line 570  test -f '%{local_rust_root}/bin/cargo'
570  test -f '%{local_rust_root}/bin/rustc'  test -f '%{local_rust_root}/bin/rustc'
571  %endif  %endif
572    
573  %if %defined cross_targets  %if %defined wasm_targets
574  %forgesetup -z 1  %setup -q -n %{wasi_libc_name} -T -b 1
575  %endif  %endif
576    
577  %setup -q -n %{rustc_package}  %setup -q -n %{rustc_package}
578    
579  %patch1 -p1  %patch1 -p1
 %patch2 -p1  
580    
581  %patch11 -p1  %patch11 -p1
582    
# Line 547  rm -rf vendor/libnghttp2-sys/ Line 593  rm -rf vendor/libnghttp2-sys/
593  %patch102 -p1  %patch102 -p1
594  %endif  %endif
595    
596  %if "%{python}" != "python3"  # Use our explicit python3 first
597  # Use our preferred python first  sed -i.try-python -e '/^try python3 /i try "%{__python3}" "$@"' ./configure
 sed -i.try-python -e '/^try python3 /i try "%{python}" "$@"' ./configure  
 %endif  
598    
599  %if %without bundled_llvm  %if %without bundled_llvm
600  rm -rf src/llvm-project/  rm -rf src/llvm-project/
# Line 601  find vendor -name .cargo-checksum.json \ Line 645  find vendor -name .cargo-checksum.json \
645  find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+'  find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+'
646    
647  # Set up shared environment variables for build/install/check  # Set up shared environment variables for build/install/check
648  %global rust_env RUSTFLAGS="%{rustflags}"  %global rust_env %{?rustflags:RUSTFLAGS="%{rustflags}"}
649  %if 0%{?cmake_path:1}  %if 0%{?cmake_path:1}
650  %global rust_env %{rust_env} PATH="%{cmake_path}:$PATH"  %global rust_env %{?rust_env} PATH="%{cmake_path}:$PATH"
651  %endif  %endif
652  %if %without disabled_libssh2  %if %without disabled_libssh2
653  # convince libssh2-sys to use the distro libssh2  # convince libssh2-sys to use the distro libssh2
654  %global rust_env %{rust_env} LIBSSH2_SYS_USE_PKG_CONFIG=1  %global rust_env %{?rust_env} LIBSSH2_SYS_USE_PKG_CONFIG=1
655  %endif  %endif
656    %global export_rust_env %{?rust_env:export %{rust_env}}
657    
658    
659  %build  %build
660  export %{rust_env}  %{export_rust_env}
661    
662  %ifarch aarch64 %{arm} %{ix86} s390x  %ifarch aarch64 %{arm} %{ix86} s390x
663  # full debuginfo is exhausting memory; just do libstd for now  # full debuginfo is exhausting memory; just do libstd for now
# Line 636  if [ "$max_cpus" -ge 1 -a "$max_cpus" -l Line 681  if [ "$max_cpus" -ge 1 -a "$max_cpus" -l
681    ncpus="$max_cpus"    ncpus="$max_cpus"
682  fi  fi
683    
684  %if %defined cross_targets  %define target_config %{shrink:
685  %make_build -C %{wasi_libc_dir}    --set target.%{rust_triple}.linker=%{__cc}
686      --set target.%{rust_triple}.cc=%{__cc}
687      --set target.%{rust_triple}.cxx=%{__cxx}
688      --set target.%{rust_triple}.ar=%{__ar}
689      --set target.%{rust_triple}.ranlib=%{__ranlib}
690    }
691    
692    %if %defined mingw_targets
693    %{lua: do
694      local cfg = ""
695      for triple in string.gmatch(rpm.expand("%{mingw_targets}"), "%S+") do
696        local subs = {
697          triple = triple,
698          mingw = string.find(rpm.expand("%{ix86}"), string.sub(triple, 1, 4)) and "mingw32" or "mingw64",
699        }
700        local s = string.gsub([[%{shrink:
701          --set target.{{triple}}.linker=%{{{mingw}}_cc}
702          --set target.{{triple}}.cc=%{{{mingw}}_cc}
703          --set target.{{triple}}.ar=%{{{mingw}}_ar}
704          --set target.{{triple}}.ranlib=%{{{mingw}}_ranlib}
705        }]], "{{(%w+)}}", subs)
706        cfg = cfg .. " " .. s
707      end
708      rpm.define("mingw_target_config " .. cfg)
709    end}
710    %endif
711    
712    %if %defined wasm_targets
713    %make_build --quiet -C %{wasi_libc_dir}
714  %{lua: do  %{lua: do
715    local wasi_root = rpm.expand("%{wasi_libc_dir}") .. "/sysroot"    local wasi_root = rpm.expand("%{wasi_libc_dir}") .. "/sysroot"
716    local set_wasi_root = ""    local cfg = ""
717    for triple in string.gmatch(rpm.expand("%{cross_targets}"), "%S+") do    for triple in string.gmatch(rpm.expand("%{wasm_targets}"), "%S+") do
718      if string.find(triple, "-wasi") then      if string.find(triple, "-wasi") then
719        set_wasi_root = set_wasi_root .. " --set target." .. triple .. ".wasi-root=" .. wasi_root        cfg = cfg .. " --set target." .. triple .. ".wasi-root=" .. wasi_root
720      end      end
721    end    end
722    if wasi_root ~= "" then    rpm.define("wasm_target_config "..cfg)
     rpm.define("set_wasi_root "..set_wasi_root)  
   end  
723  end}  end}
724  %endif  %endif
725    
726  %configure --disable-option-checking \  %configure --disable-option-checking \
727    --libdir=%{common_libdir} \    --libdir=%{common_libdir} \
728    --build=%{rust_triple} --host=%{rust_triple} --target=%{target_triple} \    --build=%{rust_triple} --host=%{rust_triple} --target=%{target_triple} \
729    --set target.%{rust_triple}.linker=%{__cc} \    %{target_config} \
730    --set target.%{rust_triple}.cc=%{__cc} \    %{?mingw_target_config} \
731    --set target.%{rust_triple}.cxx=%{__cxx} \    %{?wasm_target_config} \
732    --python=%{python} \    --python=%{__python3} \
733    --local-rust-root=%{local_rust_root} \    --local-rust-root=%{local_rust_root} \
734    %{!?with_bundled_llvm: --llvm-root=%{llvm_root} \    %{!?with_bundled_llvm: --llvm-root=%{llvm_root} \
735      %{!?llvm_has_filecheck: --disable-codegen-tests} \      %{!?llvm_has_filecheck: --disable-codegen-tests} \
# Line 670  end} Line 741  end}
741    --tools=analysis,cargo,clippy,rls,rustfmt,src \    --tools=analysis,cargo,clippy,rls,rustfmt,src \
742    --enable-vendor \    --enable-vendor \
743    --enable-verbose-tests \    --enable-verbose-tests \
   %{?set_wasi_root} \  
744    --dist-compression-formats=gz \    --dist-compression-formats=gz \
745    --release-channel=%{channel} \    --release-channel=%{channel} \
746    --release-description="%{?mageia:Mageia }%{?fedora:Fedora }%{?rhel:Red Hat }%{version}-%{release}"    --release-description="%{?mageia:Mageia }%{?fedora:Fedora }%{?rhel:Red Hat }%{version}-%{release}"
747    
748  %{python} ./x.py build -j "$ncpus" --stage 2  %{__python3} ./x.py build -j "$ncpus" --stage 2
749  %{python} ./x.py doc --stage 2  %{__python3} ./x.py doc --stage 2
750    
751  %if %defined cross_targets  for triple in %{?mingw_targets} %{?wasm_targets}; do
752  for triple in %{cross_targets}; do    %{__python3} ./x.py build --stage 2 --target=$triple std
   %{python} ./x.py build --stage 2 --target=$triple std  
753  done  done
 %endif  
754    
755  %install  %install
756  export %{rust_env}  %{export_rust_env}
757    
758  DESTDIR=%{buildroot} %{python} ./x.py install  DESTDIR=%{buildroot} %{__python3} ./x.py install
759    
760  %if %defined cross_targets  for triple in %{?mingw_targets} %{?wasm_targets}; do
761  for triple in %{cross_targets}; do    DESTDIR=%{buildroot} %{__python3} ./x.py install --target=$triple std
   DESTDIR=%{buildroot} %{python} ./x.py install --target=$triple std  
762  done  done
 %endif  
763    
764  # These are transient files used by x.py dist and install  # These are transient files used by x.py dist and install
765  rm -rf ./build/dist/ ./build/tmp/  rm -rf ./build/dist/ ./build/tmp/
# Line 766  rm -f %{buildroot}%{rustlibdir}/%{rust_t Line 832  rm -f %{buildroot}%{rustlibdir}/%{rust_t
832    
833    
834  %check  %check
835  export %{rust_env}  %{export_rust_env}
836    
837  # Sanity-check the installed binaries, debuginfo-stripped and all.  # Sanity-check the installed binaries, debuginfo-stripped and all.
838  %{buildroot}%{_bindir}/cargo new build/hello-world  %{buildroot}%{_bindir}/cargo new build/hello-world
# Line 776  env RUSTC=%{buildroot}%{_bindir}/rustc \ Line 842  env RUSTC=%{buildroot}%{_bindir}/rustc \
842    
843  # The results are not stable on koji, so mask errors and just log it.  # The results are not stable on koji, so mask errors and just log it.
844  # Some of the larger test artifacts are manually cleaned to save space.  # Some of the larger test artifacts are manually cleaned to save space.
845  %{python} ./x.py test --no-fail-fast --stage 2 || :  %{__python3} ./x.py test --no-fail-fast --stage 2 || :
846  rm -rf "./build/%{rust_triple}/test/"  rm -rf "./build/%{rust_triple}/test/"
847    
848  %{python} ./x.py test --no-fail-fast --stage 2 cargo || :  %{__python3} ./x.py test --no-fail-fast --stage 2 cargo || :
849  rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"  rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
850    
851  env RLS_TEST_WAIT_FOR_AGES=1 \  %{__python3} ./x.py test --no-fail-fast --stage 2 clippy || :
 %{python} ./x.py test --no-fail-fast --stage 2 clippy || :  
852    
853  %{python} ./x.py test --no-fail-fast --stage 2 rls || :  env RLS_TEST_WAIT_FOR_AGES=1 \
854    %{__python3} ./x.py test --no-fail-fast --stage 2 rls || :
855    
856  %{python} ./x.py test --no-fail-fast --stage 2 rustfmt || :  %{__python3} ./x.py test --no-fail-fast --stage 2 rustfmt || :
857    
858    
859  %{?ldconfig_scriptlets}  %{?ldconfig_scriptlets}
# Line 824  env RLS_TEST_WAIT_FOR_AGES=1 \ Line 890  env RLS_TEST_WAIT_FOR_AGES=1 \
890  %endif  %endif
891    
892    
893  %if %defined cross_targets  %if %defined mingw_targets
894    %{lua: do
895      for triple in string.gmatch(rpm.expand("%{mingw_targets}"), "%S+") do
896        local subs = {
897          triple = triple,
898          rustlibdir = rpm.expand("%{rustlibdir}"),
899        }
900        local s = string.gsub([[
901    
902    %files std-static-{{triple}}
903    %dir {{rustlibdir}}
904    %dir {{rustlibdir}}/{{triple}}
905    %dir {{rustlibdir}}/{{triple}}/lib
906    {{rustlibdir}}/{{triple}}/lib/*.rlib
907    {{rustlibdir}}/{{triple}}/lib/rs*.o
908    %exclude {{rustlibdir}}/{{triple}}/lib/*.dll
909    %exclude {{rustlibdir}}/{{triple}}/lib/*.dll.a
910    %exclude {{rustlibdir}}/{{triple}}/lib/self-contained
911    
912    ]], "{{(%w+)}}", subs)
913        print(s)
914      end
915    end}
916    %endif
917    
918    
919    %if %defined wasm_targets
920  %{lua: do  %{lua: do
921    for triple in string.gmatch(rpm.expand("%{cross_targets}"), "%S+") do    for triple in string.gmatch(rpm.expand("%{wasm_targets}"), "%S+") do
922      local subs = {      local subs = {
923        triple = triple,        triple = triple,
924        rustlibdir = rpm.expand("%{rustlibdir}"),        rustlibdir = rpm.expand("%{rustlibdir}"),
# Line 842  env RLS_TEST_WAIT_FOR_AGES=1 \ Line 934  env RLS_TEST_WAIT_FOR_AGES=1 \
934  %if {{wasi}}  %if {{wasi}}
935  %dir {{rustlibdir}}/{{triple}}/lib/self-contained  %dir {{rustlibdir}}/{{triple}}/lib/self-contained
936  {{rustlibdir}}/{{triple}}/lib/self-contained/crt*.o  {{rustlibdir}}/{{triple}}/lib/self-contained/crt*.o
937    {{rustlibdir}}/{{triple}}/lib/self-contained/libc.a
938  %endif  %endif
939    
940  ]], "{{(%w+)}}", subs)  ]], "{{(%w+)}}", subs)

Legend:
Removed from v.1766230  
changed lines
  Added in v.1769757

  ViewVC Help
Powered by ViewVC 1.1.30