Skip to content

Commit

Permalink
debian package build support
Browse files Browse the repository at this point in the history
In debian systems, running 'make dpkg' should result in a nice
libfyaml & libfyaml-dev packages.

Signed-off-by: Pantelis Antoniou <[email protected]>
  • Loading branch information
pantoniou committed Sep 20, 2019
1 parent fed4379 commit 215fd9f
Show file tree
Hide file tree
Showing 16 changed files with 339 additions and 23 deletions.
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,14 @@ test/test-suite-data/
test/*.trs
test/*.txt
.version
libfyaml-*/
libfyaml[_-]*.deb
libfyaml[_-]*.tar.*
libfyaml[_-]*.build
libfyaml[_-]*.dsc
libfyaml[_-]*.changes
libfyaml_*.orig.tar.gz
debian/changelog
debian/control
debian/copyright
artifacts/
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,15 @@ test/test-suite-data/
test/*.trs
test/*.txt
.version
libfyaml-*/
libfyaml[_-]*.deb
libfyaml[_-]*.tar.*
libfyaml[_-]*.build
libfyaml[_-]*.dsc
libfyaml[_-]*.changes
libfyaml_*.orig.tar.gz
debian/*.install
debian/changelog
debian/control
debian/copyright
artifacts/
21 changes: 21 additions & 0 deletions Dockerfile-build-deb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
ARG IMAGE=ubuntu
FROM ${IMAGE}
# install build dependencies
RUN apt-get update -qq
RUN apt-get install --no-install-recommends --fix-missing -y \
gcc autoconf automake libtool git make libyaml-dev libltdl-dev \
pkg-config check python3 python3-pip python3-setuptools \
devscripts build-essential lintian debhelper dh-buildinfo dh-autoreconf fakeroot \
gnupg
# install sphinx doc dependencies
RUN pip3 install wheel sphinx git+http://github.com/return42/linuxdoc.git sphinx_rtd_theme sphinx-markdown-builder
# configure argument
ARG CONFIG_ARGS
ENV CONFIG_ARGS=${CONFIG_ARGS}
COPY . /build
WORKDIR /build
# do a maintainer clean if the directory was unclean (it can fail)
RUN make maintainer-clean >/dev/null 2>&1|| true
RUN ./bootstrap.sh 2>&1
RUN ./configure 2>&1 ${CONFIG_ARGS}
RUN make deb
50 changes: 48 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ dist-hook:
EXTRA_DIST=bootstrap.sh \
build-aux/shave.in build-aux/shave-libtool.in \
build-aux/git-version-gen \
README.md
README.md \
debian

MAINTAINERCLEANFILES = \
Makefile.in src/Makefile.in config.h.in configure \
Expand All @@ -25,7 +26,9 @@ MAINTAINERCLEANFILES = \
build-aux/ltmain.sh build-aux/missing build-aux/tap-driver.sh

DISTCLEANFILES = \
.version .tarball-version
.version .tarball-version \
debian/changelog debian/control debian/copyright \
debian/libfyaml-dev.install debian/libfyaml-utils.install debian/libfyaml-$(DEBVERSION).install

clean-local:

Expand All @@ -34,8 +37,25 @@ SUBDIRS = src test doc
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libfyaml.pc

if HAVE_DPKG
DEB_ARTIFACTS= \
$(PACKAGE_NAME)-$(DEBVERSION)_$(DEBVERSION)_$(DPKG_ARCH).deb \
$(PACKAGE_NAME)-dev_$(DEBVERSION)_$(DPKG_ARCH).deb \
$(PACKAGE_NAME)-utils_$(DEBVERSION)_$(DPKG_ARCH).deb \
$(PACKAGE_NAME)_$(DEBVERSION).dsc \
$(PACKAGE_NAME)_$(DEBVERSION).tar.xz \
$(PACKAGE_NAME)_$(DEBVERSION)_$(DPKG_ARCH).build \
$(PACKAGE_NAME)_$(DEBVERSION)_$(DPKG_ARCH).changes
endif

maintainer-clean-local:
@rm -rf install sphinx
if HAVE_DPKG
@rm -rf $(DEB_ARTIFACTS)
@rm -rf $(PACKAGE_NAME)_$(DEBVERSION).orig.tar.gz
@rm -rf $(PACKAGE_NAME)-$(VERSION).tar.gz
endif
@rm -rf install artifacts

# extra file to put in the distribution
EXTRA_DIST += \
Expand All @@ -59,3 +79,29 @@ if HAVE_DOCKER
docker: Dockerfile
@DOCKER@ build -t libfyaml:$(VERSION) $(top_srcdir)
endif

if HAVE_DPKG

# note the package will not be signed
# deb: dist
# @cp $(PACKAGE_NAME)-$(VERSION).tar.gz $(PACKAGE_NAME)_$(DEBVERSION).orig.tar.gz
# @rm -rf $(PACKAGE_NAME)-$(VERSION)
# @tar zxf $(PACKAGE_NAME)-$(VERSION).tar.gz
# @(cd $(PACKAGE_NAME)-$(VERSION) && debuild -us -uc)

deb: $(DEB_ARTIFACTS)
@mkdir -p artifacts && mv $(DEB_ARTIFACTS) artifacts/
@rm -rf $(PACKAGE_NAME)-$(VERSION).tar.gz $(PACKAGE_NAME)-$(VERSION)/

$(PACKAGE_NAME)-$(VERSION).tar.gz: dist

$(PACKAGE_NAME)_$(DEBVERSION).orig.tar.gz: $(PACKAGE_NAME)-$(VERSION).tar.gz
@cp $< $@

$(PACKAGE_NAME)-$(VERSION)/: $(PACKAGE_NAME)-$(VERSION).tar.gz
@tar zxf $<

$(DEB_ARTIFACTS): $(PACKAGE_NAME)-$(VERSION)/
@(cd $< && debuild -us -uc)

endif
109 changes: 89 additions & 20 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,21 @@ AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([foreign 1.8.5 -Wall subdir-objects ])
AM_EXTRA_RECURSIVE_TARGETS([doc-help doc-html doc-latexpdf doc-man doc-clean doc-markdown])

m4_define(fyaml_major, `echo $VERSION | cut -d. -f1`)
m4_define(fyaml_minor, `echo $VERSION | cut -d. -f2`)
m4_define(fyaml_major, `echo $VERSION | cut -d. -f1 | cut -d- -f1`)
m4_define(fyaml_minor, `echo $VERSION | cut -d. -f2 | cut -d- -f1`)
m4_define(fyaml_patch, `echo $VERSION | cut -d. -f3- | cut -d- -f1`)
m4_define(fyaml_extra, `echo $VERSION | cut -d. -f3- | cut -d- -f2-`)
m4_define(fyaml_extra, `echo $VERSION | cut -d- -f2-`)

AC_SUBST(MAJOR, fyaml_major)
AC_SUBST(MINOR, fyaml_minor)
AC_SUBST(PATCH, fyaml_patch)
AC_SUBST(EXTRA, fyaml_extra)

m4_define(fyaml_date, `git show -s --format=%ci`)
AC_SUBST(DATE, fyaml_date)

AC_SUBST(DEBVERSION, "$MAJOR.$MINOR")

AX_CHECK_ENABLE_DEBUG()

AC_PROG_MKDIR_P
Expand Down Expand Up @@ -102,9 +107,43 @@ AC_SUBST(CHECK_LIBS)
AC_DEFINE_UNQUOTED([HAVE_CHECK], [$HAVE_CHECK], [Define to 1 if you have check available])
AM_CONDITIONAL([HAVE_CHECK], [ test x$HAVE_CHECK = x1 ])

HAVE_COMPATIBLE_CHECK=0
if test "x$HAVE_CHECK" == "x1" ; then
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="$LIBS $CHECK_LIBS"
CFLAGS="$CFLAGS $CHECK_CFLAGS"

# check if libcheck has srunner_set_tap (jessie has outdated libcheck)
AC_CHECK_FUNC([srunner_set_tap],
HAVE_COMPATIBLE_CHECK=1,
HAVE_COMPATIBLE_CHECK=0)

LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
fi

AC_SUBST(HAVE_COMPATIBLE_CHECK)
AC_DEFINE_UNQUOTED([HAVE_COMPATIBLE_CHECK], [$HAVE_COMPATIBLE_CHECK], [Define to 1 if you have a compatible version of check available])
AM_CONDITIONAL([HAVE_COMPATIBLE_CHECK], [ test x$HAVE_COMPATIBLE_CHECK = x1 ])

dnl enable internet available when checking
AC_ARG_ENABLE([network],
AS_HELP_STRING([--disable-network],
[Disable tests requiring network access]))

if test "x$enable_network" != "xno" ; then
HAVE_NETWORK=1
else
HAVE_NETWORK=0
fi
AC_SUBST(HAVE_NETWORK)
AM_CONDITIONAL([HAVE_NETWORK],
[ test x$HAVE_NETWORK = x1 ])

# check for sphinx
AC_PATH_PROG([SPHINX], [sphinx-build])
if test "x$SPHINX" != "x" ; then
if test "x$SPHINX" != "x" ; then
HAVE_SPHINX=1
else
HAVE_SPHINX=0
Expand All @@ -114,7 +153,7 @@ AM_CONDITIONAL([HAVE_SPHINX], [ test x$HAVE_SPHINX = x1 ])

# check for git
AC_PATH_PROG([GIT], [git])
if test "x$GIT" != "x" ; then
if test "x$GIT" != "x" ; then
HAVE_GIT=1
else
HAVE_GIT=0
Expand All @@ -137,6 +176,26 @@ else
fi
AM_CONDITIONAL([HAVE_DOCKER], [ test x$HAVE_DOCKER = x1 ])

# note that debian does not support cross compilation
# so do not use it to build cross packages

# check for dpkg
AC_PATH_PROG([DPKG], [dpkg])
if test "x$DPKG" != "x" ; then
HAVE_DPKG=1
else
HAVE_DPKG=0
fi
AC_DEFINE_UNQUOTED([HAVE_DPKG], [$HAVE_DPKG], [Define to 1 if you have dpkg available])
AM_CONDITIONAL([HAVE_DPKG], [ test x$HAVE_DPKG = x1 ])

if test "x$HAVE_DPKG" = "x1" ; then
DPKG_ARCH=`$DPKG --print-architecture`
else
DPKG_ARCH="unknown"
fi
AC_SUBST(DPKG_ARCH, "$DPKG_ARCH")

# Shave by default
SHAVE_INIT([build-aux], [enable])

Expand All @@ -148,6 +207,12 @@ AC_CONFIG_FILES([
test/Makefile
doc/Makefile
libfyaml.pc
debian/changelog
debian/control
debian/copyright
debian/$PACKAGE_NAME-$DEBVERSION.install:debian/$PACKAGE_NAME.install.in
debian/$PACKAGE_NAME-dev.install
debian/$PACKAGE_NAME-utils.install
])

AC_REQUIRE_AUX_FILE([tap-driver.sh])
Expand All @@ -157,20 +222,24 @@ AC_OUTPUT
echo "
---{ $PACKAGE_NAME $VERSION }---

VERSION: ${VERSION}
MAJOR.MINOR: ${MAJOR}.${MINOR}
PATCH: ${PATCH}
EXTRA: ${EXTRA}
prefix: ${prefix}
C compiler: ${CC}
CFLAGS: ${CFLAGS}
Linker: ${LD}
LDFLAGS: ${LDFLAGS}
LIBS: ${LIBS}
CHECK: ${HAVE_CHECK}
SPHINX: $SPHINX
GIT: $GIT
DOCKER: $DOCKER
TESTSUITEURL: $TESTSUITEURL
VERSION: ${VERSION}
MAJOR.MINOR: ${MAJOR}.${MINOR}
PATCH: ${PATCH}
EXTRA: ${EXTRA}
prefix: ${prefix}
C compiler: ${CC}
CFLAGS: ${CFLAGS}
Linker: ${LD}
LDFLAGS: ${LDFLAGS}
LIBS: ${LIBS}
HAVE_CHECK: ${HAVE_CHECK}
HAVE_COMPATIBLE_CHECK: ${HAVE_COMPATIBLE_CHECK}
HAVE_NETWORK: ${HAVE_NETWORK}
SPHINX: $SPHINX
GIT: $GIT
DOCKER: $DOCKER
HAVE_DPKG: $HAVE_DPKG
DPKG_ARCH: $DPKG_ARCH
TESTSUITEURL: $TESTSUITEURL

"
22 changes: 22 additions & 0 deletions debian/changelog.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
libfyaml (0.2) unstable; urgency=medium

* debian compatibility #1
* Add a distcheck command in the Dockerfile
* gh action badge
* run apt using sudo
* github actions ci
* Make distcheck target work
* Update README.md with fy-tool documentation
* Cleanup and update fy-tool usage banner
* Add argument to fy_emit_document_start of root node
* Merge pull request #1 from ohporter/typos
* README: fix typos
* Point to API in github pages

-- Pantelis Antoniou <[email protected]> Thu, 19 Sep 2019 17:04:27 +0300

libfyaml (0.1) unstable; urgency=medium

* Initial release

-- Pantelis Antoniou <[email protected]> Mon, 16 Sep 2019 14:25:04 +0300
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
50 changes: 50 additions & 0 deletions debian/control.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Source: libfyaml
Priority: optional
Maintainer: Pantelis Antoniou <[email protected]>
Build-Depends: debhelper (>=9),autotools-dev,
dh-buildinfo (>= 0.9+nmu1~),
dh-autoreconf,pkg-config,libltdl-dev
Standards-Version: 3.9.7
Section: libs
Homepage: https://github.com/pantoniou/libfyaml
Vcs-Git: https://github.com/pantoniou/libfyaml.git

Package: libfyaml-dev
Section: libdevel
Architecture: any
Multi-Arch: same
Depends: ${misc:Depends}, libfyaml-@DEBVERSION@ (= ${binary:Version})
Description: Fully feature complete YAML parser and emitter.
Fully feature complete YAML parser and emitter, supporting the latest YAML
spec and passing the full YAML testsuite.
.
It is designed to be very efficient, avoiding copies of data, and has no
artificial limits like the 1024 character limit for implicit keys.
.
This package contains development headers and static libraries.

Package: libfyaml-utils
Section: devel
Architecture: any
Multi-Arch: same
Depends: ${misc:Depends}, libfyaml-@DEBVERSION@ (= ${binary:Version})
Description: Fully feature complete YAML parser and emitter.
Fully feature complete YAML parser and emitter, supporting the latest YAML
spec and passing the full YAML testsuite.
.
It is designed to be very efficient, avoiding copies of data, and has no
artificial limits like the 1024 character limit for implicit keys.
.
This package contains utilities manipulating YAML files.

Package: libfyaml-@DEBVERSION@
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Fully feature complete YAML parser and emitter.
Fully feature complete YAML parser and emitter, supporting the latest YAML
spec and passing the full YAML testsuite.
.
It is designed to be very efficient, avoiding copies of data, and has no
artificial limits like the 1024 character limit for implicit keys.

31 changes: 31 additions & 0 deletions debian/copyright.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: libfyaml
Source: https://github.com/pantoniou/libfyaml

Files: *
Copyright: 2019 Pantelis Antoniou <[email protected]>
License: MIT

Files: debian/*
Copyright: 2019 Pantelis Antoniou <[email protected]>
License: MIT

License: MIT
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Loading

0 comments on commit 215fd9f

Please sign in to comment.