Skip to content

Commit

Permalink
[build] first pass at adding a build system to integrate with CI
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio M. Di Nitto <[email protected]>
  • Loading branch information
fabbione committed Jan 30, 2021
1 parent 413a4f7 commit 8f98926
Show file tree
Hide file tree
Showing 33 changed files with 1,704 additions and 10,435 deletions.
47 changes: 47 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
*.o
*.a
*.la
*.lo
*.pc
*.tar.*
*.sha256*
stamp-h1
Makefile.in
Makefile
.deps
.libs
.version
.dirstamp

# build-aux/release.mk related litter
/.tarball-version
/tag-*

anvil.spec
anvil.version
*.rpm

aclocal.m4
autoconf
autoheader
autom4te.cache
automake
compile
config.*
configure*
depcomp
install-sh
libtoolize
ltmain.sh
m4/libtool.m4
m4/lt~obsolete.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
missing
libtool
autoscan.log
*.swp
test-driver
*.trs
*.log
36 changes: 36 additions & 0 deletions Anvil/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
MAINTAINERCLEANFILES = Makefile.in

anvildir = ${datarootdir}/perl5/Anvil

dist_anvil_DATA = \
anvil-tools.xml \
test.conf \
tools.conf \
Tools.pm

dist_anvil_SCRIPTS = \
Tools.t

anviltoolsdir = ${anvildir}/Tools

dist_anviltools_DATA = \
Tools/Email.pm \
Tools/Remote.pm \
Tools/Log.pm \
Tools/DRBD.pm \
Tools/ScanCore.pm \
Tools/Validate.pm \
Tools/Words.pm \
Tools/Server.pm \
Tools/Account.pm \
Tools/Get.pm \
Tools/Storage.pm \
Tools/Alert.pm \
Tools/Database.pm \
Tools/Striker.pm \
Tools/Cluster.pm \
Tools/Convert.pm \
Tools/System.pm \
Tools/Job.pm \
Tools/Template.pm \
Tools/Network.pm
Empty file modified Anvil/Tools/DRBD.pm
100755 → 100644
Empty file.
Empty file modified Anvil/Tools/Email.pm
100755 → 100644
Empty file.
Empty file modified Anvil/Tools/Network.pm
100755 → 100644
Empty file.
Empty file modified Anvil/Tools/ScanCore.pm
100755 → 100644
Empty file.
Empty file modified Anvil/Tools/Server.pm
100755 → 100644
Empty file.
119 changes: 119 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
EXTRA_DIST = autogen.sh \
.version make/release.mk \
make/git-version-gen make/gitlog-to-changelog \
m4/ax_prog_date.m4 m4/ax_prog_perl_modules.m4 \
anvil.conf $(SPEC).in notes \
README.md scancore.README watch_logs

AUTOMAKE_OPTIONS = foreign

MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure depcomp \
config.guess config.sub missing install-sh \
autoheader automake autoconf libtool libtoolize \
ltmain.sh compile autoscan.log configure.scan

SPEC = $(PACKAGE_NAME).spec

TARFILES = $(PACKAGE_NAME)-$(VERSION).tar.bz2 \
$(PACKAGE_NAME)-$(VERSION).tar.gz \
$(PACKAGE_NAME)-$(VERSION).tar.xz

ACLOCAL_AMFLAGS = -I m4

SUBDIRS = Anvil cgi-bin html journald.conf.d man ocf \
pxe scancore-agents scripts share tools units

anvilconfdir = ${sysconfdir}/anvil

dist_anvilconf_DATA = anvil.conf

anvilconf_DATA = anvil.version

clean-local:
rm -rf $(SPEC) *.rpm $(TARFILES)

# this will get rid of "libtoolized" m4 files
distclean-local:
rm -rf $(filter-out \
$(top_builddir)/m4/ax_prog_date.m4 \
$(top_builddir)/m4/ax_prog_perl_modules.m4, \
$(wildcard $(top_builddir)/m4/*.m4))

# release/versioning
BUILT_SOURCES = .version
.version:
echo $(VERSION) > $@-t && mv $@-t $@

dist-hook: gen-ChangeLog
echo $(VERSION) > $(distdir)/.tarball-version
echo $(SOURCE_EPOCH) > $(distdir)/source_epoch

gen_start_date = 2000-01-01
.PHONY: gen-ChangeLog
gen-ChangeLog:
if test -d $(abs_srcdir)/.git; then \
LC_ALL=C $(top_srcdir)/make/gitlog-to-changelog \
--since=$(gen_start_date) > $(distdir)/cl-t; \
rm -f $(distdir)/ChangeLog; \
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
fi

## make rpm/srpm section.
$(SPEC): $(SPEC).in .version config.status
rm -f $@-t $@
date="`LC_ALL=C $(UTC_DATE_AT)$(SOURCE_EPOCH) "+%a %b %d %Y"`" && \
gvgver="`cd $(abs_srcdir); make/git-version-gen --fallback $(VERSION) .tarball-version .gitarchivever`" && \
if [ "$$gvgver" = "`echo $$gvgver | sed 's/-/./'`" ];then \
rpmver="$$gvgver" && \
alphatag="" && \
dirty="" && \
numcomm="0"; \
else \
gitver="`echo $$gvgver | sed 's/\(.*\)\./\1-/'`" && \
rpmver=`echo $$gitver | sed 's/-.*//g'` && \
alphatag=`echo $$gvgver | sed 's/[^-]*-\([^-]*\).*/\1/'` && \
numcomm=`echo $$gitver | sed 's/[^-]*-\([^-]*\).*/\1/'` && \
dirty="" && \
if [ "`echo $$gitver | sed 's/^.*-dirty$$//g'`" = "" ];then \
dirty="dirty"; \
fi \
fi && \
if [ -n "$$dirty" ]; then dirty="dirty"; else dirty=""; fi && \
if [ "$$numcomm" = "0" ]; then \
sed \
-e "s#@version@#$$rpmver#g" \
-e "s#%glo.*alpha.*##g" \
-e "s#%glo.*numcomm.*##g" \
-e "s#@dirty@#$$dirty#g" \
-e "s#@date@#$$date#g" \
$(abs_srcdir)/$@.in > $@-t; \
else \
sed \
-e "s#@version@#$$rpmver#g" \
-e "s#@alphatag@#$$alphatag#g" \
-e "s#@numcomm@#$$numcomm#g" \
-e "s#@dirty@#$$dirty#g" \
-e "s#@date@#$$date#g" \
$(abs_srcdir)/$@.in > $@-t; \
fi; \
if [ -z "$$dirty" ]; then sed -i -e "s#%glo.*dirty.*##g" $@-t; fi && \
chmod a-w $@-t
mv $@-t $@
rm -f $@-t*

$(TARFILES):
$(MAKE) dist

RPMBUILDOPTS = --define "_sourcedir $(abs_top_builddir)" \
--define "_specdir $(abs_top_builddir)" \
--define "_builddir $(abs_top_builddir)" \
--define "_srcrpmdir $(abs_top_builddir)" \
--define "_rpmdir $(abs_top_builddir)"

srpm: clean
$(MAKE) $(SPEC) $(TARFILES)
rpmbuild $(RPMBUILDOPTS) --nodeps -bs $(SPEC)

rpm: clean
$(MAKE) $(SPEC) $(TARFILES)
rpmbuild $(RPMBUILDOPTS) -ba $(SPEC)
Loading

0 comments on commit 8f98926

Please sign in to comment.