# topdir: glog-0.7.1 # Source0 解压后顶层目录名为 glog-0.7.1(GitHub tag archive 自动生成的目录名) # 与 %%autosetup -n %%{name}-%%{version} 一致(注释中 %% 转义避免 RPM 误展开宏) Name: glog Version: 0.7.1 Release: 1%{?dist} Summary: Google Logging Library (glog) License: BSD-3-Clause URL: https://github.com/google/glog Source0: https://github.com/google/glog/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz Group: Development/Libraries Packager: openEuler Builder # 构建工具链(取自 toolchain_openeuler-24.03_LTS_SP3-aarch64.json 清单交集) BuildRequires: cmake >= 3.22 BuildRequires: gcc-c++ BuildRequires: make # 运行/构建期依赖(来自 CMakeLists.txt 中的 option 与 find_package): # option(WITH_GFLAGS "Use gflags" ON) -> find_package(gflags 2.2.2) # option(WITH_GTEST "Use Google Test" ON) -> find_package(GTest) # find_package(Unwind) -> 由 glog 自带 FindUnwind.cmake 定位 libunwind # openEuler 官方源已提供:gflags-devel 2.2.2 / gtest-devel 1.14.0 / libunwind-devel 1.7.2 BuildRequires: gflags-devel >= 2.2.2 BuildRequires: gtest-devel BuildRequires: libunwind-devel %description Google Logging (glog) is a C++14 library that implements application-level logging. The library provides logging APIs based on C++-style streams and various helper macros (LOG, VLOG, CHECK, etc.). This package provides the shared library for glog. %package devel Summary: Development files for %{name} Group: Development/Libraries Packager: openEuler Builder Requires: %{name} = %{version}-%{release} Requires: gflags-devel >= 2.2.2 Requires: libunwind-devel %description devel Header files, development libraries, CMake integration files and pkg-config file for %{name}. %prep %autosetup -n %{name}-%{version} -p1 %build # CMake 选项说明(与 CMakeLists.txt option() 一致): # -DBUILD_SHARED_LIBS=ON : 默认 ON,构建 libglog.so.*(SOVERSION=2) # -DWITH_GFLAGS=ON : 启用 gflags 集成(openEuler 官方源已提供 2.2.2) # -DWITH_GTEST=ON : 启用 GTest(用于 %check 阶段的 ctest) # -DWITH_PKGCONFIG=ON : 安装 libglog.pc 到 %{_libdir}/pkgconfig/ # -DWITH_SYMBOLIZE=ON : 启用 symbolize 模块(默认 ON) # -DWITH_TLS=ON : 启用 Thread Local Storage 支持(默认 ON) # CMAKE_INSTALL_LIBDIR/INCLUDEDIR 显式传入,避免 GNUInstallDirs 在 aarch64 # 上推导出非标准路径(与 %files 中 %{_libdir}/%{_includedir} 宏保持一致)。 %cmake \ -DBUILD_SHARED_LIBS=ON \ -DWITH_GFLAGS=ON \ -DWITH_GTEST=ON \ -DWITH_PKGCONFIG=ON \ -DWITH_SYMBOLIZE=ON \ -DWITH_TLS=ON \ -DCMAKE_INSTALL_LIBDIR=%{_libdir} \ -DCMAKE_INSTALL_INCLUDEDIR=%{_includedir} %cmake_build %install %cmake_install %check # 运行 glog 自带的单元测试(依赖 gtest-devel 构建出的可执行文件) %ctest %files %license COPYING %doc README.rst ChangeLog AUTHORS %{_libdir}/libglog.so.* %files devel %{_includedir}/glog/ %{_libdir}/libglog.so %{_libdir}/cmake/glog/ %{_libdir}/pkgconfig/libglog.pc # glog 将 FindUnwind.cmake 等 find 模块安装到 %%{_datadir}/glog/cmake/ %{_datadir}/glog/ %changelog * Mon Oct 19 2026 openEuler Builder - 0.7.1-1 - Initial package of glog 0.7.1