glibc-vl.spec 67 KB

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