我一直试图将我的一个项目打包成一个RPM。只是寻找一点指导,因为我是新手。我正在尝试为我的集中式日志记录项目打包我需要的所有程序配置。我会列出我的spec文件..你能告诉我哪里出错了吗?
Summary: Next generation system logging daemon
Name: prog-syslog-ng
Version: 3.5.6
Release: 1
License: GPL
Group: System Environment/Daemons
Source0: eventlog_0.2.13.tar.gz
Source1: libdbi_0.9.0.tar.gz
Source2: freetds-patched.tar.gz
Source3: libdbi_drivers_0.9.0.tar.gz
Source4: syslog-ng_%{version}.tar.gz
Source5: syslog-ng.conf
Source6: syslog-ng.logrotate
BuildRequires: bison, flex, gcc-c++, gcc, glib2-devel, pkgconfig, openssl- devel, libnet-devel, libesmtp, hiredis, git, vim, net-tools,
Provides: syslog
现在是准备部分..
%prep
%setup -D -c -a 0
%setup -D -c -a 1
%setup -D -c -a 2
%setup -D -c -a 3
%setup -D -c -a 4
到构建部分......
%build
cd ./eventlog-0.2.13
%configure
make %{_smp_mflags}
cd ../libdbi-0.9.0
%configure
make %{_smp_mflags}
cd ../freetds-0.91.112
ODBCDIR=`odbc_config --prefix || true`
if test ! -r "$ODBCDIR/include/sql.h"; then
ODBCDIR=/usr/local
fi
if test ! -r "$ODBCDIR/include/sql.h"; then
ODBCDIR=/usr
fi
%configure --with-tdsver=7.1
make %{_smp_mflags}
cd ../libdbi-drivers-0.9.0
%configure ./configure --with-dbi-incdir=/usr/local/include/dbi --with-dbi-libdir=/usr/local/lib --with-freetds --with-freetds-incdir=%{_includedir} --with-freetds-libdir=%{_libdir}
# --with-dbi-incdir=%{buildroot}/usr/include/dbi --with-dbi-libdir=%{buildroot}/usr/lib64 --with-mssql --with-freetds
make %{_smp_mflags}
cd ../syslog-ng-3.5.6
GEOIP_LIBS=-lGeoIP; export GEOIP_LIBS; \
%configure \
--prefix=%{_prefix} \
--sysconfdir=%{_sysconfdir}/syslog-ng \
--localstatedir=%{_sharedstatedir}/syslog-ng \
--datadir=%{_datadir}/syslog-ng \
--with-module-dir=/%{_libdir}/syslog-ng \
--with-systemdsystemunitdir=%{_unitdir} \
--with-ivykis=system \
--with-libmongo-client=system \
--with-embedded-crypto \
--enable-man-pages \
--enable-ipv6 \
--enable-tcp-wrapper \
--enable-pcre \
--enable-spoof-source \
--enable-linux-caps \
--enable-sql \
--enable-json \
--enable-ssl \
--enable-smtp \
--enable-geoip \
--enable-shared \
--disable-static \
--enable-dynamic-linking \
--enable-systemd \
--enable-redis \
--disable-amqp \
--with-librabbitmq-client=no
# remove rpath
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
make %{_smp_mflags}
安装部分......
%install
cd ./eventlog-0.2.13
make DESTDIR=%{buildroot} install
# we build into /usr/lib,
# but we want the library (but not the devel stuff) in /lib
install -d -m 755 %{buildroot}/%{_lib}
pushd %{buildroot}%{_libdir}
mv libevtlog.so.* %{buildroot}/%{_lib}
ln -sf ../../%{_lib}/libevtlog.so.*.* libevtlog.so
cd %{_builddir}/prog-syslog-ng-3.5.6/libdbi-0.9.0
make DESTDIR=%{buildroot} install
#rm -f ${RPM_BUILD_ROOT}%{_libdir}/libdbi.a
#rm -f ${RPM_BUILD_ROOT}%{_libdir}/libdbi.la
cd ../freetds-0.91.112
make DESTDIR="$RPM_BUILD_ROOT" install
cd ../libdbi-drivers-0.9.0
make DESTDIR=%{buildroot} install
# Headers
install -d %{buildroot}%{_includedir}/dbi
for file in $(find drivers/ -type f -name \*.h)
do
install -m0644 ${file} %{buildroot}%{_includedir}/dbi/
done
# Docs
install -d %{buildroot}%{_docdir}/libdbi-drivers-0.9.0
for file in drivers/*/{TODO,AUTHORS,README}
do
driver=$(echo $file|awk -F/ '{print $2}')
newfile=$(basename $file)
install -m0644 $file %{buildroot}%{_docdir}/libdbi-drivers-0.9.0/$newfile.$driver
done
for pdf in drivers/*/dbd_*.pdf
do
install -m0644 $pdf %{buildroot}%{_docdir}/libdbi-drivers-0.9.0/
done
for dir in $(find drivers/ -type d -name dbd_\*)
do
cp -pr $dir %{buildroot}%{_docdir}/libdbi-drivers-0.9.0/
done
#rm -f ${RPM_BUILD_ROOT}%{_libdir}/dbd/*.a
#rm -f ${RPM_BUILD_ROOT}%{_libdir}/dbd/*.la
cd ../syslog-ng-3.5.6
make DESTDIR=%{buildroot} install
%{__install} -d -m 755 %{buildroot}%{_sysconfdir}/syslog-ng/conf.d
%{__install} -p -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/syslog-ng/syslog-ng.conf
%{__install} -d -m 755 %{buildroot}%{_sysconfdir}/logrotate.d
%{__install} -p -m 644 %{SOURCE6} %{buildroot}%{_sysconfdir}/logrotate.d/syslog
# create the local state dir
%{__install} -d -m 755 %{buildroot}%{_sharedstatedir}/syslog-ng
# install the main library header files
%{__install} -d -m 755 %{buildroot}%{_includedir}/syslog-ng
%{__install} -p -m 644 config.h %{buildroot}%{_includedir}/syslog-ng
%{__install} -p -m 644 lib/*.h %{buildroot}%{_includedir}/syslog-ng
# install vim files
%{__install} -d -m 755 %{buildroot}%{_datadir}/syslog-ng
%{__install} -p -m 644 contrib/syslog-ng.vim %{buildroot}%{_datadir}/syslog-ng
for vimver in 73 ; do
%{__install} -d -m 755 %{buildroot}%{_datadir}/vim/vim$vimver/syntax
cd %{buildroot}%{_datadir}/vim/vim$vimver/syntax
ln -s ../../../syslog-ng/syslog-ng.vim .
cd -
done
%{__install} -d -m 755 %{buildroot}/usr/lib64/syslog-ng
find %{buildroot} -name "*.la" -exec rm -f {} \;
# remove some extra testing related files
rm %{buildroot}/%{_libdir}/pkgconfig/syslog-ng-test.pc
rm %{buildroot}/%{_libdir}/syslog-ng/libtest/libsyslog-ng-test.a
[ -d "${RPM_BUILD_ROOT}/%{_prefix}/share/doc/syslog-ng-3.5.6" ] || ./install-sh -d "${RPM_BUILD_ROOT}/%{_prefix}/share/doc/syslog-ng-3.5.6"
./install-sh NEWS \
${RPM_BUILD_ROOT}/%{_prefix}/share/doc/syslog-ng-3.5.6/NEWS
./install-sh AUTHORS \
${RPM_BUILD_ROOT}/%{_prefix}/share/doc/syslog-ng-3.5.6/AUTHORS
./install-sh COPYING \
${RPM_BUILD_ROOT}/%{_prefix}/share/doc/syslog-ng-3.5.6/COPYING
现在文件部分......这有点乱......我知道..
%files
%defattr(-,root,root,-)
############ EVENTLOG FILES #########################
#%doc AUTHORS ChangeLog COPYING CREDITS NEWS README
%{_libdir}/libevtlog.so
%{_libdir}/libevtlog.a
#%{_libdir}/libevtlog.la
#%{libdir}/libevtlog.
#%doc doc/*
%{_libdir}/libevtlog.so
%{_libdir}/pkgconfig/eventlog.pc
%dir %{_includedir}/eventlog
%{_includedir}/eventlog
%{_libdir}/libevtlog.a
############ LIBDBI FILES #########################
#%doc AUTHORS
#%doc ChangeLog
#%doc COPYING
#%doc README
%{_libdir}/libdbi.*
#%doc TODO
%doc %{_defaultdocdir}/libdbi-0.9.0/programmers-guide.pdf
%doc %{_defaultdocdir}/libdbi-0.9.0/programmers-guide/
%doc %{_defaultdocdir}/libdbi-0.9.0/driver-guide.pdf
%doc %{_defaultdocdir}/libdbi-0.9.0/driver-guide/
%{_includedir}/dbi/
%{_libdir}/libdbi.so
%{_libdir}/pkgconfig/dbi.pc
############ FREETDS FILES #####################
#%doc AUTHORS BUGS COPYING* ChangeLog INSTALL NEWS README
%{_bindir}/*
%{_mandir}/man?/*
%{_libdir}/libct.so.*
%{_libdir}/libsybdb.so.*
%config %{_sysconfdir}/*
%{_libdir}/*.a
#%{_libdir}/*.la
%{_libdir}/*.so
%{_includedir}/*
%{_libdir}/dbd/libdbdfreetds.so
%doc %{_defaultdocdir}/freetds-0.91.112/userguide
%doc %{_defaultdocdir}/freetds-0.91.112/images
%doc %{_defaultdocdir}/freetds-0.91.112/reference
############## LIBDBI-DRIVERS FILES ###############
#%doc drivers/mysql/dbd_mysql/*.html
#%doc drivers/mysql/*.pdf
#%doc drivers/pgsql/dbd_pgsql/*.html
#%doc drivers/pgsql/*.pdf
#%doc drivers/sqlite3/dbd_sqlite3/*.html
#%doc drivers/sqlite3/*.pdf
%dir %{_libdir}/dbd/
#%files -n libdbi-dbd-mysql#
%{_libdir}/dbd/libdbdfreetds.so
%{_libdir}/dbd/libdbdfreetds.a
#%{_libdir}/dbd/libdbdfreetds.la
%{_includedir}/dbi/*.h
#%files -n libdbi-dbd-pgsql
#%{_libdir}/dbd/libdbdpgsql.*
#%files -n libdbi-dbd-sqlite
#%{_libdir}/dbd/libdbdsqlite3.*
################# SYSLOG-ng FILES #################
%{_sbindir}/syslog-ng
%{_sbindir}/syslog-ng-ctl
%{_bindir}/loggen
%{_mandir}/*
%docdir %{_prefix}/share/doc/syslog-ng-3.5.6
%{_prefix}/share/doc/syslog-ng-3.5.6/*
%config(noreplace) /etc/syslog-ng/syslog-ng.conf
#%ifnos aix5.2
#/etc/rc.d/init.d/syslog-ng
#%config(noreplace) /etc/logrotate.d/syslog-ng
#%endif
###################################################
%{_bindir}/pdbtool
%{_bindir}/update-patterndb
%{_includedir}/syslog-ng/*
# %{_includedir}/syslog-ng/filter/*
# %{_includedir}/syslog-ng/ivykis/*
# %{_includedir}/syslog-ng/libtest/*
# %{_includedir}/syslog-ng/logproto/*
# %{_includedir}/syslog-ng/parser/parser-expr-parser.h
# %{_includedir}/syslog-ng/parser/parser-expr.h
# %{_includedir}/syslog-ng/rewrite/rewrite-expr-parser.h
# %{_includedir}/syslog-ng/rewrite/rewrite-expr.h
# %{_includedir}/syslog-ng/rewrite/rewrite-set-tag.h
# %{_includedir}/syslog-ng/rewrite/rewrite-set.h
# %{_includedir}/syslog-ng/rewrite/rewrite-subst.h
# %{_includedir}/syslog-ng/template/templates.h
%{_libdir}/libsyslog-ng-3.5.6.so
%{_libdir}/libsyslog-ng.so
%{_libdir}/syslog-ng/*
/lib64/libevtlog.so.0
/lib64/libevtlog.so.0.0.0
%{_sbindir}/syslog-ng-ctl
%{_sbindir}/syslog-ng
%{_prefix}/%{_lib}/syslog-ng/*
%{_datadir}/include/scl/rewrite/cc-mask.conf
%{_datadir}/include/scl/syslogconf/README
%{_datadir}/include/scl/syslogconf/convert-syslogconf.awk
%{_datadir}/include/scl/syslogconf/plugin.conf
%{_datadir}/include/scl/system/plugin.conf
%{_datadir}/tools/cfg-grammar.y
%{_datadir}/tools/lex-rules.am
%{_datadir}/tools/merge-grammar.pl
%{_datadir}/xsd/patterndb-1.xsd
%{_datadir}/xsd/patterndb-2.xsd
%{_datadir}/xsd/patterndb-3.xsd
%{_datadir}/xsd/patterndb-4.xsd
%{_defaultdocdir}/libdbi-drivers-0.9.0/*
%{_defaultdocdir}/libdbi-drivers-0.9.0/dbd_db2/*
%{_defaultdocdir}/libdbi-drivers-0.9.0/dbd_ingres/*
%{_defaultdocdir}/libdbi-drivers-0.9.0/dbd_mysql/*
%{_defaultdocdir}/libdbi-drivers-0.9.0/dbd_msql/*
%{_defaultdocdir}/libdbi-drivers-0.9.0/dbd_oracle/*
%{_defaultdocdir}/libdbi-drivers-0.9.0/dbd_pgsql/*
%{_defaultdocdir}/libdbi-drivers-0.9.0/dbd_sqlite/*
%{_defaultdocdir}/libdbi-drivers-0.9.0/dbd_sqlite3/*
/usr/lib/syslog-ng/libafamqp.so
/usr/lib/syslog-ng/libaffile.so
/usr/lib/syslog-ng/libafmongodb.so
/usr/lib/syslog-ng/libafprog.so
/usr/lib/syslog-ng/libafsmtp.so
/usr/lib/syslog-ng/libafsocket-notls.so
/usr/lib/syslog-ng/libafsocket-tls.so
/usr/lib/syslog-ng/libafsocket.so
/usr/lib/syslog-ng/libafsql.so
/usr/lib/syslog-ng/libafstomp.so
/usr/lib/syslog-ng/libafuser.so
/usr/lib/syslog-ng/libbasicfuncs.so
/usr/lib/syslog-ng/libconfgen.so
/usr/lib/syslog-ng/libcryptofuncs.so
/usr/lib/syslog-ng/libcsvparser.so
/usr/lib/syslog-ng/libdbparser.so
/usr/lib/syslog-ng/libjson-plugin.so
/usr/lib/syslog-ng/liblinux-kmsg-format.so
/usr/lib/syslog-ng/libredis.so
/usr/lib/syslog-ng/libsyslog-ng-crypto.so
/usr/lib/syslog-ng/libsyslogformat.so
/usr/lib/syslog-ng/libsystem-source.so
/usr/lib/syslog-ng/libtfgeoip.so
/usr/lib64/pkgconfig/syslog-ng.pc
/usr/share/include/scl/pacct/plugin.conf
/usr/share/syslog-ng/syslog-ng.vim
/usr/share/vim/vim73/syntax/syslog-ng.vim
任何帮助或指导实际做这项工作将不胜感激。谢谢大家。
答案 0 :(得分:0)
这似乎是一个RedHat安装(syslog-ng部分派生自我的EPEL包)。除了FreeTDS和libdbi的FreeTDS驱动程序之外,所有内容都可以在发行版或EPEL中使用。所以我也建议只打包它(包FreeTDS并修改现有的libdbi-driver包以支持FreeTDS)。
在包管理器端,您需要安装syslog-ng-sql和libdbi-driver-freetds,这些将安装必要的依赖项。