glibc-vl.spec 67 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971
  1. %bcond_with gcc5
  2. %bcond_with systemd
  3. # To build compat32-glibc, pass "--target i686" to rpmbuild on x86_64.
  4. %if "%{_target_cpu}" != "%(arch)"
  5. %global _sourcedir %{_topdir}/SOURCES/glibc
  6. %define build_compat32 1
  7. %else
  8. %define build_compat32 0
  9. %endif
  10. %define glibcversion 2.41
  11. %define glibcsrcdir glibc-%{glibcversion}
  12. Summary: The GNU libc libraries
  13. Summary(ja): GNU libc ライブラリ
  14. Name: glibc
  15. Version: %{glibcversion}
  16. Release: 1%{?_dist_release}%{?with_systemd:.systemd}
  17. Group: system
  18. Vendor: Project Vine
  19. Distribution: Vine Linux
  20. # GPLv2+ is used in a bunch of programs, LGPLv2+ is used for libraries.
  21. # Things that are linked directly into dynamically linked programs
  22. # and shared libraries (e.g. crt files, lib*_nonshared.a) have an additional
  23. # exception which allows linking it into any kind of programs or shared
  24. # libraries without restrictions.
  25. License: LGPLv2+ and LGPLv2+ with exceptions and GPLv2+
  26. URL: http://www.gnu.org/software/glibc/
  27. Source0: https://ftp.gnu.org/gnu/glibc/%{glibcsrcdir}.tar.xz
  28. Source1: build-locale-archive.c
  29. Source4: nscd.conf
  30. Source7: nsswitch.conf.vine
  31. Source8: power6emul.c
  32. Source9: bench.mk
  33. Source10: glibc-bench-compare
  34. # A copy of localedata/SUPPORTED in the Source0 tarball. The
  35. # SUPPORTED file is used below to generate the list of locale
  36. # packages, using a Lua snippet.
  37. Source11: SUPPORTED
  38. Source12: wrap-find-debuginfo.sh
  39. Source1000: rpm-old-changelog.txt
  40. ######################################################################
  41. # Activate the wrapper script for debuginfo generation, by rewriting
  42. # the definition of __debug_install_post.
  43. %{lua:
  44. local wrapper = rpm.expand("%{SOURCE12}")
  45. local sysroot = rpm.expand("%{glibc_sysroot}")
  46. local original = rpm.expand("%{macrobody:__debug_install_post}")
  47. -- Strip leading newline. It confuses the macro redefinition.
  48. -- Avoid embedded newlines that confuse the macro definition.
  49. original = original:match("^%s*(.-)%s*$"):gsub("\\\n", "")
  50. rpm.define("__debug_install_post bash " .. wrapper
  51. .. " " .. sysroot .. " " .. original)
  52. }
  53. # The wrapper script relies on the fact that debugedit does not change
  54. # build IDs.
  55. %define _no_recompute_build_ids 1
  56. %undefine _unique_build_ids
  57. # patch from upstream
  58. Patch0: glibc-%{version}-20250601.patch
  59. # patches from Fedora
  60. Patch4: glibc-fedora-linux-tcsetattr.patch
  61. Patch8: glibc-fedora-manual-dircategory.patch
  62. Patch13: glibc-fedora-localedata-rh61908.patch
  63. # remove /bin from CS_PATH
  64. #Patch17: glibc-cs-path.patch
  65. Patch23: glibc-python3.patch
  66. Patch24: glibc-rh2359737-1.patch
  67. Patch25: glibc-rh2359737-2.patch
  68. Patch26: glibc-rh2359737-3.patch
  69. Patch27: glibc-rh2359737-4.patch
  70. Patch28: glibc-rh2359737-5.patch
  71. Patch29: glibc-rh2359737-6.patch
  72. Patch30: glibc-rh2359737-7.patch
  73. # patch for Vine
  74. Patch1000: glibc-fedora-locarchive.patch
  75. #Patch10001: glibc-2.18-vine-build-env.patch
  76. # security
  77. ### glibc.spec.in follows:
  78. %define run_glibc_tests 1
  79. %define auxarches athlon sparcv9v sparc64v alphaev6
  80. %if %{build_compat32}
  81. %define auxarches i686 i586 athlon sparcv9 alphaev6
  82. %endif
  83. %define xenarches i686 athlon
  84. %ifarch %{xenarches}
  85. %define buildxen 1
  86. %define xenpackage 0
  87. %else
  88. %define buildxen 0
  89. %define xenpackage 0
  90. %endif
  91. %ifarch ppc64
  92. %define buildpower6 1
  93. %else
  94. %define buildpower6 0
  95. %endif
  96. %define biarcharches %{ix86} x86_64 ppc ppc64 s390 s390x
  97. %global _enable_debug_packages 1
  98. %define debuginfocommonarches %{biarcharches} alpha alphaev6
  99. %define multiarcharches ppc ppc64 %{ix86} x86_64 %{sparc}
  100. # Remove -s to get verbose output.
  101. %define silentrules PARALLELMFLAGS=-s
  102. # Only some architectures have static PIE support.
  103. %define pie_arches %{ix86} x86_64
  104. # We need to run ldconfig manually because __brp_ldconfig assumes that
  105. # glibc itself is always installed in $RPM_BUILD_ROOT, but with sysroots
  106. # we may be installed into a subdirectory of that path. Therefore we
  107. # unset __brp_ldconfig and run ldconfig by hand with the sysroots path
  108. # passed to -r.
  109. %undefine __brp_ldconfig
  110. BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
  111. %if %{build_compat32}
  112. Requires: glibc >= %{version}-%{release}
  113. %else
  114. Requires: glibc-common = %{version}-%{release}
  115. Provides: ldconfig
  116. %endif
  117. Provides: rtld(GNU_HASH)
  118. Obsoletes: glibc-profile < 2.4
  119. # The dynamic linker supports DT_GNU_HASH
  120. # Require libgcc in case some program calls pthread_cancel in its %%post
  121. Requires(pre): basesystem, libgcc
  122. # This is for building auxiliary programs like memusage, nscd
  123. # For initial glibc bootstraps it can be commented out
  124. BuildRequires: gd-devel libpng-devel pkgconfig(zlib) texinfo
  125. BuildRequires: audit-libs-devel >= 1.1.3, sed >= 3.95, libcap-devel, gettext, nss-devel
  126. BuildRequires: python3-devel
  127. BuildRequires: bison
  128. BuildRequires: /bin/ps, /bin/kill, /bin/awk
  129. # This is to ensure that __frame_state_for is exported by glibc
  130. # will be compatible with egcs 1.x.y
  131. BuildRequires: gcc >= 3.2
  132. BuildRequires: dwz
  133. %define enablekernel 3.2
  134. Conflicts: kernel < %{enablekernel}
  135. %ifarch i386
  136. %define target_cpu i486
  137. %else
  138. %define target_cpu %{_target_cpu}
  139. %endif
  140. %define target %{_target_cpu}-vine-linux
  141. %ifarch %{arm}
  142. %define target %{_target_cpu}-vine-linuxeabi
  143. %endif
  144. %ifarch %{power64}
  145. %define target ppc64-vine-linux
  146. %endif
  147. %ifarch %{multiarcharches}
  148. # Need STT_IFUNC support
  149. %ifarch ppc ppc64
  150. BuildRequires: binutils >= 2.20.51.0.2
  151. Conflicts: binutils < 2.20.51.0.2
  152. %else
  153. BuildRequires: binutils >= 2.19.51.0.10
  154. Conflicts: binutils < 2.19.51.0.10
  155. %endif
  156. # Earlier releases have broken support for IRELATIVE relocations
  157. Conflicts: prelink < 0.4.2
  158. %else
  159. # Need AS_NEEDED directive
  160. # Need --hash-style=* support
  161. BuildRequires: binutils >= 2.17.50.0.2-5
  162. %endif
  163. BuildRequires: gcc >= 3.2.1-5
  164. %ifarch ppc s390 s390x
  165. BuildRequires: gcc >= 4.1.0-0.17
  166. %endif
  167. # The testsuite builds static C++ binaries that require a static
  168. # C++ runtime from libstdc++-static.
  169. BuildRequires: libstdc++-static
  170. BuildRequires: tzdata
  171. #define __find_provides %{SOURCE10}
  172. #define __find_requires %{SOURCE11}
  173. %define _filter_GLIBC_PRIVATE 1
  174. %description
  175. The glibc package contains standard libraries which are used by
  176. multiple programs on the system. In order to save disk space and
  177. memory, as well as to make upgrading easier, common system code is
  178. kept in one place and shared between programs. This particular package
  179. contains the most important sets of shared libraries: the standard C
  180. library and the standard math library. Without these two libraries, a
  181. Linux system will not function.
  182. %description -l ja
  183. glibc パッケージはシステム上の複数のプログラムで使われる標準ライブラリを
  184. ふくみます。ディスクスペースとメモリを節約したり、アップグレードを
  185. 用意にするために、共通のシステムコードは一つの場所におかれ、プログラム
  186. 間で共有されます。この部分的なパッケージはシェアドライブラリのかなり
  187. 重要なセットをふくみます: 標準 C ライブラリと標準数値ライブラリです。
  188. この二つのライブラリ抜きでは、Linux システムは機能しません。
  189. %if %{xenpackage}
  190. %package xen
  191. Summary: The GNU libc libraries (optimized for running under Xen)
  192. Group: system
  193. Requires: glibc = %{version}-%{release}, glibc-utils = %{version}-%{release}
  194. %description xen
  195. The standard glibc package is optimized for native kernels and does not
  196. perform as well under the Xen hypervisor. This package provides alternative
  197. library binaries that will be selected instead when running under Xen.
  198. Install glibc-xen if you might run your system under the Xen hypervisor.
  199. %endif
  200. %package devel
  201. Summary: Object files for development using standard C libraries.
  202. Summary(ja): 標準 C ライブラリで使われるオブジェクトファイル
  203. Group: programming
  204. Requires: %{name} = %{version}-%{release}
  205. %if %{build_compat32}
  206. Requires: glibc-devel >= %{version}-%{release}
  207. %else
  208. Requires(pre): glibc-headers
  209. Requires: glibc-headers = %{version}-%{release}
  210. %endif
  211. %description devel
  212. The glibc-devel package contains the object files necessary
  213. for developing programs which use the standard C libraries (which are
  214. used by nearly all programs). If you are developing programs which
  215. will use the standard C libraries, your system needs to have these
  216. standard object files available in order to create the
  217. executables.
  218. Install glibc-devel if you are going to develop programs which will
  219. use the standard C libraries.
  220. %description devel -l ja
  221. glibc-devel パッケージには (ほとんどすべてのプログラムで使われる)
  222. 標準 C ライブラリを使用したプログラムを開発するためのオブジェクトファイルが
  223. 含まれます。標準 C ライブラリを使用するプログラムを開発する場合には、
  224. これらオブジェクトファイルを使用して実行ファイルを作成できます。
  225. 標準 C ライブラリを使用するプログラムを開発するなら glibc-devel
  226. をインストールしてください。
  227. %package static
  228. Summary: C library static libraries for -static linking.
  229. Summary(ja): -static リンクのための静的 C ライブラリ
  230. Group: programming
  231. Requires: %{name}-devel = %{version}-%{release}
  232. %description static
  233. The glibc-static package contains the C library static libraries
  234. for -static linking. You don't need these, unless you link statically,
  235. which is highly discouraged.
  236. %description static -l ja
  237. glibc-static パッケージには -static リンクで使用する静的 C ライブラリが
  238. 入っています。
  239. 静的ライブラリが必要な場合でなければ、このパッケージをインストールする
  240. ことは避けて下さい。
  241. %package headers
  242. Summary: Header files for development using standard C libraries.
  243. Summary(ja): 標準 C ライブラリで使われるヘッダーファイル
  244. Group: programming
  245. Provides: %{name}-headers(%{_target_cpu})
  246. %ifarch x86_64
  247. # If both -m32 and -m64 is to be supported on AMD64, x86_64 glibc-headers
  248. # have to be installed, not i586 ones.
  249. Obsoletes: %{name}-headers < %{version}-%{release}
  250. %endif
  251. Requires(pre): kernel-headers
  252. Requires: kernel-headers >= 2.2.1, %{name} = %{version}-%{release}
  253. BuildRequires: kernel-headers >= 2.6.22
  254. %description headers
  255. The glibc-headers package contains the header files necessary
  256. for developing programs which use the standard C libraries (which are
  257. used by nearly all programs). If you are developing programs which
  258. will use the standard C libraries, your system needs to have these
  259. standard header files available in order to create the
  260. executables.
  261. Install glibc-headers if you are going to develop programs which will
  262. use the standard C libraries.
  263. %description headers -l ja
  264. glibc-headers パッケージには (ほとんどすべてのプログラムで使われる)
  265. 標準 C ライブラリを使用したプログラムを開発するためのヘッダーファイルが
  266. 含まれます。標準 C ライブラリを使用するプログラムを開発する場合には、
  267. これら標準ヘッダーファイルを使用して実行ファイルを作成できます。
  268. 標準 C ライブラリを使用するプログラムを開発するなら glibc-headers
  269. をインストールしてください。
  270. %package common
  271. Summary: Common binaries and locale data for glibc
  272. Summary(ja): glibc 用共通バイナリとロケールデータ
  273. Requires: %{name} = %{version}-%{release}
  274. Requires: tzdata >= 2003a
  275. Group: system
  276. %description common
  277. The glibc-common package includes common binaries for the GNU libc
  278. libraries, as well as national language (locale) support.
  279. This package include ja and en locale-archive.
  280. %description common -l ja
  281. glibc-common パッケージには GNU libc ライブラリ用の共用バイナリに
  282. 加えて、言語(ロケール)サポートや時間帯データベースが収められています。
  283. このパッケージには日本語と英語のみの locale-archive が含まれます。
  284. %package common-extra
  285. Summary: Extra Locale data for glibc
  286. Summary(ja): glibc 用ロケールデータ(日本語以外)
  287. Group: system
  288. Autoreq: false
  289. Requires(pre): %{name}-common = %{version}-%{release}
  290. %description common-extra
  291. The glibc-common-extra package includes national language (locale)
  292. support except for English and Japanese.
  293. %description common-extra -l ja
  294. glibc-common-extra パッケージには GNU libc ライブラリ用の英語と
  295. 日本語以外の言語(ロケール)が収められています。
  296. %package locale-source
  297. Summary: The sources for the locales of glibc
  298. Summary(ja): glibc 用ロケールデータのソース
  299. Group: system
  300. Requires: %{name} = %{version}-%{release}
  301. Requires: %{name}-common = %{version}-%{release}
  302. %description locale-source
  303. The sources for all locales provided in glibc. If you are building
  304. custom locales you will most likely use these sources as the basis
  305. for your new locale.
  306. %package -n nscd
  307. Summary: A Name Service Caching Daemon (nscd).
  308. Summary(ja): ネームサービスキャッシングデーモン (nscd)
  309. Group: system
  310. Requires: %{name} = %{version}-%{release}
  311. Requires: audit-libs >= 1.1.3
  312. Requires(pre): /usr/sbin/useradd, coreutils
  313. Requires(postun): /usr/sbin/userdel
  314. %if %{with systemd}
  315. Requires(post): systemd
  316. Requires(preun): systemd
  317. Requires(postun): systemd
  318. %else
  319. Requires(pre): /sbin/chkconfig
  320. %endif
  321. %description -n nscd
  322. Nscd caches name service lookups and can dramatically improve
  323. performance with NIS+, and may help with DNS as well.
  324. %description -n nscd -l ja
  325. nscd はネームサービス参照をキャッシュし、NIS+ のパフォーマンスを
  326. 劇的にに改善することができます。DNS のパフォーマンス向上にも同様に寄与します。
  327. %package utils
  328. Summary: Development utilities from GNU C library
  329. Summary(ja): GNU C ライブラリの開発ユーティリティ
  330. Group: programming,admin-tools
  331. Requires: %{name} = %{version}-%{release}
  332. %description utils
  333. The glibc-utils package contains memusage, a memory usage profiler,
  334. mtrace, a memory leak tracer and xtrace, a function call tracer
  335. which can be helpful during program debugging.
  336. If unsure if you need this, don't install this package.
  337. %description utils -l ja
  338. glibc-utils にはプログラムのデバッグに便利な以下のツールが収録されています:
  339. memusage (メモリ使用量プロファイラ)、mtrace (メモリリークトレーサ)、
  340. xtrace (関数呼出しトレーサ)。
  341. これらが必要かどうか分からない場合は、インストールする必要はありません。
  342. %if %{build_compat32}
  343. %package -n compat32-glibc
  344. Summary: The GNU libc libraries (32bit)
  345. Summary(ja): GNU libc ライブラリ (32ビット)
  346. Group: system,legacy
  347. %description -n compat32-glibc
  348. This package contains the GNU libc for 32bit.
  349. %description -n compat32-glibc -l ja
  350. このパッケージはGNU libcの32bit版を収録しています。
  351. %package -n compat32-glibc-devel
  352. Summary: Object files for development using standard C libraries (32bit).
  353. Summary(ja): 標準 C ライブラリで使われるオブジェクトファイル (32ビット)
  354. Group: programming,legacy
  355. Requires: compat32-glibc = %{version}-%{release}
  356. %description -n compat32-glibc-devel
  357. This package contains the 32bit version of development files for GNU libc.
  358. %description -n compat32-glibc-devel -l ja
  359. このパッケージはGNU libcを用いた開発に必要なファイルの32bit版を収録しています。
  360. %package -n compat32-glibc-static
  361. Summary: C library static libraries for -static linking (32bit).
  362. Summary(ja): -static リンクのための静的 C ライブラリ (32ビット)
  363. Group: programming,legacy
  364. Requires: compat32-glibc-devel = %{version}-%{release}
  365. %description -n compat32-glibc-static
  366. This package contains the 32bit version of static library for GNU libc.
  367. %description -n compat32-glibc-devel -l ja
  368. このパッケージはGNU libcの静的ライブラリの32bit版を収録しています。
  369. %endif
  370. %debug_package
  371. %prep
  372. %autosetup -n %{glibcsrcdir} -p1
  373. # Make benchmark scripts executable
  374. chmod +x benchtests/scripts/*.py scripts/pylint
  375. # Remove all files generated from patching.
  376. find . -type f -size 0 -o -name "*.orig" -exec rm -f {} \;
  377. # Ensure timestamps on configure files are current to prevent
  378. # regenerating them.
  379. touch `find . -name configure`
  380. # Ensure *-kw.h files are current to prevent regenerating them.
  381. touch locale/programs/*-kw.h
  382. # Verify that our copy of localedata/SUPPORTED matches the glibc
  383. # version.
  384. #
  385. # The separate file copy is used by the Lua parser above.
  386. # Patches or new upstream versions may change the list of locales,
  387. # which changes the set of langpacks we need to build. Verify the
  388. # differences then update the copy of SUPPORTED. This approach has
  389. # two purposes: (a) avoid spurious changes to the set of langpacks,
  390. # and (b) the Lua snippet can use a fully patched-up version
  391. # of the localedata/SUPPORTED file.
  392. diff -u %{SOURCE11} localedata/SUPPORTED
  393. cp -f %{SOURCE1000} ./
  394. %build
  395. # We build using the native system compilers.
  396. GCC=gcc
  397. GXX=g++
  398. # Propgate select compiler flags from redhat-rpm-config. These flags
  399. # are target-dependent, so we use only those which are specified in
  400. # redhat-rpm-config. We keep the -m32/-m32/-m64 flags to support
  401. # multilib builds.
  402. %{lua:
  403. -- Split the string argument into keys of an associate array.
  404. -- The values are set to true.
  405. local function string_to_array(s)
  406. local result = {}
  407. for e in string.gmatch(s, "%S+") do
  408. result[e] = true
  409. end
  410. return result
  411. end
  412. local inherit_flags = {}
  413. -- These flags are put into the CC and CXX arguments to configure.
  414. -- Alternate builds do not use the flags listed here, only the main build does.
  415. inherit_flags.cc_main = string_to_array [[
  416. -march=armv8-a+lse
  417. -march=armv8.1-a
  418. -march=haswell
  419. -march=i686
  420. -march=x86-64
  421. -march=x86-64-v2
  422. -march=x86-64-v3
  423. -march=x86-64-v4
  424. -march=z13
  425. -march=z14
  426. -march=z15
  427. -march=zEC12
  428. -mcpu=power10
  429. -mcpu=power8
  430. -mcpu=power9
  431. -mtune=generic
  432. -mtune=power10
  433. -mtune=power8
  434. -mtune=power9
  435. -mtune=z13
  436. -mtune=z14
  437. -mtune=z15
  438. -mtune=zEC12
  439. ]]
  440. -- Like inherit_flags_cc_main, but also used for alternate builds.
  441. inherit_flags.cc = string_to_array [[
  442. -m31
  443. -m32
  444. -m64
  445. ]]
  446. -- These flags are passed through CFLAGS and CXXFLAGS.
  447. inherit_flags.cflags = string_to_array [[
  448. -O2
  449. -O3
  450. -Wall
  451. -Wp,-D_GLIBCXX_ASSERTIONS
  452. -fasynchronous-unwind-tables
  453. -fno-omit-frame-pointer
  454. -fstack-clash-protection
  455. -funwind-tables
  456. -g
  457. -mbackchain
  458. -mbranch-protection=standard
  459. -mfpmath=sse
  460. -mno-omit-leaf-frame-pointer
  461. -msse2
  462. -mstackrealign
  463. -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
  464. ]]
  465. -- Iterate over the build_cflags RPM variable and emit a shell
  466. -- variable that contains the inherited flags of the indicated variant.
  467. local function shell_build_flags(variant)
  468. local result = {}
  469. local inherit = assert(inherit_flags[variant])
  470. for f in string.gmatch(rpm.expand("%build_cflags"), "%S+") do
  471. if inherit[f] then
  472. result[#result + 1] = f
  473. end
  474. end
  475. print("glibc_flags_" .. variant .. "=\"" .. table.concat(result, " ")
  476. .. "\"\n")
  477. end
  478. shell_build_flags('cc_main') -- Set $glibc_flags_cc_main.
  479. shell_build_flags('cc') -- Set $glibc_flags_cc.
  480. shell_build_flags('cflags') -- Set $glibc_flags_cflags.
  481. }
  482. # libc_nonshared.a cannot be built with the default hardening flags
  483. # because the glibc build system is incompatible with
  484. # -D_FORTIFY_SOURCE. The object files need to be marked as to be
  485. # skipped in annobin annotations. (The -specs= variant of activating
  486. # annobin does not work here because of flag ordering issues.)
  487. # See <https://bugzilla.redhat.com/show_bug.cgi?id=1668822>.
  488. BuildFlagsNonshared="-Wa,--generate-missing-build-notes=yes"
  489. # Special flag to enable annobin annotations for statically linked
  490. # assembler code. Needs to be passed to make; not preserved by
  491. # configure.
  492. %define glibc_make_flags_as ASFLAGS="-g -Wa,--generate-missing-build-notes=yes"
  493. %define glibc_make_flags %{glibc_make_flags_as}
  494. ##############################################################################
  495. # %%build - Generic options.
  496. ##############################################################################
  497. EnableKernel="--enable-kernel=%{enablekernel}"
  498. ##############################################################################
  499. # build()
  500. # Build glibc in `build-%{target}$1', passing the rest of the arguments
  501. # as CFLAGS to the build (not the same as configure CFLAGS). Several
  502. # global values are used to determine build flags, kernel version,
  503. # system tap support, etc.
  504. ##############################################################################
  505. build()
  506. {
  507. local builddir=$1
  508. shift
  509. rm -rf $builddir
  510. mkdir $builddir
  511. pushd $builddir
  512. ../configure "$@" \
  513. --prefix=%{_prefix} \
  514. --with-headers=%{_prefix}/include $EnableKernel \
  515. --with-nonshared-cflags="$BuildFlagsNonshared" \
  516. --enable-bind-now \
  517. --build=${build_triplet} \
  518. --enable-stack-protector=strong \
  519. %ifarch %{pie_arches}
  520. --enable-static-pie \
  521. %endif
  522. --enable-tunables \
  523. %if 0
  524. --enable-systemtap \
  525. %endif
  526. ${core_with_options} \
  527. %ifarch %{ix86}
  528. --disable-multi-arch \
  529. %endif
  530. %if %{without werror}
  531. --disable-werror \
  532. %endif
  533. --disable-profile \
  534. --without-selinux \
  535. --disable-crypt ||
  536. { cat config.log; false; }
  537. # We enable DT_GNU_HASH and DT_HASH for ld.so and DSOs to improve
  538. # compatibility with applications that expect DT_HASH e.g. Epic Games
  539. # Easy Anti-Cheat. This is temporary as applications move to
  540. # supporting only DT_GNU_HASH. This was initially enabled in Fedora
  541. # 37. We must use 'env' because it is the only way to pass, via the
  542. # environment, two variables that set the initial Makefile values for
  543. # LDFLAGS used to build shared objects and the dynamic loader.
  544. env LDFLAGS.so="-Wl,--hash-style=both" \
  545. LDFLAGS-rtld="-Wl,--hash-style=both" \
  546. %make_build -O -r %{glibc_make_flags}
  547. popd
  548. }
  549. %if 0
  550. # Build for the glibc32 package.
  551. build build-%{target}-32 \
  552. CC="gcc -m32" \
  553. CXX="g++ -m32" \
  554. CFLAGS="${glibc_flags_cflags/-m64/-m32}" \
  555. --host=i686-linux-gnu \
  556. #
  557. %endif
  558. # Default set of compiler options.
  559. build build-%{target} \
  560. CC="gcc $glibc_flags_cc $glibc_flags_cc_main" \
  561. CXX="g++ $glibc_flags_cc $glibc_flags_cc_main" \
  562. CFLAGS="$glibc_flags_cflags" \
  563. %if %{build_compat32}
  564. --build=i686-linux-gnu \
  565. --host=i686-linux-gnu \
  566. --target=i686-linux-gnu \
  567. %else
  568. %ifarch x86_64
  569. --enable-cet=permissive \
  570. %endif
  571. %endif
  572. %install
  573. rm -rf %{buildroot}
  574. # The built glibc is installed into a subdirectory of $RPM_BUILD_ROOT.
  575. # For a system glibc that subdirectory is "/" (the root of the filesystem).
  576. # This is called a sysroot (system root) and can be changed if we have a
  577. # distribution that supports multiple installed glibc versions.
  578. %define glibc_sysroot $RPM_BUILD_ROOT
  579. # Remove existing file lists.
  580. find . -type f -name '*.filelist' -exec rm -rf {} \;
  581. %if 0
  582. # Install for the glibc32 package.
  583. pushd build-%{target}-32
  584. %make_build install_root=%{glibc_sysroot} install
  585. popd
  586. pushd %{glibc_sysroot}
  587. rm -rf etc sbin var usr/bin usr/lib/gconv usr/libexec usr/sbin usr/share
  588. #rm -f lib/libnss_db* lib/libnss_hesiod* lib/libnsl* usr/lib/libnsl* usr/lib/libnss*
  589. #rm usr/lib/libc_malloc_debug.so
  590. strip -g usr/lib/*.o
  591. mv lib/{libmemusage,libpcprofile}.so usr/lib/
  592. popd
  593. %endif
  594. # Build and install:
  595. pushd build-%{target}
  596. %make_build install_root=%{glibc_sysroot} install
  597. %if !%{build_compat32}
  598. %make_build install_root=%{glibc_sysroot} \
  599. install-locale-files -C ../localedata objdir=`pwd`
  600. %else
  601. %{nil}
  602. %endif
  603. popd
  604. # Locale creation via install-locale-files does not group identical files
  605. # via hardlinks, so we must group them ourselves.
  606. %if !%{build_compat32}
  607. hardlink -c %{glibc_sysroot}/usr/lib/locale
  608. %endif
  609. # install_different:
  610. # Install all core libraries into DESTDIR/SUBDIR. Either the file is
  611. # installed as a copy or a symlink to the default install (if it is the
  612. # same). The path SUBDIR_UP is the prefix used to go from
  613. # DESTDIR/SUBDIR to the default installed libraries e.g.
  614. # ln -s SUBDIR_UP/foo.so DESTDIR/SUBDIR/foo.so.
  615. # When you call this function it is expected that you are in the root
  616. # of the build directory, and that the default build directory is:
  617. # "../build-%{target}" (relatively).
  618. # The primary use of this function is to install alternate runtimes
  619. # into the build directory and avoid duplicating this code for each
  620. # runtime.
  621. install_different()
  622. {
  623. local lib libbase libbaseso dlib
  624. local destdir="$1"
  625. local subdir="$2"
  626. local subdir_up="$3"
  627. local libdestdir="$destdir/$subdir"
  628. # All three arguments must be non-zero paths.
  629. if ! [ "$destdir" \
  630. -a "$subdir" \
  631. -a "$subdir_up" ]; then
  632. echo "One of the arguments to install_different was emtpy."
  633. exit 1
  634. fi
  635. # Create the destination directory and the multilib directory.
  636. mkdir -p "$destdir"
  637. mkdir -p "$libdestdir"
  638. # Walk all of the libraries we installed...
  639. for lib in libc math/libm nptl/libpthread rt/librt nptl_db/libthread_db
  640. do
  641. libbase=${lib#*/}
  642. # Take care that `libbaseso' has a * that needs expanding so
  643. # take care with quoting.
  644. libbaseso=$(basename %{glibc_sysroot}/%{_lib}/${libbase}-*.so)
  645. # Only install if different from default build library.
  646. if cmp -s ${lib}.so ../build-%{target}/${lib}.so; then
  647. ln -sf "$subdir_up"/$libbaseso $libdestdir/$libbaseso
  648. else
  649. cp -a ${lib}.so $libdestdir/$libbaseso
  650. fi
  651. dlib=$libdestdir/$(basename %{glibc_sysroot}/%{_lib}/${libbase}.so.*)
  652. ln -sf $libbaseso $dlib
  653. done
  654. }
  655. ##############################################################################
  656. # Remove the files we don't want to distribute
  657. ##############################################################################
  658. # Remove the libNoVersion files.
  659. # XXX: This looks like a bug in glibc that accidentally installed these
  660. # wrong files. We probably don't need this today.
  661. rm -f %{glibc_sysroot}/%{_libdir}/libNoVersion*
  662. rm -f %{glibc_sysroot}/%{_lib}/libNoVersion*
  663. # Remove the old nss modules.
  664. rm -f %{glibc_sysroot}/%{_lib}/libnss1-*
  665. rm -f %{glibc_sysroot}/%{_lib}/libnss-*.so.1
  666. # This statically linked binary is no longer necessary in a world where
  667. # the default Fedora install uses an initramfs, and further we have rpm-ostree
  668. # which captures the whole userspace FS tree.
  669. # Further, see https://github.com/projectatomic/rpm-ostree/pull/1173#issuecomment-355014583
  670. rm -f %{glibc_sysroot}/{usr/,}sbin/sln
  671. ######################################################################
  672. # Run ldconfig to create all the symbolic links we need
  673. ######################################################################
  674. # Note: This has to happen before creating /etc/ld.so.conf.
  675. mkdir -p %{glibc_sysroot}/var/cache/ldconfig
  676. truncate -s 0 %{glibc_sysroot}/var/cache/ldconfig/aux-cache
  677. # ldconfig is statically linked, so we can use the new version.
  678. %{glibc_sysroot}/sbin/ldconfig -N -r %{glibc_sysroot}
  679. ##############################################################################
  680. # Install info files
  681. ##############################################################################
  682. %ifnarch %{auxarches}
  683. %if %{with docs}
  684. # Move the info files if glibc installed them into the wrong location.
  685. if [ -d %{glibc_sysroot}%{_prefix}/info -a "%{_infodir}" != "%{_prefix}/info" ]; then
  686. mkdir -p %{glibc_sysroot}%{_infodir}
  687. mv -f %{glibc_sysroot}%{_prefix}/info/* %{glibc_sysroot}%{_infodir}
  688. rm -rf %{glibc_sysroot}%{_prefix}/info
  689. fi
  690. # Compress all of the info files.
  691. gzip -9nvf %{glibc_sysroot}%{_infodir}/libc*
  692. %else
  693. rm -f %{glibc_sysroot}%{_infodir}/dir
  694. rm -f %{glibc_sysroot}%{_infodir}/libc.info*
  695. %endif
  696. %else
  697. rm -f %{glibc_sysroot}%{_infodir}/dir
  698. rm -f %{glibc_sysroot}%{_infodir}/libc.info*
  699. %endif
  700. ##############################################################################
  701. # Create locale sub-package file lists
  702. ##############################################################################
  703. rm -f %{glibc_sysroot}/etc/localtime
  704. cp -f %{_datadir}/zoneinfo/Asia/Tokyo %{glibc_sysroot}/etc/localtime
  705. %ifnarch %{auxarches}
  706. olddir=`pwd`
  707. pushd %{glibc_sysroot}%{_prefix}/lib/locale
  708. rm -f locale-archive
  709. # Intentionally we do not pass --alias-file=, aliases will be added
  710. # by build-locale-archive.
  711. $olddir/build-%{target}/elf/ld.so \
  712. --library-path $olddir/build-%{target}/ \
  713. $olddir/build-%{target}/locale/localedef \
  714. --alias-file=$olddir/intl/locale.alias \
  715. --prefix %{glibc_sysroot} --add-to-archive \
  716. eo syr *_*
  717. # Setup the locale-archive template for use by glibc-all-langpacks.
  718. mv locale-archive{,-extra.tmpl}
  719. $olddir/build-%{target}/elf/ld.so \
  720. --library-path $olddir/build-%{target}/ \
  721. $olddir/build-%{target}/locale/localedef \
  722. --alias-file=$olddir/intl/locale.alias \
  723. --prefix %{glibc_sysroot} --add-to-archive \
  724. ja_JP* en_US*
  725. mv locale-archive{,.tmpl}
  726. cp -a locale-archive{.tmpl,-ja.tmpl}
  727. # Create the file lists for the language specific sub-packages:
  728. for i in eo syr tok *_*
  729. do
  730. lang=${i%%_*}
  731. # if [ ! -e langpack-${lang}.filelist ]; then
  732. # echo "%dir %{_prefix}/lib/locale" >> locales.filelist
  733. # fi
  734. echo "%dir %{_prefix}/lib/locale/$i" >> locales.filelist
  735. echo "%{_prefix}/lib/locale/$i/*" >> locales.filelist
  736. done
  737. popd
  738. pushd %{glibc_sysroot}%{_prefix}/share/locale
  739. for i in */LC_MESSAGES/libc.mo
  740. do
  741. locale=${i%%%%/*}
  742. lang=${locale%%%%_*}
  743. echo "%lang($lang) %{_prefix}/share/locale/${i}" \
  744. >> %{glibc_sysroot}%{_prefix}/lib/locale/locales.filelist
  745. done
  746. popd
  747. mv %{glibc_sysroot}%{_prefix}/lib/locale/*.filelist .
  748. %endif
  749. ##############################################################################
  750. # Install configuration files for services
  751. ##############################################################################
  752. install -p -m 644 %{SOURCE7} %{glibc_sysroot}/etc/nsswitch.conf
  753. %ifnarch %{auxarches}
  754. # This is for ncsd - in glibc 2.2
  755. install -m 644 nscd/nscd.conf %{glibc_sysroot}/etc
  756. %if %{with systemd}
  757. mkdir -p %{glibc_sysroot}%{_tmpfilesdir}
  758. install -m 644 %{SOURCE4} %{buildroot}%{_tmpfilesdir}
  759. mkdir -p %{glibc_sysroot}%{_unitdir}
  760. install -m 644 nscd/nscd.service %{glibc_sysroot}%{_unitdir}/
  761. %else
  762. mkdir -p %{glibc_sysroot}/etc/rc.d/init.d
  763. install -m 755 nscd/nscd.init %{glibc_sysroot}/etc/rc.d/init.d/nscd
  764. %endif
  765. %endif
  766. # Include ld.so.conf
  767. echo 'include ld.so.conf.d/*.conf' > %{glibc_sysroot}/etc/ld.so.conf
  768. truncate -s 0 %{glibc_sysroot}/etc/ld.so.cache
  769. chmod 644 %{glibc_sysroot}/etc/ld.so.conf
  770. mkdir -p %{glibc_sysroot}/etc/ld.so.conf.d
  771. %ifnarch %{auxarches}
  772. mkdir -p %{glibc_sysroot}/etc/sysconfig
  773. truncate -s 0 %{glibc_sysroot}/etc/sysconfig/nscd
  774. truncate -s 0 %{glibc_sysroot}/etc/gai.conf
  775. %endif
  776. # Include %{_libdir}/gconv/gconv-modules.cache
  777. truncate -s 0 %{glibc_sysroot}%{_libdir}/gconv/gconv-modules.cache
  778. chmod 644 %{glibc_sysroot}%{_libdir}/gconv/gconv-modules.cache
  779. # Remove any zoneinfo files; they are maintained by tzdata.
  780. rm -rf %{glibc_sysroot}%{_prefix}/share/zoneinfo
  781. # Make sure %config files have the same timestamp across multilib packages.
  782. #
  783. # XXX: Ideally ld.so.conf should have the timestamp of the spec file, but there
  784. # doesn't seem to be any macro to give us that. So we do the next best thing,
  785. # which is to at least keep the timestamp consistent. The choice of using
  786. # glibc_post_upgrade.c is arbitrary.
  787. touch -r %{SOURCE0} %{glibc_sysroot}/etc/ld.so.conf
  788. touch -r inet/etc.rpc %{glibc_sysroot}/etc/rpc
  789. %ifnarch %{auxarches}
  790. pushd build-%{target}
  791. gcc -Os -g -static -o build-locale-archive %{SOURCE1} \
  792. ../build-%{target}/locale/locarchive.o \
  793. ../build-%{target}/locale/md5.o \
  794. ../build-%{target}/locale/record-status.o \
  795. -I. -DDATADIR=\"%{_datadir}\" -DPREFIX=\"%{_prefix}\" \
  796. -L../build-%{target} \
  797. -B../build-%{target}/csu/ -lc -lc_nonshared
  798. install -m 700 build-locale-archive %{glibc_sysroot}%{_prefix}/sbin/build-locale-archive
  799. popd
  800. %endif
  801. # Lastly copy some additional documentation for the packages.
  802. rm -rf documentation
  803. mkdir documentation
  804. cp timezone/README documentation/README.timezone
  805. cp posix/gai.conf documentation/
  806. %if %{with benchtests}
  807. # Build benchmark binaries. Ignore the output of the benchmark runs.
  808. pushd build-%{target}
  809. make BENCH_DURATION=1 bench-build
  810. popd
  811. # Copy over benchmark binaries.
  812. mkdir -p %{glibc_sysroot}%{_prefix}/libexec/glibc-benchtests
  813. cp $(find build-%{target}/benchtests -type f -executable) %{glibc_sysroot}%{_prefix}/libexec/glibc-benchtests/
  814. # ... and the makefile.
  815. for b in %{SOURCE9} %{SOURCE10}; do
  816. cp $b %{glibc_sysroot}%{_prefix}/libexec/glibc-benchtests/
  817. done
  818. # .. and finally, the comparison scripts.
  819. cp benchtests/scripts/benchout.schema.json %{glibc_sysroot}%{_prefix}/libexec/glibc-benchtests/
  820. cp benchtests/scripts/compare_bench.py %{glibc_sysroot}%{_prefix}/libexec/glibc-benchtests/
  821. cp benchtests/scripts/import_bench.py %{glibc_sysroot}%{_prefix}/libexec/glibc-benchtests/
  822. cp benchtests/scripts/validate_benchout.py %{glibc_sysroot}%{_prefix}/libexec/glibc-benchtests/
  823. %endif
  824. # The #line directives gperf generates do not give the proper
  825. # file name relative to the build directory.
  826. pushd locale
  827. ln -sf programs/*.gperf .
  828. popd
  829. pushd iconv
  830. ln -sf ../locale/programs/charmap-kw.gperf .
  831. popd
  832. %if %{with docs}
  833. # Remove the `dir' info-heirarchy file which will be maintained
  834. # by the system as it adds info files to the install.
  835. rm -f %{glibc_sysroot}%{_infodir}/dir
  836. %endif
  837. %ifnarch %{auxarches}
  838. truncate -s 0 %{glibc_sysroot}/%{_prefix}/lib/locale/locale-archive
  839. mkdir -p %{glibc_sysroot}/var/{db,run}/nscd
  840. touch %{glibc_sysroot}/var/{db,run}/nscd/{passwd,group,hosts,services}
  841. touch %{glibc_sysroot}/var/run/nscd/{socket,nscd.pid}
  842. %endif
  843. # Move libpcprofile.so and libmemusage.so into the proper library directory.
  844. # They can be moved without any real consequences because users would not use
  845. # them directly.
  846. mkdir -p %{glibc_sysroot}%{_libdir}
  847. mv -f %{glibc_sysroot}/%{_lib}/lib{pcprofile,memusage}.so \
  848. %{glibc_sysroot}%{_libdir}
  849. # Strip all of the installed object files.
  850. strip -g %{glibc_sysroot}%{_libdir}/*.o
  851. %ifnarch %{auxarches}
  852. # The xtrace and memusage scripts have hard-coded paths that need to be
  853. # translated to a correct set of paths using the $LIB token which is
  854. # dynamically translated by ld.so as the default lib directory.
  855. for i in %{glibc_sysroot}%{_prefix}/bin/{xtrace,memusage}; do
  856. %if %{with bootstrap}
  857. test -w $i || continue
  858. %endif
  859. sed -e 's~=/%{_lib}/libpcprofile.so~=%{_libdir}/libpcprofile.so~' \
  860. -e 's~=/%{_lib}/libmemusage.so~=%{_libdir}/libmemusage.so~' \
  861. -e 's~='\''/\\\$LIB/libpcprofile.so~='\''%{_prefix}/\\$LIB/libpcprofile.so~' \
  862. -e 's~='\''/\\\$LIB/libmemusage.so~='\''%{_prefix}/\\$LIB/libmemusage.so~' \
  863. -i $i
  864. done
  865. %endif
  866. ##############################################################################
  867. # Build an empty libpthread_nonshared.a for compatiliby with applications
  868. # that have old linker scripts that reference this file. We ship this only
  869. # in compat-libpthread-nonshared sub-package.
  870. ##############################################################################
  871. ar cr %{glibc_sysroot}%{_prefix}/%{_lib}/libpthread_nonshared.a
  872. ##############################################################################
  873. # Beyond this point in the install process we no longer modify the set of
  874. # installed files, with one exception, for auxarches we cleanup the file list
  875. # at the end and remove files which we don't intend to ship. We need the file
  876. # list to effect a proper cleanup, and so it happens last.
  877. ##############################################################################
  878. ##############################################################################
  879. # Build the file lists used for describing the package and subpackages.
  880. ##############################################################################
  881. # There are several main file lists (and many more for
  882. # the langpack sub-packages (langpack-${lang}.filelist)):
  883. # * master.filelist
  884. # - Master file list from which all other lists are built.
  885. # * glibc.filelist
  886. # - Files for the glibc packages.
  887. # * common.filelist
  888. # - Flies for the common subpackage.
  889. # * utils.filelist
  890. # - Files for the utils subpackage.
  891. # * nscd.filelist
  892. # - Files for the nscd subpackage.
  893. # * devel.filelist
  894. # - Files for the devel subpackage.
  895. # * headers.filelist
  896. # - Files for the headers subpackage.
  897. # * static.filelist
  898. # - Files for the static subpackage.
  899. # * libnsl.filelist
  900. # - Files for the libnsl subpackage
  901. # * nss_db.filelist
  902. # * nss_hesiod.filelist
  903. # - File lists for nss_* NSS module subpackages.
  904. # * nss-devel.filelist
  905. # - File list with the .so symbolic links for NSS packages.
  906. # * compat-libpthread-nonshared.filelist.
  907. # - File list for compat-libpthread-nonshared subpackage.
  908. #
  909. # Create the main file lists. This way we can append to any one of them later
  910. # wihtout having to create it. Note these are removed at the start of the
  911. # install phase.
  912. touch master.filelist
  913. touch glibc.filelist
  914. touch common.filelist
  915. touch utils.filelist
  916. touch nscd.filelist
  917. touch devel.filelist
  918. touch headers.filelist
  919. touch static.filelist
  920. touch libnsl.filelist
  921. touch nss_db.filelist
  922. touch nss_hesiod.filelist
  923. touch nss-devel.filelist
  924. touch compat-libpthread-nonshared.filelist
  925. ###############################################################################
  926. # Master file list, excluding a few things.
  927. ###############################################################################
  928. {
  929. # List all files or links that we have created during install.
  930. # Files with 'etc' are configuration files, likewise 'gconv-modules'
  931. # and 'gconv-modules.cache' are caches, and we exclude them.
  932. find %{glibc_sysroot} \( -type f -o -type l \) \
  933. \( \
  934. -name etc -printf "%%%%config " -o \
  935. -name gconv-modules \
  936. -printf "%%%%verify(not md5 size mtime) %%%%config(noreplace) " -o \
  937. -name gconv-modules.cache \
  938. -printf "%%%%verify(not md5 size mtime) " \
  939. , \
  940. ! -path "*/lib/debug/*" -printf "/%%P\n" \)
  941. # List all directories with a %%dir prefix. We omit the info directory and
  942. # all directories in (and including) /usr/share/locale.
  943. find %{glibc_sysroot} -type d \
  944. \( -path '*%{_prefix}/share/locale' -prune -o \
  945. \( -path '*%{_prefix}/share/*' \
  946. %if %{with docs}
  947. ! -path '*%{_infodir}' -o \
  948. %endif
  949. -path "*%{_prefix}/include/*" \
  950. \) -printf "%%%%dir /%%P\n" \)
  951. } | {
  952. # Also remove the *.mo entries. We will add them to the
  953. # language specific sub-packages.
  954. # libnss_ files go into subpackages related to NSS modules.
  955. # and .*/share/i18n/charmaps/.*), they go into the sub-package
  956. # "locale-source":
  957. sed -e '\,.*/share/locale/\([^/_]\+\).*/LC_MESSAGES/.*\.mo,d' \
  958. -e '\,.*/share/i18n/locales/.*,d' \
  959. -e '\,.*/share/i18n/charmaps/.*,d' \
  960. -e '\,.*/etc/\(localtime\|nsswitch.conf\|ld\.so\.conf\|ld\.so\.cache\|default\|rpc\|gai\.conf\),d' \
  961. -e '\,.*/%{_libdir}/lib\(pcprofile\|memusage\)\.so,d' \
  962. -e '\,.*/bin/\(memusage\|mtrace\|xtrace\|pcprofiledump\),d'
  963. } | sort > master.filelist
  964. # The master file list is now used by each subpackage to list their own
  965. # files. We go through each package and subpackage now and create their lists.
  966. # Each subpackage picks the files from the master list that they need.
  967. # The order of the subpackage list generation does not matter.
  968. # Make the master file list read-only after this point to avoid accidental
  969. # modification.
  970. chmod 0444 master.filelist
  971. ###############################################################################
  972. # glibc
  973. ###############################################################################
  974. # Add all files with the following exceptions:
  975. # - The info files '%{_infodir}/dir'
  976. # - The partial (lib*_p.a) static libraries, include files.
  977. # - The static files, objects, unversioned DSOs, and nscd.
  978. # - The bin, locale, some sbin, and share.
  979. # - The use of [^gi] is meant to exclude all files except glibc_post_upgrade,
  980. # and iconvconfig, which we want in the main packages.
  981. # - All the libnss files (we add back the ones we want later).
  982. # - All bench test binaries.
  983. # - The aux-cache, since it's handled specially in the files section.
  984. # - The build-locale-archive binary since it's in the common package.
  985. cat master.filelist \
  986. | grep -v \
  987. -e '%{_infodir}' \
  988. -e '%{_libdir}/lib.*_p.a' \
  989. -e '%{_prefix}/include' \
  990. -e '%{_libdir}/lib.*\.a' \
  991. -e '%{_libdir}/.*\.o' \
  992. -e '%{_libdir}/lib.*\.so' \
  993. -e 'nscd' \
  994. -e '%{_prefix}/bin' \
  995. -e '%{_prefix}/lib/locale' \
  996. -e '%{_prefix}/sbin/[^gi]' \
  997. -e '%{_prefix}/share' \
  998. -e '/var/db/Makefile' \
  999. -e '/libnss_.*\.so[0-9.]*$' \
  1000. -e '/libnsl' \
  1001. -e 'glibc-benchtests' \
  1002. -e 'aux-cache' \
  1003. -e 'build-locale-archive' \
  1004. -e '/sbin/ldconfig' \
  1005. > glibc.filelist
  1006. # Add specific files:
  1007. # - The nss_files, nss_compat, and nss_db files.
  1008. # - The libmemusage.so and libpcprofile.so used by utils.
  1009. for module in compat files db dns hesiod; do
  1010. cat master.filelist \
  1011. | grep -E \
  1012. -e "/libnss_$module(\.so\.[0-9.]+|-[0-9.]+\.so)$" \
  1013. >> glibc.filelist
  1014. done
  1015. grep -e "libmemusage.so" -e "libpcprofile.so" master.filelist >> glibc.filelist
  1016. ###############################################################################
  1017. # glibc-devel
  1018. ###############################################################################
  1019. %if %{with docs}
  1020. # Put the info files into the devel file list, but exclude the generated dir.
  1021. grep '%{_infodir}' master.filelist | grep -v '%{_infodir}/dir' > devel.filelist
  1022. %endif
  1023. # Put some static files into the devel package.
  1024. grep '%{_libdir}/lib.*\.a' master.filelist \
  1025. | grep '/lib\(\(c\|pthread\|nldbl\|mvec\)_nonshared\|g\|ieee\|mcheck\|pthread\|dl\|rt\|util\|anl\)\.a$' \
  1026. >> devel.filelist
  1027. # Put all of the object files and *.so (not the versioned ones) into the
  1028. # devel package.
  1029. grep '%{_libdir}/.*\.o' < master.filelist >> devel.filelist
  1030. grep '%{_libdir}/lib.*\.so' < master.filelist >> devel.filelist
  1031. # The exceptions are:
  1032. # - libmemusage.so and libpcprofile.so in glibc used by utils.
  1033. # - libnss_*.so which are in nss-devel.
  1034. sed -i -e '\,libmemusage.so,d' \
  1035. -e '\,libpcprofile.so,d' \
  1036. -e '\,/libnss_[a-z]*\.so$,d' \
  1037. devel.filelist
  1038. ###############################################################################
  1039. # glibc-headers
  1040. ###############################################################################
  1041. # The glibc-headers package includes only common files which are identical
  1042. # across all multilib packages. We must keep gnu/stubs.h and gnu/lib-names.h
  1043. # in the glibc-headers package, but the -32, -64, -64-v1, and -64-v2 versions
  1044. # go into the development packages.
  1045. grep '%{_prefix}/include/gnu/stubs-.*\.h$' < master.filelist >> devel.filelist || :
  1046. grep '%{_prefix}/include/gnu/lib-names-.*\.h$' < master.filelist >> devel.filelist || :
  1047. # Put the include files into headers file list.
  1048. grep '%{_prefix}/include' < master.filelist \
  1049. | egrep -v '%{_prefix}/include/gnu/stubs-.*\.h$' \
  1050. | egrep -v '%{_prefix}/include/gnu/lib-names-.*\.h$' \
  1051. > headers.filelist
  1052. ###############################################################################
  1053. # glibc-static
  1054. ###############################################################################
  1055. # Put the rest of the static files into the static package.
  1056. grep '%{_libdir}/lib.*\.a' < master.filelist \
  1057. | grep -v '/lib\(\(c\|pthread\|nldbl\|mvec\)_nonshared\|g\|ieee\|mcheck\|pthread\|dl\|rt\|util\|anl\)\.a$' \
  1058. > static.filelist
  1059. ###############################################################################
  1060. # glibc-common
  1061. ###############################################################################
  1062. # All of the bin and certain sbin files go into the common package except
  1063. # glibc_post_upgrade.* and iconvconfig which need to go in glibc. Likewise
  1064. # nscd is excluded because it goes in nscd.
  1065. grep '%{_prefix}/bin' master.filelist >> common.filelist
  1066. grep '%{_prefix}/sbin/[^gi]' master.filelist \
  1067. | grep -v 'nscd' >> common.filelist
  1068. # All of the files under share go into the common package since they should be
  1069. # multilib-independent.
  1070. # Exceptions:
  1071. # - The actual share directory, not owned by us.
  1072. # - The info files which go in devel, and the info directory.
  1073. grep '%{_prefix}/share' master.filelist \
  1074. | grep -v \
  1075. -e '%{_prefix}/share/info/libc.info.*' \
  1076. -e '%%dir %{_prefix}/share/info' \
  1077. -e '%%dir %{_prefix}/share' \
  1078. >> common.filelist
  1079. %ifnarch %{auxarches}
  1080. # Add the binary to build locales to the common subpackage.
  1081. #echo '%{_prefix}/sbin/build-locale-archive' >> common.filelist
  1082. grep -e "/en_US/" -e "/ja_JP" -e "/ja/" locales.filelist >> common.filelist
  1083. grep -v -e "/en_US/" -e "/ja_JP" -e "/ja/" locales.filelist >> common-extra.filelist
  1084. %endif
  1085. ###############################################################################
  1086. # nscd
  1087. ###############################################################################
  1088. # The nscd binary must go into the nscd subpackage.
  1089. echo '%{_prefix}/sbin/nscd' > nscd.filelist
  1090. ###############################################################################
  1091. # glibc-utils
  1092. ###############################################################################
  1093. # Add the utils scripts and programs to the utils subpackage.
  1094. cat > utils.filelist <<EOF
  1095. %if %{without bootstrap}
  1096. %{_prefix}/bin/memusage
  1097. %{_prefix}/bin/memusagestat
  1098. %endif
  1099. %{_prefix}/bin/mtrace
  1100. %{_prefix}/bin/pcprofiledump
  1101. %{_prefix}/bin/xtrace
  1102. EOF
  1103. ###############################################################################
  1104. # nss_db, nss_hesiod
  1105. ###############################################################################
  1106. # Move the NSS-related files to the NSS subpackages. Be careful not
  1107. # to pick up .debug files, and the -devel symbolic links.
  1108. for module in db hesiod; do
  1109. grep -E "/libnss_$module(\.so\.[0-9.]+|-[0-9.]+\.so)$" \
  1110. master.filelist > nss_$module.filelist
  1111. done
  1112. ###############################################################################
  1113. # nss-devel
  1114. ###############################################################################
  1115. # Symlinks go into the nss-devel package (instead of the main devel
  1116. # package).
  1117. grep '/libnss_[a-z]*\.so$' master.filelist > nss-devel.filelist
  1118. grep '/libnss_[a-z]*\.so$' master.filelist >> devel.filelist
  1119. ###############################################################################
  1120. # libnsl
  1121. ###############################################################################
  1122. # Prepare the libnsl-related file lists.
  1123. grep -E '/libnsl\.so\.[0-9]+$' master.filelist > libnsl.filelist
  1124. test $(wc -l < libnsl.filelist) -eq 1
  1125. ###############################################################################
  1126. # glibc-benchtests
  1127. ###############################################################################
  1128. %if %{with benchtests}
  1129. # List of benchmarks.
  1130. find build-%{target}/benchtests -type f -executable | while read b; do
  1131. echo "%{_prefix}/libexec/glibc-benchtests/$(basename $b)"
  1132. done >> benchtests.filelist
  1133. # ... and the makefile.
  1134. for b in %{SOURCE9} %{SOURCE10}; do
  1135. echo "%{_prefix}/libexec/glibc-benchtests/$(basename $b)" >> benchtests.filelist
  1136. done
  1137. # ... and finally, the comparison scripts.
  1138. echo "%{_prefix}/libexec/glibc-benchtests/benchout.schema.json" >> benchtests.filelist
  1139. echo "%{_prefix}/libexec/glibc-benchtests/compare_bench.py*" >> benchtests.filelist
  1140. echo "%{_prefix}/libexec/glibc-benchtests/import_bench.py*" >> benchtests.filelist
  1141. echo "%{_prefix}/libexec/glibc-benchtests/validate_benchout.py*" >> benchtests.filelist
  1142. %endif
  1143. ###############################################################################
  1144. # compat-libpthread-nonshared
  1145. ###############################################################################
  1146. echo "%{_libdir}/libpthread_nonshared.a" >> compat-libpthread-nonshared.filelist
  1147. %if %{build_compat32}
  1148. ###############################################################################
  1149. # compat32-glibc
  1150. ###############################################################################
  1151. cat glibc.filelist \
  1152. | grep \
  1153. -e '/lib/' \
  1154. -e '/libexec/' \
  1155. > compat32-glibc.filelist
  1156. cat devel.filelist \
  1157. | grep \
  1158. -e '/lib/' \
  1159. -e '/include/' \
  1160. > compat32-devel.filelist
  1161. cat static.filelist \
  1162. | grep \
  1163. -e '/lib/' \
  1164. > compat32-static.filelist
  1165. rm -rf %{glibc_sysroot}/{etc,lib64,sbin,var}
  1166. rm -rf %{glibc_sysroot}/usr/{bin,lib64,sbin,share}
  1167. rm -f %{glibc_sysroot}/usr/include/gnu/{lib-names,libc-version,stubs}.h
  1168. find %{glibc_sysroot}/usr/include -type f | grep -v /gnu/ | xargs rm -f
  1169. %endif
  1170. %check
  1171. %if %{with testsuite}
  1172. # Run the glibc tests. If any tests fail to build we exit %check with
  1173. # an error, otherwise we print the test failure list and the failed
  1174. # test output and continue. Write to standard error to avoid
  1175. # synchronization issues with make and shell tracing output if
  1176. # standard output and standard error are different pipes.
  1177. run_tests () {
  1178. # This hides a test suite build failure, which should be fatal. We
  1179. # check "Summary of test results:" below to verify that all tests
  1180. # were built and run.
  1181. make %{?_smp_mflags} -O check |& tee rpmbuild.check.log >&2
  1182. test -n tests.sum
  1183. if ! grep -q '^Summary of test results:$' rpmbuild.check.log ; then
  1184. echo "FAIL: test suite build of target: $(basename "$(pwd)")" >& 2
  1185. exit 1
  1186. fi
  1187. set +x
  1188. grep -v ^PASS: tests.sum > rpmbuild.tests.sum.not-passing || true
  1189. if test -n rpmbuild.tests.sum.not-passing ; then
  1190. echo ===================FAILED TESTS===================== >&2
  1191. echo "Target: $(basename "$(pwd)")" >& 2
  1192. cat rpmbuild.tests.sum.not-passing >&2
  1193. while read failed_code failed_test ; do
  1194. for suffix in out test-result ; do
  1195. if test -e "$failed_test.$suffix"; then
  1196. echo >&2
  1197. echo "=====$failed_code $failed_test.$suffix=====" >&2
  1198. cat -- "$failed_test.$suffix" >&2
  1199. echo >&2
  1200. fi
  1201. done
  1202. done <rpmbuild.tests.sum.not-passing
  1203. fi
  1204. # Unconditonally dump differences in the system call list.
  1205. echo "* System call consistency checks:" >&2
  1206. cat misc/tst-syscall-list.out >&2
  1207. set -x
  1208. }
  1209. # Increase timeouts
  1210. export TIMEOUTFACTOR=16
  1211. parent=$$
  1212. echo ====================TESTING=========================
  1213. # Default libraries.
  1214. pushd build-%{target}
  1215. run_tests
  1216. popd
  1217. echo ====================TESTING END=====================
  1218. PLTCMD='/^Relocation section .*\(\.rela\?\.plt\|\.rela\.IA_64\.pltoff\)/,/^$/p'
  1219. echo ====================PLT RELOCS LD.SO================
  1220. readelf -Wr %{glibc_sysroot}/%{_lib}/ld-*.so | sed -n -e "$PLTCMD"
  1221. echo ====================PLT RELOCS LIBC.SO==============
  1222. readelf -Wr %{glibc_sysroot}/%{_lib}/libc-*.so | sed -n -e "$PLTCMD"
  1223. echo ====================PLT RELOCS END==================
  1224. # Finally, check if valgrind runs with the new glibc.
  1225. # We want to fail building if valgrind is not able to run with this glibc so
  1226. # that we can then coordinate with valgrind to get it fixed before we update
  1227. # glibc.
  1228. pushd build-%{target}
  1229. # Show the auxiliary vector as seen by the new library
  1230. # (even if we do not perform the valgrind test).
  1231. LD_SHOW_AUXV=1 elf/ld.so --library-path .:elf:nptl:dlfcn /bin/true
  1232. %if %{with valgrind}
  1233. elf/ld.so --library-path .:elf:nptl:dlfcn \
  1234. /usr/bin/valgrind --error-exitcode=1 \
  1235. elf/ld.so --library-path .:elf:nptl:dlfcn /usr/bin/true
  1236. %endif
  1237. popd
  1238. %endif # %{run_glibc_tests}
  1239. ######################################################################
  1240. # File triggers to do ldconfig calls automatically (see rhbz#1380878)
  1241. ######################################################################
  1242. # File triggers for when libraries are added or removed in standard
  1243. # paths.
  1244. %transfiletriggerin common -P 2000000 -- /lib /usr/lib /lib64 /usr/lib64
  1245. /sbin/ldconfig
  1246. %end
  1247. %transfiletriggerpostun common -P 2000000 -- /lib /usr/lib /lib64 /usr/lib64
  1248. /sbin/ldconfig
  1249. %end
  1250. %pre -p <lua>
  1251. -- Check that the running kernel is new enough
  1252. required = '%{enablekernel}'
  1253. rel = posix.uname("%r")
  1254. if rpm.vercmp(rel, required) < 0 then
  1255. error("FATAL: kernel too old", 0)
  1256. end
  1257. %post -p <lua>
  1258. -- We use lua's posix.exec because there may be no shell that we can
  1259. -- run during glibc upgrade. We used to implement much of %%post as a
  1260. -- C program, but from an overall maintenance perspective the lua in
  1261. -- the spec file was simpler and safer given the operations required.
  1262. -- All lua code will be ignored by rpm-ostree; see:
  1263. -- https://github.com/projectatomic/rpm-ostree/pull/1869
  1264. -- If we add new lua actions to the %%post code we should coordinate
  1265. -- with rpm-ostree and ensure that their glibc install is functional.
  1266. function post_exec (program, ...)
  1267. local pid = posix.fork ()
  1268. if pid == 0 then
  1269. assert (posix.exec (program, ...))
  1270. elseif pid > 0 then
  1271. posix.wait (pid)
  1272. end
  1273. end
  1274. -- (1) Remove multilib libraries from previous installs.
  1275. -- In order to support in-place upgrades, we must immediately remove
  1276. -- obsolete platform directories after installing a new glibc
  1277. -- version. RPM only deletes files removed by updates near the end
  1278. -- of the transaction. If we did not remove the obsolete platform
  1279. -- directories here, they may be preferred by the dynamic linker
  1280. -- during the execution of subsequent RPM scriptlets, likely
  1281. -- resulting in process startup failures.
  1282. -- Full set of libraries glibc may install.
  1283. install_libs = { "anl", "BrokenLocale", "c", "dl", "m", "mvec",
  1284. "nss_compat", "nss_db", "nss_dns", "nss_files",
  1285. "nss_hesiod", "pthread", "resolv", "rt", "SegFault",
  1286. "thread_db", "util" }
  1287. -- We are going to remove these libraries. Generally speaking we remove
  1288. -- all core libraries in the multilib directory.
  1289. -- We employ a tight match where X.Y is in [2.0,9.9*], so we would
  1290. -- match "libc-2.0.so" and so on up to "libc-9.9*".
  1291. remove_regexps = {}
  1292. for i = 1, #install_libs do
  1293. -- Versioned install name.
  1294. remove_regexps[#remove_regexps + 1] = ("lib" .. install_libs[i]
  1295. .. "%%-[2-9]%%.[0-9]+%%.so$")
  1296. -- Unversioned install name.
  1297. remove_regexps[#remove_regexps + 1] = ("lib" .. install_libs[i]
  1298. .. "%%.so%%.[0-9]+$")
  1299. end
  1300. -- Two exceptions:
  1301. remove_regexps[#install_libs + 1] = "libthread_db%%-1%%.0%%.so"
  1302. remove_regexps[#install_libs + 2] = "libSegFault%%.so"
  1303. -- We are going to search these directories.
  1304. local remove_dirs = { "%{_libdir}/i686",
  1305. "%{_libdir}/i686/nosegneg",
  1306. "%{_libdir}/power6",
  1307. "%{_libdir}/power7",
  1308. "%{_libdir}/power8",
  1309. "%{_libdir}/power9" }
  1310. -- Add all the subdirectories of the glibc-hwcaps subdirectory.
  1311. repeat
  1312. local iter = posix.files("%{_libdir}/glibc-hwcaps")
  1313. if iter ~= nil then
  1314. for entry in iter do
  1315. if entry ~= "." and entry ~= ".." then
  1316. local path = "%{_libdir}/glibc-hwcaps/" .. entry
  1317. if posix.access(path .. "/.", "x") then
  1318. remove_dirs[#remove_dirs + 1] = path
  1319. end
  1320. end
  1321. end
  1322. end
  1323. until true
  1324. -- Walk all the directories with files we need to remove...
  1325. for _, rdir in ipairs (remove_dirs) do
  1326. if posix.access (rdir) then
  1327. -- If the directory exists we look at all the files...
  1328. local remove_files = posix.files (rdir)
  1329. for rfile in remove_files do
  1330. for _, rregexp in ipairs (remove_regexps) do
  1331. -- Does it match the regexp?
  1332. local dso = string.match (rfile, rregexp)
  1333. if (dso ~= nil) then
  1334. -- Removing file...
  1335. os.remove (rdir .. '/' .. rfile)
  1336. end
  1337. end
  1338. end
  1339. end
  1340. end
  1341. -- (2) Update /etc/ld.so.conf
  1342. -- Next we update /etc/ld.so.conf to ensure that it starts with
  1343. -- a literal "include ld.so.conf.d/*.conf".
  1344. local ldsoconf = "/etc/ld.so.conf"
  1345. local ldsoconf_tmp = "/etc/glibc_post_upgrade.ld.so.conf"
  1346. if posix.access (ldsoconf) then
  1347. -- We must have a "include ld.so.conf.d/*.conf" line.
  1348. local have_include = false
  1349. for line in io.lines (ldsoconf) do
  1350. -- This must match, and we don't ignore whitespace.
  1351. if string.match (line, "^include ld.so.conf.d/%%*%%.conf$") ~= nil then
  1352. have_include = true
  1353. end
  1354. end
  1355. if not have_include then
  1356. -- Insert "include ld.so.conf.d/*.conf" line at the start of the
  1357. -- file. We only support one of these post upgrades running at
  1358. -- a time (temporary file name is fixed).
  1359. local tmp_fd = io.open (ldsoconf_tmp, "w")
  1360. if tmp_fd ~= nil then
  1361. tmp_fd:write ("include ld.so.conf.d/*.conf\n")
  1362. for line in io.lines (ldsoconf) do
  1363. tmp_fd:write (line .. "\n")
  1364. end
  1365. tmp_fd:close ()
  1366. local res = os.rename (ldsoconf_tmp, ldsoconf)
  1367. if res == nil then
  1368. io.stdout:write ("Error: Unable to update configuration file (rename).\n")
  1369. end
  1370. else
  1371. io.stdout:write ("Error: Unable to update configuration file (open).\n")
  1372. end
  1373. end
  1374. end
  1375. -- (3) Rebuild ld.so.cache early.
  1376. -- If the format of the cache changes then we need to rebuild
  1377. -- the cache early to avoid any problems running binaries with
  1378. -- the new glibc.
  1379. -- Note: We use _prefix because Fedora's UsrMove says so.
  1380. post_exec ("/sbin/ldconfig")
  1381. -- (4) Update gconv modules cache.
  1382. -- If the /usr/lib/gconv/gconv-modules.cache exists, then update it
  1383. -- with the latest set of modules that were just installed.
  1384. -- We assume that the cache is in _libdir/gconv and called
  1385. -- "gconv-modules.cache".
  1386. local iconv_dir = "%{_libdir}/gconv"
  1387. local iconv_cache = iconv_dir .. "/gconv-modules.cache"
  1388. if (posix.utime (iconv_cache) == 0) then
  1389. post_exec ("%{_prefix}/sbin/iconvconfig",
  1390. "-o", iconv_cache,
  1391. "--nostdlib",
  1392. iconv_dir)
  1393. else
  1394. io.stdout:write ("Error: Missing " .. iconv_cache .. " file.\n")
  1395. end
  1396. %triggerin common -p <lua> -- glibc
  1397. if posix.stat("%{_prefix}/lib/locale/locale-archive.tmpl", "size") > 0 then
  1398. pid = posix.fork()
  1399. if pid == 0 then
  1400. posix.exec("%{_prefix}/sbin/build-locale-archive")
  1401. elseif pid > 0 then
  1402. posix.wait(pid)
  1403. end
  1404. end
  1405. %post common -p <lua>
  1406. if posix.access("/etc/ld.so.cache") then
  1407. if posix.stat("%{_prefix}/lib/locale/locale-archive.tmpl", "size") > 0 then
  1408. pid = posix.fork()
  1409. if pid == 0 then
  1410. posix.exec("%{_prefix}/sbin/build-locale-archive")
  1411. elseif pid > 0 then
  1412. posix.wait(pid)
  1413. end
  1414. end
  1415. end
  1416. %if %{without systemd}
  1417. %triggerin common -p <lua> -- tzdata
  1418. function update (filename, new_data)
  1419. local fd = io.open(filename)
  1420. if not fd then return end
  1421. local data = fd:read("*a")
  1422. fd:close()
  1423. if not data then return end
  1424. -- Don't update the file unnecessarily.
  1425. if data == new_data then return end
  1426. local tempfilename = filename .. ".tzupdate"
  1427. fd = io.open(tempfilename, "w")
  1428. if not fd then return end
  1429. fd:write(new_data)
  1430. fd:close()
  1431. posix.chmod(tempfilename, 0644)
  1432. if not os.rename(tempfilename, filename) then
  1433. os.remove(tempfilename)
  1434. end
  1435. end
  1436. fd = io.open("/etc/sysconfig/clock")
  1437. if not fd then return end
  1438. zonename = nil
  1439. for l in fd:lines() do
  1440. zone = string.match(l, "^[ \t]*ZONE[ \t]*=[ \t]*\"?([^ \t\n\"]*)");
  1441. if zone then
  1442. zonename = "/usr/share/zoneinfo/" .. zone
  1443. break
  1444. end
  1445. end
  1446. fd:close()
  1447. if not zonename then return end
  1448. fd = io.open(zonename)
  1449. if not fd then return end
  1450. data = fd:read("*a")
  1451. fd:close()
  1452. if not data then return end
  1453. update("/etc/localtime", data)
  1454. update("/var/spool/postfix/etc/localtime", data)
  1455. %endif
  1456. %post common-extra -p <lua>
  1457. -- cp -f /usr/lib/locale/locale-archive-extra.tmpl /usr/lib/locale/locale-archive.tmpl
  1458. if posix.access("/etc/ld.so.cache") then
  1459. if posix.stat("%{_prefix}/lib/locale/locale-archive.tmpl", "size") > 0 then
  1460. pid = posix.fork()
  1461. if pid == 0 then
  1462. posix.exec("%{_prefix}/sbin/build-locale-archive")
  1463. elseif pid > 0 then
  1464. posix.wait(pid)
  1465. end
  1466. end
  1467. end
  1468. %postun common-extra -p <lua>
  1469. posix.exec("cp -f /usr/lib/locale/locale-archive-ja.tmpl /usr/lib/locale/locale-archive.tmpl")
  1470. if posix.access("/etc/ld.so.cache") then
  1471. if posix.stat("%{_prefix}/lib/locale/locale-archive.tmpl", "size") > 0 then
  1472. pid = posix.fork()
  1473. if pid == 0 then
  1474. posix.exec("%{_prefix}/sbin/build-locale-archive")
  1475. elseif pid > 0 then
  1476. posix.wait(pid)
  1477. end
  1478. end
  1479. end
  1480. %triggerun -- common-extra
  1481. posix.exec("cp -f /usr/lib/locale/locale-archive-ja.tmpl /usr/lib/locale/locale-archive.tmpl")
  1482. if posix.access("/etc/ld.so.cache") then
  1483. if posix.stat("%{_prefix}/lib/locale/locale-archive.tmpl", "size") > 0 then
  1484. pid = posix.fork()
  1485. if pid == 0 then
  1486. posix.exec("%{_prefix}/sbin/build-locale-archive")
  1487. elseif pid > 0 then
  1488. posix.wait(pid)
  1489. end
  1490. end
  1491. end
  1492. %pre headers
  1493. # this used to be a link and it is causing nightmares now
  1494. if [ -L %{_prefix}/include/scsi ] ; then
  1495. rm -f %{_prefix}/include/scsi
  1496. fi
  1497. %pre -n nscd
  1498. getent group nscd >/dev/null || /usr/sbin/groupadd -g 28 -r nscd
  1499. getent passwd nscd >/dev/null ||
  1500. /usr/sbin/useradd -M -o -r -d / -s /sbin/nologin \
  1501. -c "NSCD Daemon" -u 28 -g nscd nscd
  1502. %post -n nscd
  1503. %if %{with systemd}
  1504. %systemd_post nscd.service
  1505. %else
  1506. /sbin/chkconfig --add nscd
  1507. %endif
  1508. %preun -n nscd
  1509. %if %{with systemd}
  1510. %systemd_preun nscd.service
  1511. %else
  1512. if [ $1 = 0 -o -x /bin/systemctl ] ; then
  1513. /sbin/service nscd stop > /dev/null 2>&1
  1514. /sbin/chkconfig --del nscd
  1515. fi
  1516. %endif
  1517. %postun -n nscd
  1518. if [ $1 = 0 ] ; then
  1519. /usr/sbin/userdel nscd > /dev/null 2>&1 || :
  1520. fi
  1521. %if %{with systemd}
  1522. %systemd_postun_with_restart nscd.service
  1523. %else
  1524. if [ "$1" -ge "1" ]; then
  1525. service nscd condrestart > /dev/null 2>&1 || :
  1526. fi
  1527. %endif
  1528. %if !%{build_compat32}
  1529. %ifnarch %{auxarches}
  1530. %files -f glibc.filelist
  1531. /sbin/ldconfig
  1532. /%{_lib}/libnsl.so.*
  1533. %dir %{_prefix}/%{_lib}/audit
  1534. %if %{with systemd}
  1535. %exclude /etc/localtime
  1536. %else
  1537. %verify(not md5 size mtime) %config(noreplace) /etc/localtime
  1538. %endif
  1539. %verify(not md5 size mtime) %config(noreplace) /etc/nsswitch.conf
  1540. %verify(not md5 size mtime) %config(noreplace) /etc/ld.so.conf
  1541. %verify(not md5 size mtime) %config(noreplace) /etc/rpc
  1542. %dir /etc/ld.so.conf.d
  1543. %dir %{_prefix}/libexec/getconf
  1544. %dir %{_prefix}/%{_lib}/gconv
  1545. %dir %{_localstatedir}/db
  1546. %{_localstatedir}/db/Makefile
  1547. %dir %attr(0700,root,root) /var/cache/ldconfig
  1548. %attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/cache/ldconfig/aux-cache
  1549. %attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/ld.so.cache
  1550. %attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/gai.conf
  1551. %doc rpm-old-changelog.txt
  1552. %doc README NEWS INSTALL elf/rtld-debugger-interface.txt
  1553. %license COPYING COPYING.LIB LICENSES
  1554. %files -f common.filelist common
  1555. %dir %{_datadir}/locale
  1556. %dir %{_prefix}/lib/locale
  1557. %dir %{_prefix}/lib/locale/C.utf8
  1558. %{_prefix}/lib/locale/C.utf8/*
  1559. %attr(0644,root,root) %verify(not md5 size mtime) %{_prefix}/lib/locale/locale-archive-ja.tmpl
  1560. %attr(0644,root,root) %verify(not md5 size mtime) %{_prefix}/lib/locale/locale-archive.tmpl
  1561. %attr(0644,root,root) %verify(not md5 size mtime mode) %ghost %config(missingok,noreplace) %{_prefix}/lib/locale/locale-archive
  1562. %dir %{_prefix}/share/locale
  1563. %dir %{_prefix}/share/locale/ja
  1564. %doc documentation/README.timezone
  1565. %doc documentation/gai.conf
  1566. %files common-extra -f common-extra.filelist
  1567. %attr(0644,root,root) %verify(not md5 size mtime) %{_prefix}/lib/locale/locale-archive-extra.tmpl
  1568. %files locale-source
  1569. %dir %{_prefix}/share/i18n/locales
  1570. %{_prefix}/share/i18n/locales/*
  1571. %dir %{_prefix}/share/i18n/charmaps
  1572. %{_prefix}/share/i18n/charmaps/*
  1573. %files -f devel.filelist devel
  1574. %files -f static.filelist static
  1575. %files -f headers.filelist headers
  1576. %files -f utils.filelist utils
  1577. %files -f nscd.filelist -n nscd
  1578. %config(noreplace) /etc/nscd.conf
  1579. %if %{with systemd}
  1580. %{_unitdir}/*
  1581. %{_tmpfilesdir}/*
  1582. %else
  1583. %config /etc/rc.d/init.d/nscd
  1584. %endif
  1585. %dir %attr(0755,root,root) /var/run/nscd
  1586. %dir %attr(0755,root,root) /var/db/nscd
  1587. %attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/nscd.pid
  1588. %attr(0666,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/socket
  1589. %attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/passwd
  1590. %attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/group
  1591. %attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/hosts
  1592. %attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/services
  1593. %attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/db/nscd/passwd
  1594. %attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/db/nscd/group
  1595. %attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/db/nscd/hosts
  1596. %attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/db/nscd/services
  1597. %ghost %config(missingok,noreplace) /etc/sysconfig/nscd
  1598. %endif
  1599. %else
  1600. %files -n compat32-glibc -f compat32-glibc.filelist
  1601. /%{_lib}/libnsl.so.*
  1602. %files -n compat32-glibc-devel -f compat32-devel.filelist
  1603. %exclude %{_prefix}/share
  1604. %files -n compat32-glibc-static -f compat32-static.filelist
  1605. %endif
  1606. %changelog
  1607. * Mon Jun 2 2025 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.41-1
  1608. - updated to 2.41.
  1609. - updated Patch0.
  1610. * Mon Nov 18 2024 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.40-1
  1611. - updated to 2.40.
  1612. - updated Patch0.
  1613. * Wed Jul 10 2024 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.39-3
  1614. - updated Patch0.
  1615. * Mon Jul 08 2024 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.39-2
  1616. - updated Patch0.
  1617. * Sat Jun 08 2024 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.39-1
  1618. - updated to 2.39.
  1619. * Fri Oct 06 2023 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.38-3
  1620. - updated Patch0.
  1621. * Thu Sep 28 2023 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.38-2
  1622. - updated Patch0.
  1623. * Thu Sep 21 2023 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.38-1
  1624. - updated to 2.38.
  1625. * Tue Dec 06 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.36-3
  1626. - updated Patch0.
  1627. - added "--hash-style=both".
  1628. * Fri Nov 18 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.36-2
  1629. - updated Patch0.
  1630. - dropped Patch7.
  1631. * Sat Sep 10 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.36-1
  1632. - updated to 2.36.
  1633. * Sat Jan 29 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.34-6
  1634. - updated Patch0.
  1635. * Sat Jan 22 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.34-5
  1636. - updated Patch0.
  1637. * Tue Nov 09 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.34-4
  1638. - updated Patch0.
  1639. * Tue Nov 02 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.34-3
  1640. - updated Patch0.
  1641. - dropped install-info scriptlets.
  1642. - built compat32-* on x86_64.
  1643. * Tue Aug 24 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.34-2
  1644. - imported Patch0 from upstream.
  1645. * Wed Aug 04 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.34-1
  1646. - updated to 2.34.
  1647. - dropped Patch0, 3 and 12.
  1648. - dropped Patch20000 and 20001: fixed in upstream.
  1649. * Thu Jun 03 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.33-4
  1650. - updated Patch0.
  1651. - imported Patch20000 and 20001 from upstream to fix CVE-2021-33574.
  1652. * Sat Apr 10 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.33-3
  1653. - updated Patch0.
  1654. - built with gcc-10.3.
  1655. * Mon Mar 08 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.33-2
  1656. - updated Patch0.
  1657. - added filetriggers.
  1658. * Tue Feb 09 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.33-1
  1659. - updated to 2.33.
  1660. - updated Patch0.
  1661. - dropped Patch1, 5, 7 and 14.
  1662. - updated Source11.
  1663. - updated Source1.
  1664. * Sat May 09 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.31-2
  1665. - updated Patch0.
  1666. - added systemd support (disabled as default).
  1667. - dropped /sbin/ldconfig from compat32.
  1668. * Thu Mar 19 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.31-1
  1669. - updated to 2.31.
  1670. - updated Patch0.
  1671. - dropped Patch28.
  1672. - imported Patch29 from rawhide.
  1673. - updated Patch5 and 23.
  1674. - updated Source11.
  1675. * Sun Sep 22 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.30-1
  1676. - updated to 2.30.
  1677. - updated Patch0.
  1678. - dropped Patch11, 24 and 25.
  1679. * Sun Jan 20 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.28-1
  1680. - updated to 2.28.
  1681. - dropped Source2, 3, 10 and 11.
  1682. - imported Source8-11 from rawhide.
  1683. - dropped Patch11-13.
  1684. - imported Patch1-28 from rawhide.
  1685. - dropped Patch10000.
  1686. - trimmed %%changelog: old logs are rpm-old-changelog.txt.
  1687. * Tue Jun 20 2017 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.23-5
  1688. - add patch20005 for fix CVE-2017-1000366
  1689. * Mon Aug 1 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.23-4
  1690. - added Patch20000-20004 to fix vulnerabilities.
  1691. - CVE-2016-1234
  1692. - CVE-2016-3075
  1693. - CVE-2016-3706
  1694. - CVE-2016-4429
  1695. * Sun Jun 26 2016 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.23-3
  1696. - rebuilt with gcc-5.4.0
  1697. * Tue May 24 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.23-2
  1698. - rebuilt with new binutils.
  1699. * Sat May 07 2016 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.23-1
  1700. - update to 2.23
  1701. - remove Patch14-18
  1702. - update SOURCE1 from fedora