【 spec 】
● -------------------------------------------------------------------------
@ 包的一些关键属性
Name: rcpyangmodels
Version: 1.19.0
Release: 1%{?dist} ● .wf32
Summary: Yang schemas and library to manipulate yang data conversions
● -------------------------------------------------------------------------
@ 源文件download地址
License: Nokia License
URL: https://gitlabe1.ext.net.nokia.com/RCP/rcpyangmodels
Source0: https://gitlabe1.ext.net.nokia.com/RCP/rcpyangmodels/repository/archive.tar.gz?ref=pq%{version}#/%{name}-%{version}.tar.gz
● -------------------------------------------------------------------------
@ 界定平台
ExcludeArch: aarch64
● -------------------------------------------------------------------------
@ 编译依赖
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
BuildRequires: boost-devel
BuildRequires: lcov
BuildRequires: python3
BuildRequires: pkgconfig(libyang)
BuildRequires: pkgconfig(libyang-cpp)
BuildRequires: pkgconfig(libgenapiloggermt)
BuildRequires: pkgconfig(gmock)
BuildRequires: pkgconfig(gtest)
BuildRequires: pkgconfig(gtest_main)
Requires: sysrepo
● -------------------------------------------------------------------------
@ 包名陈述
%description
%{name} contains YANG modules.
● -------------------------------------------------------------------------
%package libs
Summary: Library files for %{name}
%description libs
The %{name}-libs contains library to manipulate yang data conversions
between xml/json/binary formats that use %{name}.
%package devel
Summary: Development files for %{name}
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%description devel
The %{name}-devel package contains header files
and libraries for developing applications that use %{name}.
%prep
%setup
%build
./autogen.sh
%configure
%make_build
%check
%make_check
%install
%make_install
rm -f %{buildroot}%{_libdir}/libyangmodelsdk.*a
%files
%{_sysconfdir}/yangmodel
%{_bindir}/yangmodelsetup
%files devel
%{_libdir}/pkgconfig/libyangmodelsdk.pc
%{_includedir}/yangmodel
%{_libdir}/libyangmodelsdk.so
%files libs
%{_libdir}/libyangmodelsdk.so.*
编译触发步骤
libtool
https://www.xuebuyuan.com/1470147.html
libtool主要的一个作用是在编译大型软件的过程中解决了库的依赖问题;将繁重的库依赖关系的维护工作承担下来,从而释放了程序员的人力资源。
- libtool提供统一的接口,隐藏了不同平台间库的名称的差异等细节,生成一个抽象的后缀名为la高层库libxx.la(其实是个文本文件),并将该库对其它库的依赖关系,都写在该la的文件中。
- 该文件中的dependency_libs记录该库依赖的所有库(其中有些是以.la文件的形式加入的);
- libdir则指出了库的安装位置;
- library_names记录了共享库的名字;
- old_library记录了静态库的名字。
- libtool需要编译哪些库即可,libtool将处理库的依赖等细节。
- libtool只与后缀名为lo、la为的libtool文件打交道。
configure.ac中用到的宏
``` # AC_INIT([yangmodel], [1.0.0], [], [], []) AC_LANG([C++]) AC_CONFIG_AUX_DIR([build-aux])
AUTOMAKE GLOBAL OPTIONS
AM_INIT_AUTOMAKE([subdir-objects foreign 1.13 tar-pax]) AM_SILENT_RULES([no])
AM_PROG_AR AC_PROG_MKDIR_P
LT_PREREQ([2.4.6]) LT_INIT([disable-static pic-only]) LT_LANG([C++])
AC_CONFIG_MACRO_DIR([m4])
AX_BOOST_BASE([1.60], [], [AC_MSG_ERROR(Unable to detect suitable boost library)]) AX_PTHREAD
PKG_CHECK_MODULES([LIBYANG], [libyang libyang-cpp]) PKG_CHECK_MODULES([GTEST], [gtest_main]) PKG_CHECK_MODULES([GMOCK], [gmock])
code coverage related macro and variables
AX_CODE_COVERAGE
Compile flags
AX_COMPILER_FLAGS_CXXFLAGS([WARN_CXXFLAGS],[],[-pthread],[])
Doxgen
AC_CONFIG_FILES([Doxyfile])
DX_DOT_FEATURE(ON)
DX_INIT_DOXYGEN([tpl], [Doxyfile], [doxygen-doc])
需要修改的部分
AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES( Makefile libyangmodelsdk/Makefile yang/Makefile )
AC_OUTPUT
```
(1)以“#”号开始的行均为注释行。
(2)AC_PREREQ 宏声明本文要求的 autoconf 版本, 如本例中的版本 2.59。
(3)AC_INIT 宏用来定义软件的名称、版本等信息、作者的E-mail等。
(4)AM_INIT_AUTOMAKE是通过手动添加的, 它是automake所必备的宏, FULL-PACKAGE-NAME是软件名称,VERSION是软件版本号。
(5)AC_CONFIG_SCRDIR 宏用来侦测所指定的源码文件是否存在, 来确定源码目录的有效性.。此处为当前目录下main.c。
(6)AC_CONFIG_HEADER 宏用于生成config.h文件,以便 autoheader 命令使用。
(7)AC_PROG_CC用来指定编译器,如果不指定,默认gcc。
(8)AC_OUTPUT 用来设定 configure 所要产生的文件,如果是makefile,configure 会把它检查出来的结果带入makefile.in文件产生合适的makefile。使用 Automake 时,还需要一些其他的参数,这些额外的宏用aclocal工具产生。
(9)AC_CONFIG_FILES宏用于生成相应的Makefile文件。