rust-vl.spec 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915
  1. %bcond_with bootstrap
  2. %bcond_with test
  3. %bcond_with newrpm
  4. %bcond_without clang
  5. %bcond_without bundled_libgit2
  6. %bcond_without bundled_libssh2
  7. # Some sub-packages are versioned independently of the rust compiler and runtime itself.
  8. # Also beware that if any of these are not changed in a version bump, then the release
  9. # number should still increase, not be reset to 1!
  10. %global rustc_version 1.51.0
  11. %global cargo_version %{rustc_version}
  12. %global rustfmt_version %{rustc_version}
  13. %global rls_version %{rustc_version}
  14. %global clippy_version %{rustc_version}
  15. # The channel can be stable, beta, or nightly
  16. %{!?channel: %global channel stable}
  17. # Only x86_64 and i686 are Tier 1 platforms at this time.
  18. # https://forge.rust-lang.org/platform-support.html
  19. %global rust_arches x86_64 i686
  20. # To bootstrap from scratch, set the channel and date from src/stage0.txt
  21. # e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24
  22. # or nightly wants some beta-YYYY-MM-DD
  23. %global bootstrap_rust 1.50.0
  24. %global bootstrap_cargo 1.50.0
  25. %global bootstrap_channel %{bootstrap_rust}
  26. # Only the specified arches will use bootstrap binaries.
  27. %if %{with bootstrap}
  28. %global bootstrap_arches %%{rust_arches}
  29. %endif
  30. # We generally don't want llvm-static present at all, since llvm-config will
  31. # make us link statically. But we can opt in, e.g. to aid LLVM rebases.
  32. # FIXME: LLVM 3.9 prefers shared linking now! Which is good, but next time we
  33. # *want* static we'll have to force it with "llvm-config --link-static".
  34. # See also https://github.com/rust-lang/rust/issues/36854
  35. # The new rustbuild accepts `--enable-llvm-link-shared`, else links static.
  36. %bcond_with llvm_static
  37. # We can also choose to just use Rust's bundled LLVM, in case the system LLVM
  38. # is insufficient. Rust currently requires LLVM 3.7+.
  39. %bcond_with bundled_llvm
  40. # LLDB only works on some architectures
  41. %ifarch %{arm} aarch64 %{ix86} x86_64
  42. # LLDB isn't available everywhere...
  43. %bcond_without lldb
  44. %else
  45. %bcond_with lldb
  46. %endif
  47. Summary: The Rust Programming Language
  48. Name: rust
  49. Version: %{rustc_version}
  50. Release: 1%{?_dist_release}
  51. Group: programming
  52. Vendor: Project Vine
  53. Distribution: Vine Linux
  54. License: (ASL 2.0 or MIT) and (BSD and ISC and MIT)
  55. # ^ written as: (rust itself) and (bundled libraries)
  56. URL: https://www.rust-lang.org
  57. ExclusiveArch: %{rust_arches}
  58. %if "%{channel}" == "stable"
  59. %global rustc_package rustc-%{version}-src
  60. %else
  61. %global rustc_package rustc-%{channel}-src
  62. %endif
  63. Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.gz
  64. # Get the Rust triple for any arch.
  65. %{lua: function rust_triple(arch)
  66. local abi = "gnu"
  67. if arch == "armv7hl" then
  68. arch = "armv7"
  69. abi = "gnueabihf"
  70. elseif arch == "ppc64" then
  71. arch = "powerpc64"
  72. elseif arch == "ppc64le" then
  73. arch = "powerpc64le"
  74. end
  75. return arch.."-unknown-linux-"..abi
  76. end}
  77. %global rust_triple %{lua: print(rust_triple(rpm.expand("%{_target_cpu}")))}
  78. %if %defined bootstrap_arches
  79. # For each bootstrap arch, add an additional binary Source.
  80. # Also define bootstrap_source just for the current target.
  81. %{lua: do
  82. local bootstrap_arches = {}
  83. for arch in string.gmatch(rpm.expand("%{bootstrap_arches}"), "%S+") do
  84. table.insert(bootstrap_arches, arch)
  85. end
  86. local base = rpm.expand("https://static.rust-lang.org/dist"
  87. .."/rust-%{bootstrap_channel}")
  88. local target_arch = rpm.expand("%{_target_cpu}")
  89. for i, arch in ipairs(bootstrap_arches) do
  90. print(string.format("Source%d: %s-%s.tar.gz\n",
  91. i, base, rust_triple(arch)))
  92. if arch == target_arch then
  93. rpm.define("bootstrap_source "..i)
  94. end
  95. end
  96. end}
  97. %endif
  98. %ifarch %{bootstrap_arches}
  99. %global bootstrap_root rust-%{bootstrap_channel}-%{rust_triple}
  100. %global local_rust_root %{_builddir}/%{bootstrap_root}/usr
  101. Provides: bundled(%{name}-bootstrap) = %{bootstrap_rust}
  102. %else
  103. BuildRequires: cargo >= %{bootstrap_cargo}
  104. BuildRequires: %{name} >= %{bootstrap_rust}
  105. BuildConflicts: %{name} > %{version}
  106. %global local_rust_root %{_prefix}
  107. %endif
  108. BuildRequires: cmake
  109. BuildRequires: make
  110. %if %{with clang}
  111. BuildRequires: clang
  112. BuildRequires: lld
  113. %else
  114. BuildRequires: gcc
  115. BuildRequires: gcc-c++
  116. %endif
  117. %if %{without bundled_libgit2}
  118. BuildRequires: libgit2-devel
  119. %endif
  120. %if %{without bundled_libssh2}
  121. BuildRequires: libssh2-devel
  122. %endif
  123. BuildRequires: ncurses-devel
  124. BuildRequires: openssl-devel
  125. BuildRequires: zlib-devel
  126. BuildRequires: python3
  127. BuildRequires: python3-rpm-macros
  128. BuildRequires: curl
  129. BuildRequires: curl-devel
  130. BuildRequires: xz-devel
  131. %if %{with bundled_llvm}
  132. BuildRequires: cmake
  133. BuildRequires: git
  134. Provides: bundled(llvm) = 6.0
  135. %else
  136. BuildRequires: cmake
  137. %if %defined llvm
  138. %global llvm_root %{_libdir}/%{llvm}
  139. %else
  140. %global llvm llvm
  141. %global llvm_root %{_prefix}
  142. %global llvm_has_filecheck 1
  143. %endif
  144. BuildRequires: %{llvm}-devel >= 11.0.0
  145. %if %{with llvm_static}
  146. BuildRequires: %{llvm}-static
  147. BuildRequires: libffi-devel
  148. %else
  149. BuildConflicts: %{llvm}-static
  150. %endif
  151. %endif
  152. # make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs
  153. BuildRequires: procps
  154. # debuginfo-gdb tests need gdb
  155. BuildRequires: gdb
  156. # TODO: work on unbundling these!
  157. Provides: bundled(jquery) = 2.1.4
  158. Provides: bundled(miniz) = 1.14
  159. # Virtual provides for folks who attempt "dnf install rustc"
  160. Provides: rustc = %{version}-%{release}
  161. Provides: rustc%{?_isa} = %{version}-%{release}
  162. # Always require our exact standard library
  163. Requires: %{name}-std-static%{?_isa} = %{version}-%{release}
  164. # The C compiler is needed at runtime just for linking. Someday rustc might
  165. # invoke the linker directly, and then we'll only need binutils.
  166. # https://github.com/rust-lang/rust/issues/11937
  167. Requires: /usr/bin/cc
  168. # ALL Rust libraries are private, because they don't keep an ABI.
  169. %global _privatelibs lib(.*-[[:xdigit:]]{16}*|rustc.*)[.]so.*
  170. %global __provides_exclude ^(%{_privatelibs})$
  171. %global __requires_exclude ^(%{_privatelibs})$
  172. %global __provides_exclude_from ^(%{_docdir}|%{rustlibdir}/src)/.*$
  173. %global __requires_exclude_from ^(%{_docdir}|%{rustlibdir}/src)/.*$
  174. %if !%{with newrpm}
  175. # eu-strip is very eager by default, so we have to limit it to -g, only debugging symbols.
  176. %global _find_debuginfo_opts -g
  177. %undefine _include_minidebuginfo
  178. %else
  179. # Newer find-debuginfo.sh supports --keep-section, which is preferable. rhbz1465997
  180. %global _find_debuginfo_opts --keep-section .rustc
  181. %endif
  182. %if !%{with newrpm}
  183. Obsoletes: rust-debuginfo < %{version}-%{release}
  184. %else
  185. %ifnarch x86_64
  186. Obsoletes: rust-debuginfo < %{version}-%{release}
  187. %endif
  188. %endif
  189. # Use hardening ldflags.
  190. %global rustflags -Clink-arg=-Wl,-z,relro,-z,now
  191. %if %{without bundled_llvm} && "%{llvm_root}" != "%{_prefix}"
  192. # https://github.com/rust-lang/rust/issues/40717
  193. %global library_path $(%{llvm_root}/bin/llvm-config --libdir)
  194. %endif
  195. %description
  196. Rust is a systems programming language that runs blazingly fast, prevents
  197. segfaults, and guarantees thread safety.
  198. This package includes the Rust compiler and documentation generator.
  199. %package std-static
  200. Summary: Standard library for Rust
  201. Group: programming
  202. %description std-static
  203. This package includes the standard libraries for building applications
  204. written in Rust.
  205. %package debugger-common
  206. Summary: Common debugger pretty printers for Rust
  207. Group: programming
  208. BuildArch: noarch
  209. %description debugger-common
  210. This package includes the common functionality for %{name}-gdb and %{name}-lldb.
  211. %package gdb
  212. Summary: GDB pretty printers for Rust
  213. Group: programming
  214. BuildArch: noarch
  215. Requires: gdb
  216. Requires: %{name}-debugger-common = %{version}-%{release}
  217. %description gdb
  218. This package includes the rust-gdb script, which allows easier debugging of Rust
  219. programs.
  220. %if %{with lldb}
  221. %package lldb
  222. Summary: LLDB pretty printers for Rust
  223. Group: programming
  224. # It could be noarch, but lldb has limited availability
  225. #BuildArch: noarch
  226. Requires: lldb
  227. Requires: python3-lldb
  228. Requires: %{name}-debugger-common = %{version}-%{release}
  229. %description lldb
  230. This package includes the rust-lldb script, which allows easier debugging of Rust
  231. programs.
  232. %endif
  233. %package doc
  234. Summary: Documentation for Rust
  235. Group: documentation
  236. # NOT BuildArch: noarch
  237. # Note, while docs are mostly noarch, some things do vary by target_arch.
  238. # Koji will fail the build in rpmdiff if two architectures build a noarch
  239. # subpackage differently, so instead we have to keep its arch.
  240. %description doc
  241. This package includes HTML documentation for the Rust programming language and
  242. its standard library.
  243. %package -n cargo
  244. Summary: Rust's package manager and build tool
  245. Version: %{cargo_version}
  246. Group: programming
  247. # For tests:
  248. BuildRequires: git
  249. # Cargo is not much use without Rust
  250. Requires: rust
  251. %description -n cargo
  252. Cargo is a tool that allows Rust projects to declare their various dependencies
  253. and ensure that you'll always get a repeatable build.
  254. %package -n cargo-doc
  255. Summary: Documentation for Cargo
  256. Version: %{cargo_version}
  257. Group: programming
  258. BuildArch: noarch
  259. # Cargo no longer builds its own documentation
  260. # https://github.com/rust-lang/cargo/pull/4904
  261. Requires: rust-doc = %{rustc_version}-%{release}
  262. %description -n cargo-doc
  263. This package includes HTML documentation for Cargo.
  264. %package -n rustfmt
  265. Summary: Tool to find and fix Rust formatting issues
  266. Version: %{rustfmt_version}
  267. Group: programming
  268. Requires: cargo
  269. Obsoletes: rustfmt-preview < 1.0.0
  270. %description -n rustfmt
  271. A tool for formatting Rust code according to style guidelines.
  272. %package -n rls
  273. Summary: Rust Language Server for IDE integration
  274. Version: %{rls_version}
  275. Group: programming
  276. Requires: rust-analysis
  277. # /usr/bin/rls is dynamically linked against internal rustc libs
  278. Requires: %{name} = %{rustc_version}-%{release}
  279. Obsoletes: rls-preview < 1.0.0
  280. %description -n rls
  281. The Rust Language Server provides a server that runs in the background,
  282. providing IDEs, editors, and other tools with information about Rust programs.
  283. It supports functionality such as 'goto definition', symbol search,
  284. reformatting, and code completion, and enables renaming and refactorings.
  285. %package -n clippy
  286. Summary: Lints to catch common mistakes and improve your Rust code
  287. Version: %{clippy_version}
  288. Group: programming
  289. License: MPLv2.0
  290. Requires: cargo
  291. # /usr/bin/clippy-driver is dynamically linked against internal rustc libs
  292. Requires: %{name} = %{rustc_version}-%{release}
  293. Obsoletes: clippy-preview < 1.0.0
  294. %description -n clippy
  295. A collection of lints to catch common mistakes and improve your Rust code.
  296. %package src
  297. Summary: Sources for the Rust standard library
  298. Group: programming
  299. BuildArch: noarch
  300. %description src
  301. This package includes source files for the Rust standard library. It may be
  302. useful as a reference for code completion tools in various editors.
  303. %package analysis
  304. Summary: Compiler analysis data for the Rust standard library
  305. Group: programming
  306. Requires: rust-std-static = %{rustc_version}-%{release}
  307. %description analysis
  308. This package contains analysis data files produced with rustc's -Zsave-analysis
  309. feature for the Rust standard library. The RLS (Rust Language Server) uses this
  310. data to provide information about the Rust standard library.
  311. %package miri
  312. Summary: An interpreter for Rust's mid-level intermediate representation
  313. Group: programming
  314. Requires: rust = %{rustc_version}-%{release}
  315. %description miri
  316. An experimental interpreter for Rust's mid-level intermediate representation
  317. (MIR). It can run binaries and test suites of cargo projects and detect certain
  318. classes of undefined behavior.
  319. %if %{with newrpm}
  320. # debuginfo is available on x86_64 only
  321. %ifarch x86_64
  322. %debug_package
  323. %endif
  324. %endif
  325. %prep
  326. %ifarch %{bootstrap_arches}
  327. %setup -q -n %{bootstrap_root} -T -b %{bootstrap_source}
  328. ./install.sh --components=cargo,rustc,rust-std-%{rust_triple} \
  329. --prefix=%{local_rust_root} --disable-ldconfig
  330. test -f '%{local_rust_root}/bin/cargo'
  331. test -f '%{local_rust_root}/bin/rustc'
  332. %endif
  333. %setup -q -n %{rustc_package}
  334. sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure
  335. %if %without bundled_llvm
  336. rm -rf src/llvm-project/
  337. mkdir -p src/llvm-project/libunwind/
  338. %endif
  339. # We never enable emscripten.
  340. rm -rf src/llvm-emscripten/
  341. # Remove other unused vendored libraries
  342. #rm -rf vendor/curl-sys/curl/
  343. rm -rf vendor/jemalloc-sys/jemalloc/
  344. rm -rf vendor/libz-sys/src/zlib/
  345. rm -rf vendor/lzma-sys/xz-*/
  346. rm -rf vendor/openssl-src/openssl/
  347. %if %{without bundled_libgit2}
  348. rm -rf vendor/libgit2-sys/libgit2/
  349. %endif
  350. %if %{without bundled_libssh2}
  351. rm -rf vendor/libssh2-sys/libssh2/
  352. %endif
  353. # This only affects the transient rust-installer, but let it use our dynamic xz-libs
  354. sed -i.lzma -e '/LZMA_API_STATIC/d' src/bootstrap/tool.rs
  355. # rename bundled license for packaging
  356. if [ -e vendor/backtrace-sys/src/libbacktrace/LICENSE ]; then
  357. cp -a vendor/backtrace-sys/src/libbacktrace/LICENSE{,-libbacktrace}
  358. fi
  359. %if %{with bundled_llvm} && 0%{?epel}
  360. mkdir -p cmake-bin
  361. ln -s /usr/bin/cmake cmake-bin/cmake
  362. %global cmake_path $PWD/cmake-bin
  363. %endif
  364. %if %{without bundled_llvm} && %{with llvm_static}
  365. # Static linking to distro LLVM needs to add -lffi
  366. # https://github.com/rust-lang/rust/issues/34486
  367. sed -i.ffi -e '$a #[link(name = "ffi")] extern {}' \
  368. src/librustc_llvm/lib.rs
  369. %endif
  370. # The configure macro will modify some autoconf-related files, which upsets
  371. # cargo when it tries to verify checksums in those files. If we just truncate
  372. # that file list, cargo won't have anything to complain about.
  373. find vendor -name .cargo-checksum.json \
  374. -exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+'
  375. %build
  376. %if %{without bundled_libgit2}
  377. export LIBGIT2_SYS_USE_PKG_CONFIG=1
  378. %endif
  379. %if %{without bundled_libssh2}
  380. export LIBSSH2_SYS_USE_PKG_CONFIG=1
  381. %endif
  382. %{?cmake_path:export PATH=%{cmake_path}:$PATH}
  383. %{?library_path:export LIBRARY_PATH="%{library_path}"}
  384. %{?rustflags:export RUSTFLAGS="%{rustflags}"}
  385. # We're going to override --libdir when configuring to get rustlib into a
  386. # common path, but we'll fix the shared libraries during install.
  387. %global common_libdir %{_prefix}/lib
  388. %global rustlibdir %{common_libdir}/rustlib
  389. %ifarch x86_64
  390. %if %{with newrpm}
  391. %define enable_debuginfo --debuginfo-level=0 --debuginfo-level-std=2
  392. %else
  393. %define enable_debuginfo --debuginfo-level=0
  394. %global debug_package %{nil}
  395. %endif
  396. %else
  397. %define enable_debuginfo --debuginfo-level=0
  398. %global debug_package %{nil}
  399. %endif
  400. # Some builders have relatively little memory for their CPU count.
  401. # At least 2GB per CPU is a good rule of thumb for building rustc.
  402. ncpus=$(/usr/bin/getconf _NPROCESSORS_ONLN)
  403. max_cpus=$(( ($(LANG=C free -g | awk '/^Mem:/{print $2}') + 1) / 2 ))
  404. if [ "$max_cpus" -ge 1 -a "$max_cpus" -lt "$ncpus" ]; then
  405. ncpus="$max_cpus"
  406. fi
  407. %if %{with clang}
  408. export CC=clang
  409. export CXX=clang++
  410. export LDFLAGS="$LDFLAGS -fuse-ld=lld"
  411. export RUSTFLAGS="$RUSTFLAGS -C linker=clang -C link-arg=-fuse-ld=lld"
  412. %endif
  413. # workaround for https://github.com/rust-lang/rust/issues/69953
  414. # --set rust.deny-warnings=false
  415. %configure \
  416. --disable-option-checking \
  417. --libdir=%{common_libdir} \
  418. --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \
  419. --enable-local-rust --local-rust-root=%{local_rust_root} \
  420. %{!?with_bundled_llvm: --llvm-root=%{llvm_root} \
  421. %{!?llvm_has_filecheck: --disable-codegen-tests} \
  422. %{!?with_llvm_static: --enable-llvm-link-shared } } \
  423. --disable-rpath \
  424. %{enable_debuginfo} \
  425. --enable-extended \
  426. --enable-vendor \
  427. --enable-verbose-tests \
  428. --set rust.codegen-units-std=1 \
  429. --release-channel=%{channel} \
  430. --set rust.deny-warnings=false \
  431. %{nil}
  432. RUST_BACKTRACE=1 %{__python3} ./x.py build -j "$ncpus" --stage 2
  433. %{__python3} ./x.py doc --stage 2
  434. %install
  435. rm -rf %{buildroot}
  436. %{?cmake_path:export PATH=%{cmake_path}:$PATH}
  437. %{?library_path:export LIBRARY_PATH="%{library_path}"}
  438. %{?rustflags:export RUSTFLAGS="%{rustflags}"}
  439. %if %{with clang}
  440. export CC=clang
  441. export CXX=clang++
  442. export RUSTFLAGS="$RUSTFLAGS -C linker=clang -C link-arg=-fuse-ld=lld"
  443. %endif
  444. DESTDIR=%{buildroot} ./x.py install
  445. #DESTDIR=%{buildroot} ./x.py install src
  446. # Make sure the shared libraries are in the proper libdir
  447. %if "%{_libdir}" != "%{common_libdir}"
  448. mkdir -p %{buildroot}%{_libdir}
  449. find %{buildroot}%{common_libdir} -maxdepth 1 -type f -name '*.so' \
  450. -exec mv -v -t %{buildroot}%{_libdir} '{}' '+'
  451. %endif
  452. # The shared libraries should be executable for debuginfo extraction.
  453. find %{buildroot}%{_libdir} -maxdepth 1 -type f -name '*.so' \
  454. -exec chmod -v +x '{}' '+'
  455. # The libdir libraries are identical to those under rustlib/. It's easier on
  456. # library loading if we keep them in libdir, but we do need them in rustlib/
  457. # to support dynamic linking for compiler plugins, so we'll symlink.
  458. (cd "%{buildroot}%{rustlibdir}/%{rust_triple}/lib" &&
  459. find ../../../../%{_lib} -maxdepth 1 -name '*.so' |
  460. while read lib; do
  461. if [ -f "${lib##*/}" ]; then
  462. # make sure they're actually identical!
  463. cmp "$lib" "${lib##*/}"
  464. ln -v -f -s -t . "$lib"
  465. fi
  466. done)
  467. # Remove installer artifacts (manifests, uninstall scripts, etc.)
  468. find %{buildroot}%{rustlibdir} -maxdepth 1 -type f -exec rm -v '{}' '+'
  469. # Remove backup files from %%configure munging
  470. find %{buildroot}%{rustlibdir} -type f -name '*.orig' -exec rm -v '{}' '+'
  471. # https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error
  472. # We don't actually need to ship any of those python scripts in rust-src anyway.
  473. find %{buildroot}%{rustlibdir}/src -type f -name '*.py' -exec rm -v '{}' '+'
  474. # FIXME: __os_install_post will strip the rlibs
  475. # -- should we find a way to preserve debuginfo?
  476. # Remove unwanted documentation files (we already package them)
  477. # Remove unwanted documentation files (we already package them)
  478. rm -f %{buildroot}%{_docdir}/%{name}/README.md
  479. rm -f %{buildroot}%{_docdir}/%{name}/COPYRIGHT
  480. rm -f %{buildroot}%{_docdir}/%{name}/LICENSE
  481. rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-APACHE
  482. rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-MIT
  483. rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-THIRD-PARTY
  484. rm -f %{buildroot}%{_docdir}/%{name}/*.old
  485. # Sanitize the HTML documentation
  486. find %{buildroot}%{_docdir}/%{name}/html -empty -delete
  487. find %{buildroot}%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+'
  488. # Create the path for crate-devel packages
  489. mkdir -p %{buildroot}%{_datadir}/cargo/registry
  490. # Cargo no longer builds its own documentation
  491. # https://github.com/rust-lang/cargo/pull/4904
  492. mkdir -p %{buildroot}%{_docdir}/cargo
  493. ln -sT ../rust/html/cargo/ %{buildroot}%{_docdir}/cargo/html
  494. %if %{without lldb}
  495. rm -f %{buildroot}%{_bindir}/rust-lldb
  496. rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py*
  497. rm -f %{buildroot}%{rustlibdir}/etc/lldb_commands
  498. %endif
  499. %if %{with bundled_llvm}
  500. rm -rf %{buildroot}/home
  501. %endif
  502. # We don't want Rust copies of LLVM tools (rust-lld, rust-llvm-dwp)
  503. rm -f %{buildroot}%{rustlibdir}/%{rust_triple}/bin/rust-ll*
  504. %check
  505. %if %{with test}
  506. %{?cmake_path:export PATH=%{cmake_path}:$PATH}
  507. %{?library_path:export LIBRARY_PATH="%{library_path}"}
  508. %{?rustflags:export RUSTFLAGS="%{rustflags}"}
  509. %if %{with clang}
  510. export CC=clang
  511. export CXX=clang++
  512. export LD=ld.lld
  513. export RUSTFLAGS="$RUSTFLAGS -C linker=ld.lld -C link-arg=-fuse-ld=lld"
  514. %endif
  515. # The results are not stable on koji, so mask errors and just log it.
  516. %{__python3} ./x.py test --no-fail-fast || :
  517. %{__python3} ./x.py test --no-fail-fast cargo || :
  518. %{__python3} ./x.py test --no-fail-fast clippy || :
  519. %{__python3} ./x.py test --no-fail-fast rls || :
  520. %{__python3} ./x.py test --no-fail-fast rustfmt || :
  521. %endif
  522. %files
  523. %license COPYRIGHT LICENSE-APACHE LICENSE-MIT
  524. #license src/libbacktrace/LICENSE-libbacktrace
  525. %doc README.md
  526. %{_bindir}/rustc
  527. %{_bindir}/rustdoc
  528. %{_libdir}/*.so
  529. %{_mandir}/man1/rustc.1*
  530. %{_mandir}/man1/rustdoc.1*
  531. %dir %{rustlibdir}
  532. %dir %{rustlibdir}/%{rust_triple}
  533. %dir %{rustlibdir}/%{rust_triple}/lib
  534. %{rustlibdir}/%{rust_triple}/lib/*.so
  535. %files std-static
  536. %dir %{rustlibdir}
  537. %dir %{rustlibdir}/%{rust_triple}
  538. %dir %{rustlibdir}/%{rust_triple}/lib
  539. %{rustlibdir}/%{rust_triple}/lib/*.rlib
  540. %files debugger-common
  541. %dir %{rustlibdir}
  542. %dir %{rustlibdir}/etc
  543. %{rustlibdir}/etc/rust_types.py*
  544. %files gdb
  545. %{_bindir}/rust-gdb
  546. %{rustlibdir}/etc/gdb_*.py*
  547. %exclude %{_bindir}/rust-gdbgui
  548. %if %with lldb
  549. %files lldb
  550. %{_bindir}/rust-lldb
  551. %{rustlibdir}/etc/lldb_*.py*
  552. %{rustlibdir}/etc/lldb_commands
  553. %endif
  554. %files doc
  555. %docdir %{_docdir}/%{name}
  556. %dir %{_docdir}/%{name}
  557. %dir %{_docdir}/%{name}/html
  558. %{_docdir}/%{name}/html/*/
  559. %{_docdir}/%{name}/html/*.html
  560. %{_docdir}/%{name}/html/*.css
  561. %{_docdir}/%{name}/html/*.js
  562. %{_docdir}/%{name}/html/*.png
  563. %{_docdir}/%{name}/html/*.svg
  564. %{_docdir}/%{name}/html/*.woff
  565. %license %{_docdir}/%{name}/html/*.txt
  566. %license %{_docdir}/%{name}/html/*.md
  567. %files -n cargo
  568. %license src/tools/cargo/LICENSE-APACHE src/tools/cargo/LICENSE-MIT src/tools/cargo/LICENSE-THIRD-PARTY
  569. %doc src/tools/cargo/README.md
  570. %{_bindir}/cargo
  571. %{_libexecdir}/cargo*
  572. %{_mandir}/man1/cargo*.1*
  573. %dir %{_sysconfdir}/bash_completion.d
  574. %{_sysconfdir}/bash_completion.d/cargo
  575. %dir %{_datadir}/zsh
  576. %dir %{_datadir}/zsh/site-functions
  577. %{_datadir}/zsh/site-functions/_cargo
  578. %dir %{_datadir}/cargo
  579. %dir %{_datadir}/cargo/registry
  580. %files -n cargo-doc
  581. %docdir %{_docdir}/cargo
  582. %dir %{_docdir}/cargo
  583. %{_docdir}/cargo/html
  584. %files -n rustfmt
  585. %{_bindir}/rustfmt
  586. %{_bindir}/cargo-fmt
  587. %doc src/tools/rustfmt/{README,CHANGELOG,Configurations}.md
  588. %license src/tools/rustfmt/LICENSE-{APACHE,MIT}
  589. %files -n rls
  590. %{_bindir}/rls
  591. %doc src/tools/rls/{README.md,COPYRIGHT,debugging.md}
  592. %license src/tools/rls/LICENSE-{APACHE,MIT}
  593. %files -n clippy
  594. %{_bindir}/cargo-clippy
  595. %{_bindir}/clippy-driver
  596. %doc src/tools/clippy/{README.md,CHANGELOG.md}
  597. %license src/tools/clippy/LICENSE*
  598. %files src
  599. %dir %{rustlibdir}
  600. %{rustlibdir}/src
  601. %files analysis
  602. %{_bindir}/rust-analyzer
  603. %{rustlibdir}/%{rust_triple}/analysis/
  604. %files miri
  605. %{_bindir}/miri
  606. %{_bindir}/cargo-miri
  607. %changelog
  608. * Tue Mar 30 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.51.0-1
  609. - new upstream release.
  610. * Sun Feb 21 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.50.0-1
  611. - new upstream release.
  612. * Wed Jan 27 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.49.0-1
  613. - new upstream release.
  614. * Sat Dec 12 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.48.0-1
  615. - new upstream release.
  616. * Fri Oct 16 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.47.0-1
  617. - new upstream release.
  618. * Thu Sep 24 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.46.0-1
  619. - new upstream release.
  620. * Thu Mar 26 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.42.0-1
  621. - new upstream release.
  622. - separated debuginfo.
  623. * Sun Dec 22 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.40.0-1
  624. - new upstream release.
  625. * Sat Sep 28 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.38.0-1
  626. - new upstream release.
  627. - erased "-preview" from the name of subpackages.
  628. * Wed Dec 05 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.30.1-1
  629. - new upstream release.
  630. - dropped Patch1.
  631. - added subpackages cargo, cargo-doc, rustformat-preview, rls-preview, clippy-preview and rust-analysis.
  632. * Fri Jan 05 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.23.0-1
  633. - Update to 1.23.0 (stable).
  634. * Tue Jan 02 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.23.0-0.beta1
  635. - initial build for Vine Linux.
  636. - Update to 1.23.0-beta.
  637. - built a bootstrap rpm.
  638. * Thu Nov 23 2017 Josh Stone <jistone@redhat.com> - 1.22.1-1
  639. - Update to 1.22.1.
  640. * Thu Oct 12 2017 Josh Stone <jistone@redhat.com> - 1.21.0-1
  641. - Update to 1.21.0.
  642. * Mon Sep 11 2017 Josh Stone <jistone@redhat.com> - 1.20.0-2
  643. - ABI fixes for ppc64 and s390x.
  644. * Thu Aug 31 2017 Josh Stone <jistone@redhat.com> - 1.20.0-1
  645. - Update to 1.20.0.
  646. - Add a rust-src subpackage.
  647. * Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.19.0-4
  648. - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
  649. * Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.19.0-3
  650. - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
  651. * Mon Jul 24 2017 Josh Stone <jistone@redhat.com> - 1.19.0-2
  652. - Use find-debuginfo.sh --keep-section .rustc
  653. * Thu Jul 20 2017 Josh Stone <jistone@redhat.com> - 1.19.0-1
  654. - Update to 1.19.0.
  655. * Thu Jun 08 2017 Josh Stone <jistone@redhat.com> - 1.18.0-1
  656. - Update to 1.18.0.
  657. * Mon May 08 2017 Josh Stone <jistone@redhat.com> - 1.17.0-2
  658. - Move shared libraries back to libdir and symlink in rustlib
  659. * Thu Apr 27 2017 Josh Stone <jistone@redhat.com> - 1.17.0-1
  660. - Update to 1.17.0.
  661. * Mon Mar 20 2017 Josh Stone <jistone@redhat.com> - 1.16.0-3
  662. - Make rust-lldb arch-specific to deal with lldb deps
  663. * Fri Mar 17 2017 Josh Stone <jistone@redhat.com> - 1.16.0-2
  664. - Limit rust-lldb arches
  665. * Thu Mar 16 2017 Josh Stone <jistone@redhat.com> - 1.16.0-1
  666. - Update to 1.16.0.
  667. - Use rustbuild instead of the old makefiles.
  668. - Update bootstrapping to include rust-std and cargo.
  669. - Add a rust-lldb subpackage.
  670. * Thu Feb 09 2017 Josh Stone <jistone@redhat.com> - 1.15.1-1
  671. - Update to 1.15.1.
  672. - Require rust-rpm-macros for new crate packaging.
  673. - Keep shared libraries under rustlib/, only debug-stripped.
  674. - Merge and clean up conditionals for epel7.
  675. * Fri Dec 23 2016 Josh Stone <jistone@redhat.com> - 1.14.0-2
  676. - Rebuild without bootstrap binaries.
  677. * Thu Dec 22 2016 Josh Stone <jistone@redhat.com> - 1.14.0-1
  678. - Update to 1.14.0.
  679. - Rewrite bootstrap logic to target specific arches.
  680. - Bootstrap ppc64, ppc64le, s390x. (thanks to Sinny Kumari for testing!)
  681. * Thu Nov 10 2016 Josh Stone <jistone@redhat.com> - 1.13.0-1
  682. - Update to 1.13.0.
  683. - Use hardening flags for linking.
  684. - Split the standard library into its own package
  685. - Centralize rustlib/ under /usr/lib/ for multilib integration.
  686. * Thu Oct 20 2016 Josh Stone <jistone@redhat.com> - 1.12.1-1
  687. - Update to 1.12.1.
  688. * Fri Oct 14 2016 Josh Stone <jistone@redhat.com> - 1.12.0-7
  689. - Rebuild with LLVM 3.9.
  690. - Add ncurses-devel for llvm-config's -ltinfo.
  691. * Thu Oct 13 2016 Josh Stone <jistone@redhat.com> - 1.12.0-6
  692. - Rebuild with llvm-static, preparing for 3.9
  693. * Fri Oct 07 2016 Josh Stone <jistone@redhat.com> - 1.12.0-5
  694. - Rebuild with fixed eu-strip (rhbz1380961)
  695. * Fri Oct 07 2016 Josh Stone <jistone@redhat.com> - 1.12.0-4
  696. - Rebuild without bootstrap binaries.
  697. * Thu Oct 06 2016 Josh Stone <jistone@redhat.com> - 1.12.0-3
  698. - Bootstrap aarch64.
  699. - Use jemalloc's MALLOC_CONF to work around #36944.
  700. - Apply pr36933 to really disable armv7hl NEON.
  701. * Sat Oct 01 2016 Josh Stone <jistone@redhat.com> - 1.12.0-2
  702. - Protect .rustc from rpm stripping.
  703. * Fri Sep 30 2016 Josh Stone <jistone@redhat.com> - 1.12.0-1
  704. - Update to 1.12.0.
  705. - Always use --local-rust-root, even for bootstrap binaries.
  706. - Remove the rebuild conditional - the build system now figures it out.
  707. - Let minidebuginfo do its thing, since metadata is no longer a note.
  708. - Let rust build its own compiler-rt builtins again.
  709. * Sat Sep 03 2016 Josh Stone <jistone@redhat.com> - 1.11.0-3
  710. - Rebuild without bootstrap binaries.
  711. * Fri Sep 02 2016 Josh Stone <jistone@redhat.com> - 1.11.0-2
  712. - Bootstrap armv7hl, with backported no-neon patch.
  713. * Wed Aug 24 2016 Josh Stone <jistone@redhat.com> - 1.11.0-1
  714. - Update to 1.11.0.
  715. - Drop the backported patches.
  716. - Patch get-stage0.py to trust existing bootstrap binaries.
  717. - Use libclang_rt.builtins from compiler-rt, dodging llvm-static issues.
  718. - Use --local-rust-root to make sure the right bootstrap is used.
  719. * Sat Aug 13 2016 Josh Stone <jistone@redhat.com> 1.10.0-4
  720. - Rebuild without bootstrap binaries.
  721. * Fri Aug 12 2016 Josh Stone <jistone@redhat.com> - 1.10.0-3
  722. - Initial import into Fedora (#1356907), bootstrapped
  723. - Format license text as suggested in review.
  724. - Note how the tests already run in parallel.
  725. - Undefine _include_minidebuginfo, because it duplicates ".note.rustc".
  726. - Don't let checks fail the whole build.
  727. - Note that -doc can't be noarch, as rpmdiff doesn't allow variations.
  728. * Tue Jul 26 2016 Josh Stone <jistone@redhat.com> - 1.10.0-2
  729. - Update -doc directory ownership, and mark its licenses.
  730. - Package and declare licenses for libbacktrace and hoedown.
  731. - Set bootstrap_base as a global.
  732. - Explicitly require python2.
  733. * Thu Jul 14 2016 Josh Stone <jistone@fedoraproject.org> - 1.10.0-1
  734. - Initial package, bootstrapped