New update for RPM build script from L.JR

This commit is contained in:
2020-08-26 20:38:33 +02:00
parent 13c50f10b8
commit 6ba4bce7f4
3 changed files with 63 additions and 33 deletions
+12 -20
View File
@@ -25,22 +25,21 @@ SRVDIR = $(ROOT)/usr/lib/systemd/system
# flag for SSL support
USE_SSL = 1
# flag for Kerberos support, please turn on if you need Kerberos
USE_KRB5 = 0
# flag for Kerberos support, please turn off if you don't need Kerberos
USE_KRB5 = 1
# flag for LDAP support, please turn on if you need LDAP
USE_LDAP = 0
# flag for LDAP support, please turn off if you don't need LDAP
USE_LDAP = 1
# flag for PAM support, please turn on if you need PAM
USE_PAM = 0
# flag for PAM support, please turn of if you don't need PAM
USE_PAM = 1
#############################################################
# Default compilation flags unless stated otherwise.
CFLAGS += -O3 -funroll-loops -fomit-frame-pointer -W -Wall -Wno-deprecated-declarations -Imxml
CFLAGS += -O3 -funroll-loops -fomit-frame-pointer -W -Wall -Wno-deprecated-declarations -Wno-unused-results -Imxml
CC = gcc
IFLAGS = -kr -nut -i3 -l110
EXECS = elog elogd elconv
OBJS = mxml.o crypt.o regex.o
GIT_REVISION = src/git-revision.h
@@ -92,29 +91,29 @@ endif
ifdef USE_SSL
ifneq ($(USE_SSL),0)
CFLAGS += -DHAVE_SSL
override CFLAGS += -DHAVE_SSL
LIBS += -lssl
endif
endif
ifdef USE_KRB5
ifneq ($(USE_KRB5),0)
CFLAGS += -DHAVE_KRB5
override CFLAGS += -DHAVE_KRB5
LIBS += -lkrb5
endif
endif
ifdef USE_LDAP
ifneq ($(USE_LDAP),0)
CFLAGS += -DHAVE_LDAP
override CFLAGS += -DHAVE_LDAP
LIBS += -lldap
endif
endif
ifdef USE_PAM
ifneq ($(USE_PAM),0)
CFLAGS += -DHAVE_PAM
LIBS += -lpam
override CFLAGS += -DHAVE_PAM
LIBS += -lpam -llber
endif
endif
@@ -160,13 +159,6 @@ debug: src/elogd.c auth.o $(OBJS)
%: src/%.c
$(CC) $(CFLAGS) -o $@ $< $(LIBS)
indent:
for src in src/*.c; do \
d2u $$src; \
indent $(IFLAGS) $$src; \
u2d $$src; \
done
ifeq ($(OSTYPE),CYGWIN_NT-5.1)
loc: locext.exe
for lang in resources/eloglang*; do \
+47 -6
View File
@@ -1,18 +1,43 @@
#!/bin/csh -x
# Usage: build [-n] <version> <release>
#!/bin/csh -v
# Build ELOG distribution
if ($#argv < 2) then
echo "Usage: build <version> <release>"
echo "Usage: build <version> <release> [-krb5] [-ldap] [-pam] [-ssl]"
exit
endif
set version = $argv[1]
set release = $argv[2]
set REV = "unknown"
set i = 0
set BUILDOPTS=""
foreach argument ($argv)
set i=`expr $i + 1`
if ($i <= 2) continue
switch ($argument)
case "-ldap":
set BUILDOPTS="$BUILDOPTS --with ldap"
breaksw
case "-pam":
set BUILDOPTS="$BUILDOPTS --with pam"
breaksw
case "-ssl":
set BUILDOPTS="$BUILDOPTS --with ssl"
breaksw
case "-krb5":
set BUILDOPTS="$BUILDOPTS --with krb5"
breaksw
endsw
end
if (`hostname` == 'elog01.psi.ch') then
set BUILDOPTS="$BUILDOPTS --with ldap --with pam --with ssl --with krb5"
endif
set dist = `rpm --eval %{\?dist}`
set dir = /tmp/elog-$version-$release
set archive = elog-$version-$release.tar.gz
set fdate = `date +"%a %b %d %Y"`
set fdate = `env LC_TIME=C date +"%a %b %d %Y"`
echo ${fdate}
@@ -59,6 +84,18 @@ cp -p ssl/* $dir/ssl
cp -rp themes/default/* $dir/themes/default
cp -p logbooks/demo/2001/011108a.log $dir/logbooks/demo/2001/
# add git version for RPM
which git >& /dev/null
if ( $status != 1 ) then
set REV=`git log -n 1 --pretty=format:"%ad - %h"`
endif
echo \#define GIT_REVISION \"$REV\" > $dir/src/git-revision.h
# generate correct specfile for current ver-rel
sed "s/__ELOGVER__/${version}/;s/__ELOGREL__/${release}/;s/__GIT__/$REV/" elog.spec.template > elog.spec
# add elog.spec in archive
cp -p elog.spec $dir/
# create elog-x.xx-y.tar.gz file
echo Creating archive...
tar -czf /tmp/$archive -C /tmp/ elog-$version-$release/
@@ -68,7 +105,8 @@ rm -Rf $dir
# transfer archive
echo Transfer archive...
mkdir -p ~/rpmbuild/SOURCES && cp /tmp/$archive ~/rpmbuild/SOURCES/elog-$version-$release.tar.gz
[ ! -d ~/rpmbuild/SOURCES ] && mkdir -p ~/rpmbuild/SOURCES
cp /tmp/$archive ~/rpmbuild/SOURCES/$archive
# if running on at PSI copy to download area
if (`hostname` == 'elog01.psi.ch') then
@@ -78,6 +116,8 @@ if (`hostname` == 'elog01.psi.ch') then
cp -v /tmp/$archive ~ritt/html/elog/download/tar/elog-latest.tar.gz
cp -vf doc/ChangeLog ~ritt/html/elog/download/ChangeLog
endif
# define Factory Packager
#set BUILDOPTS="${BUILDOPTS} --define \"packager Stefan Ritt <stefan.ritt@psi.ch>\""
endif
rm -f /tmp/$archive
@@ -87,7 +127,8 @@ rm -f ~/rpmbuild/SRPMS/elog*${version}-${release}*.rpm
# building RPMs
echo Build RPMs...
rpmbuild -ba --define "elogver ${version}" --define "elogrel ${release}" --with ssl --with pam --with ldap --with krb5 --define "factorydate ${fdate}" elog.spec || exit $?
rpmbuild -ba ${BUILDOPTS} --define "factorydate ${fdate}" \
--define "elogver ${version}" --define "elogrel ${release}" elog.spec || exit $?
# if running on at PSI copy to download area
if (`hostname` == 'elog01.psi.ch') then
+4 -7
View File
@@ -45,8 +45,6 @@ Prefix: /usr/local
%{?_with_ldap:Requires: openldap >= 2.4.1}
%{?_with_pam:BuildRequires: pam-devel >= 1.1.1}
%{?_with_ssl:BuildRequires: openssl-devel >= 0.9.8e}
# GAIAOPS: set max N limit to 500
# Patch1: elog_set_max_list_500.patch
%description
ELOG is part of a family of applications known as weblogs.
@@ -78,9 +76,9 @@ each weblog can be totally different from the rest.
%changelog
* %{build_timestamp} %{packager} %{version}-%{release}
- rebuild with option(s): %{?_with_krb5:KRB5 }%{?_with_ldap:LDAP }%{?_with_pam:PAM }%{?_with_ssl:SSL}
- set MAX_N_LIST to 500 (patch1)
* %{factorydate} Stefan Ritt <stefan.ritt@psi.ch> %{version}-%{release}
- Updated from git
- Updated from git Tue Aug 25 13:38:41 2020 +0200 - 13c50f1
* Wed Sep 26 2018 Stefan Ritt <stefan.ritt@psi.ch>
- Made adjustments for new elog server and RH7
* Fri Aug 29 2014 Stefan Ritt <stefan.ritt@psi.ch>
@@ -104,8 +102,7 @@ each weblog can be totally different from the rest.
%prep
%setup -q
# %patch1 -p0
%setup -q -n elog-%{elogver}-%{elogrel}
%pre
%{_sbindir}/groupadd -r elog 2>/dev/null || :
@@ -113,7 +110,7 @@ each weblog can be totally different from the rest.
-g elog -M -r elog 2>/dev/null || :
%build
make %{?_with_ssl} %{?_with_pam} %{?_with_ldap} %{?_with_krb5} CFLAGS='-O3 -funroll-loops -fomit-frame-pointer -W -Wall -Wno-deprecated-declarations -Imxml -g'
make %{?_with_ssl} %{?_with_pam} %{?_with_ldap} %{?_with_krb5} CFLAGS="$RPM_OPT_FLAGS -O3 -funroll-loops -fomit-frame-pointer -W -Wall -Wno-deprecated-declarations -Wno-unused-result -Imxml"
sed "s#\@PREFIX\@#%{prefix}#g" elogd.init_template > elogd.init
%install