# 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: 2%{?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 # 显式 out-of-source build:openEuler 24.03 LTS SP3 chroot 的 %cmake 宏执行 # in-source configure(写到 source 目录 glog-0.7.1),但 %cmake_build 期望 # %_vpath_builddir 子目录(%_target_platform=aarch64-openEuler-linux-gnu), # 二者不一致触发 "is not a directory" 错误(build_id=113742 %build 阶段失败)。 # 改用裸 cmake 命令显式管理 build dir,规避 chroot 宏不一致,且跨 chroot 兼容。 # 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} 宏保持一致)。 mkdir -p %{_target_platform} cd %{_target_platform} cmake .. \ -DCMAKE_INSTALL_PREFIX=%{_prefix} \ -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} make %{?_smp_mflags} %install cd %{_target_platform} make install DESTDIR=%{buildroot} %check # 运行 glog 自带的单元测试(依赖 gtest-devel 构建出的可执行文件) cd %{_target_platform} ctest %{?_smp_mflags} %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-2 - Replace %%cmake/%%cmake_build/%%cmake_install/%%ctest macros with explicit out-of-source cmake invocation to fix "is not a directory" %%build failure on openeuler-24.03_LTS_SP3-aarch64 (in-source configure vs. out-of-source build dir mismatch in chroot cmake-rpm-macros, build_id=113742) * Mon Oct 19 2026 openEuler Builder - 0.7.1-1 - Initial package of glog 0.7.1