rust-vl.spec 30 KB

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