glibc-vl.spec 67 KB

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