Permalink
Browse files

Support packaging for a wider variety of Linux systems.

This patch should support automatic packaging (via 'make packages') for Fedora,
Ubuntu, and CentOS. It probably supports other Debian packaging systems, as
well, but that hasn't been tested. In addition, this should provide a fairly
obvious place to detect other systems and integrate automated packaging commands
for them.

This is a squashed commit of the 'ubuntu' branch.
  • Loading branch information...
acw committed May 9, 2016
1 parent 29ffc9a commit 51bd3e00312177c94e46d47b0f07def31dc0671f
Showing with 264 additions and 9 deletions.
  1. +6 −0 .gitignore
  2. +114 −6 Makefile
  3. +1 −0 autoconf.mk.in
  4. +19 −3 configure.ac
  5. +5 −0 src/debian/changelog
  6. +1 −0 src/debian/compat
  7. +16 −0 src/debian/control
  8. +36 −0 src/debian/copyright
  9. +1 −0 src/debian/docs
  10. +46 −0 src/debian/rules.in
  11. +1 −0 src/debian/source/format
  12. +1 −0 src/debian/source/options
  13. +17 −0 src/misc/halvm.dsc
View
@@ -30,3 +30,9 @@ src/profiling/convert-profile
packages/
rpmbuild/
*.deb
*.dsc
halvm-*/
halvm*.changes
src/debian/rules
View
120 Makefile
@@ -463,20 +463,128 @@ install::
-exec cp '{}' $(DESTDIR)$(halvmlibdir)/lib/ \;
$(INSTALL) -D $(TOPDIR)/src/scripts/hsc2hs $(DESTDIR)${halvmlibdir}/bin/hsc2hs
###############################################################################
# Packaging!
###############################################################################
FILELIST := $(filter-out $(TOPDIR)/HaLVM-$(HaLVM_VERSION),\
$(filter-out $(TOPDIR)/rpmbuild,\
$(wildcard $(TOPDIR)/* $(TOPDIR)/.git)))
.PHONY: packages
packages:
mkdir -p $(TOPDIR)/HaLVM-${HaLVM_VERSION} $(TOPDIR)/packages
mkdir -p $(TOPDIR)/rpmbuild/{BUILD,BUILDROOT,RPMS,SRPMS,SOURCES,SPECS}
rm -rf $(TOPDIR)/HaLVM-${HaLVM_VERSION}/*
SRC_TARBALL=HaLVM-$(HaLVM_VERSION).tar.gz
$(SRC_TARBALL):
rm -rf $(TOPDIR)/HaLVM-${HaLVM_VERSION}
mkdir -p $(TOPDIR)/HaLVM-${HaLVM_VERSION}
cp -r $(FILELIST) $(TOPDIR)/HaLVM-${HaLVM_VERSION}/
tar czf $(TOPDIR)/rpmbuild/SOURCES/HaLVM-${HaLVM_VERSION}.tar.gz HaLVM-${HaLVM_VERSION}/
tar czf $@ HaLVM-${HaLVM_VERSION}/
rm -rf $(TOPDIR)/HaLVM-${HaLVM_VERSION}
ifeq ($(PACKAGE_TARGET),RPM)
.PHONY: packages
packages: $(SRC_TARBALL)
mkdir -p rpmbuild/{SOURCES,SPECS}
cp $(SRC_TARBALL) $(TOPDIR)/rpmbuild/SOURCES/
cp $(TOPDIR)/src/misc/HaLVM.spec $(TOPDIR)/rpmbuild/SPECS/HaLVM.spec
mkdir -p packages
rpmbuild -ba --define "_topdir $(TOPDIR)/rpmbuild" --define "_version $(HaLVM_VERSION)" --define "_release $(RELEASE)" $(TOPDIR)/rpmbuild/SPECS/HaLVM.spec
rpmbuild -ba --with gmp --define "_topdir $(TOPDIR)/rpmbuild" --define "_version $(HaLVM_VERSION)" --define "_release $(RELEASE)" $(TOPDIR)/rpmbuild/SPECS/HaLVM.spec
find rpmbuild -name "*.*rpm" -exec cp '{}' $(TOPDIR)/packages/ \;
endif
ifeq ($(PACKAGE_TARGET),deb)
DEB_ORIGSRC_TARBALL=halvm_$(HaLVM_VERSION).orig.tar.gz
DEB_CONFSRC_TARBALL=halvm_$(HaLVM_VERSION)-$(RELEASE).debian.tar.gz
DEB_DESC_FILE=halvm_$(HaLVM_VERSION)-$(RELEASE).dsc
DEBG_ORIGSRC_TARBALL=halvm-gmp_$(HaLVM_VERSION).orig.tar.gz
DEBG_CONFSRC_TARBALL=halvm-gmp_$(HaLVM_VERSION)-$(RELEASE).debian.tar.gz
DEBG_DESC_FILE=halvm-gmp_$(HaLVM_VERSION)-$(RELEASE).dsc
hash=openssl sha -$1 $2 | sed 's/.*= //g'
sha1=$(call hash,sha1,$1)
sha256=$(call hash,sha256,$1)
size=stat -c "%s" $1
.PHONY: packages
packages: $(DEB_ORIGSRC_TARBALL) $(DEB_CONFSRC_TARBALL) $(DEB_DESC_FILE) \
$(DEBG_ORIGSRC_TARBALL) $(DEBG_CONFSRC_TARBALL) $(DEBG_DESC_FILE)
rm -rf HaLVM-$(HaLVM_VERSION) halvm-$(HaLVM_VERSION)
tar zxf $(DEB_ORIGSRC_TARBALL)
mv HaLVM-$(HaLVM_VERSION) halvm-$(HaLVM_VERSION)
tar zxf $(DEB_CONFSRC_TARBALL) -C halvm-$(HaLVM_VERSION)/
(cd halvm-$(HaLVM_VERSION) && dpkg-buildpackage -rfakeroot -uc -us)
tar zxf $(DEBG_ORIGSRC_TARBALL)
tar zxf $(DEBG_CONFSRC_TARBALL) -C halvm-gmp-$(HaLVM_VERSION)/
(cd halvm-gmp-$(HaLVM_VERSION) && dpkg-buildpackage -rfakeroot -uc -us)
mkdir -p packages
cp *.deb packages/
cp *.dsc packages/
cp *.changes packages/
$(DEB_ORIGSRC_TARBALL): $(SRC_TARBALL)
cp $(SRC_TARBALL) $(DEB_ORIGSRC_TARBALL)
$(DEB_CONFSRC_TARBALL): $(shell find $(TOPDIR)/src/debian)
rm -rf tmp
mkdir tmp
cp -r src/debian tmp/debian
sed -ie 's/INTEGER_LIBRARY/simple/g' tmp/debian/rules
sed -ie 's/VERSION/$(HaLVM_VERSION)/g' tmp/debian/changelog
sed -ie 's/RELEASE/$(RELEASE)/g' tmp/debian/changelog
tar cz -C tmp -f $@ debian/
$(DEB_DESC_FILE): $(DEB_ORIGSRC_TARBALL) $(DEB_CONFSRC_TARBALL)
sed -e 's!ORIG_SHA1!'`$(call sha1,$(DEB_ORIGSRC_TARBALL))`'!g' \
-e 's!ORIG_SHA256!'`$(call sha256,$(DEB_ORIGSRC_TARBALL))`'!g' \
-e 's!CONF_SHA256!'`$(call sha256,$(DEB_CONFSRC_TARBALL))`'!g' \
-e 's!CONF_SHA1!'`$(call sha1,$(DEB_CONFSRC_TARBALL))`'!g' \
-e 's!ORIG_SIZE!'`$(call size,$(DEB_ORIGSRC_TARBALL))`'!g' \
-e 's!CONF_SIZE!'`$(call size,$(DEB_CONFSRC_TARBALL))`'!g' \
-e 's!VERSION!$(HaLVM_VERSION)!g' \
-e 's!RELEASE!$(RELEASE)!g' \
src/misc/halvm.dsc > $(DEB_DESC_FILE)
$(DEBG_ORIGSRC_TARBALL): $(DEB_ORIGSRC_TARBALL)
rm -rf tmp
mkdir tmp
tar zx -C tmp -f $(DEB_ORIGSRC_TARBALL)
mv tmp/HaLVM-$(HaLVM_VERSION) tmp/halvm-gmp-$(HaLVM_VERSION)
tar cz -C tmp -f $@ halvm-gmp-$(HaLVM_VERSION)
rm -rf tmp
$(DEBG_CONFSRC_TARBALL): $(shell find $(TOPDIR)/src/debian)
rm -rf tmp
mkdir tmp
cp -r src/debian tmp/debian
sed -ie 's/halvm/halvm-gmp/g' tmp/debian/changelog
sed -ie 's/ halvm/ halvm-gmp/g' tmp/debian/control
sed -ie 's/INTEGER_LIBRARY/gmp/g' tmp/debian/rules
sed -ie 's/VERSION/$(HaLVM_VERSION)/g' tmp/debian/changelog
sed -ie 's/RELEASE/$(RELEASE)/g' tmp/debian/changelog
tar cz -C tmp -f $@ debian/
$(DEBG_DESC_FILE): $(DEBG_ORIGSRC_TARBALL) $(DEBG_CONFSRC_TARBALL)
sed -e 's!ORIG_SHA1!'`$(call sha1,$(DEB_ORIGSRC_TARBALL))`'!g' \
-e 's!ORIG_SHA256!'`$(call sha256,$(DEB_ORIGSRC_TARBALL))`'!g' \
-e 's!CONF_SHA256!'`$(call sha256,$(DEB_CONFSRC_TARBALL))`'!g' \
-e 's!CONF_SHA1!'`$(call sha1,$(DEB_CONFSRC_TARBALL))`'!g' \
-e 's!ORIG_SIZE!'`$(call size,$(DEB_ORIGSRC_TARBALL))`'!g' \
-e 's!CONF_SIZE!'`$(call size,$(DEB_CONFSRC_TARBALL))`'!g' \
-e 's!VERSION!$(HaLVM_VERSION)!g' \
-e 's!RELEASE!$(RELEASE)!g' \
-e 's! halvm! halvm-gmp!g' \
src/misc/halvm.dsc > $(DEB_DESC_FILE)
debclean:
$(RM) -f $(SRC_TARBALL)
$(RM) -f $(DEB_ORIGSRC_TARBALL) $(DEBG_ORIGSRC_TARBALL)
$(RM) -f $(DEB_CONFSRC_TARBALL) $(DEBG_CONFSRC_TARBALL)
$(RM) -f $(DEB_DESC_FILE) $(DEBG_DESC_FILE)
$(RM) -rf HaLVM-$(HaLVM_VERSION)
$(RM) -rf halvm-$(HaLVM_VERSION)
$(RM) -rf halvm-gmp-$(HaLVM_VERSION)
$(RM) -f *.deb *.changes
clean:: debclean
endif #ifeq deb
View
@@ -74,6 +74,7 @@ ARCH := @ARCHITECTURE@
XEN_INCLUDE_DIR := @XEN_INCLUDE_DIRECTORY@
XEN_LIBRARY_DIR := @XEN_LIBRARY_DIRECTORY@
FORCE_PLATFORM_GHC := @FORCE_PLATFORM_GHC@
PACKAGE_TARGET := @PACKAGE_TARGET@
#
# Derivations of the above.
View
@@ -6,7 +6,7 @@ dnl - terms and conditions.
dnl Author: Adam Wick <awick@galois.com>
dnl BANNEREND
AC_PREREQ(2.60)
AC_INIT(HALVM,2.0.3,awick@galois.com,halvm)
AC_INIT(HALVM,2.0.4,awick@galois.com,halvm)
dnl -------------------------------------------------------------------------
dnl
@@ -214,8 +214,12 @@ AC_ARG_ENABLE([gmp],
AC_SUBST(INTEGER_LIBRARY, [$int_library])
AC_CHECK_FILE(/etc/centos-release,
AC_SUBST(PLATFORM,"centos65"),
AC_SUBST(PLATFORM,"deb7"))
[if `grep -q "release 7" /etc/centos-release`; then
AC_SUBST(PLATFORM,"deb7")
else
AC_SUBST(PLATFORM,"centos65")
fi],
AC_SUBST(PLATFORM,"deb7"))
dnl -------------------------------------------------------------------------
dnl
@@ -350,6 +354,16 @@ case "$memory_model" in
*) LOG_FAILURE("Unknown memory model (internal error?)") ;;
esac
AC_CHECK_FILE(/etc/os-release,
[source /etc/os-release
case "${ID}" in
"ubuntu") AC_SUBST(PACKAGE_TARGET, "deb") ;;
"debian") AC_SUBST(PACKAGE_TARGET, "deb") ;;
"fedora") AC_SUBST(PACKAGE_TARGET, "RPM") ;;
"centos") AC_SUBST(PACKAGE_TARGET, "RPM") ;;
*) AC_SUBST(PACKAGE_TARGET, "Unfamiliar (${ID})") ;;
esac],
AC_SUBST(PACKAGE_TARGET, "Unknown"))
dnl -------------------------------------------------------------------------
dnl
@@ -369,11 +383,13 @@ else
echo " HaLVM Memory Model: ${MEMMODEL_STR}"
echo " Integer library: ${INTEGER_LIBRARY}"
echo " Building documentation: ${ENABLE_DOCS} ${doc_reason}"
echo " Package target: ${PACKAGE_TARGET}"
echo
AC_CONFIG_FILES([
autoconf.mk
examples/standard.mk
src/HALVMCore/HALVMCore.buildinfo
src/debian/rules
src/misc/build.mk
src/scripts/halvm-cabal
src/scripts/halvm-config
View
@@ -0,0 +1,5 @@
halvm (VERSION-RELEASE) unstable; urgency=low
* Debian packaging
-- Adam Wick <awick@galois.com> Sat, 16 Apr 2016 15:06:54 +0000
View
@@ -0,0 +1 @@
9
View
@@ -0,0 +1,16 @@
Source: halvm
Section: devel
Priority: optional
Maintainer: HaLVM Maintainers <halvm-devel@community.galois.com>
Build-Depends: debhelper (>= 8.0.0)
Standards-Version: 3.9.4
Homepage: http://halvm.org
Vcs-Git: git://github.com/GaloisInc/HaLVM
Vcs-Browser: http://github.com/GaloisInc/HaLVM
Package: halvm
Architecture: amd64 i386
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: The HaLVM unikernel development tools
Tools and scripts for building HaLVM-based unikernels, along with
example unikernels that illustrate key points.
View
@@ -0,0 +1,36 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: halvm
Source: http://halvm.org
Files: *
Copyright: 2010 Galois, Inc.
License: BSD-3-Clause
Files: debian/*
Copyright: 2016 Galois Inc.
License: BSD-3-Clause
License: BSD-3-Clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE HOLDERS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
@@ -0,0 +1 @@
README.md
View
@@ -0,0 +1,46 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
VERSION:=@PACKAGE_VERSION@
ARCH:=@ARCHITECTURE@
INTLIB:=INTEGER_LIBRARY
ifeq ($(INTLIB),gmp)
SUBDIR=halvm-gmp
CONFIGURE_FLAGS=--enable-gmp
else
SUBDIR=halvm
CONFIGURE_FLAGS=
endif
%:
dh $@
override_dh_auto_clean:
echo "skip dh_auto_clean"
override_dh_auto_configure:
dh_auto_configure -- $(CONFIGURE_FLAGS)
override_dh_update_autotools_config:
echo "skip autottolls_config; we like our config.sub, thanks."
override_dh_shlibdeps:
dh_shlibdeps -l/usr/lib/$(ARCH)-linux-gnu/HaLVM-$(VERSION)/lib
override_dh_strip:
dh_strip
chrpath -d debian/$(SUBDIR)/usr/lib/$(ARCH)-linux-gnu/HaLVM-$(VERSION)/bin/alex
chrpath -d debian/$(SUBDIR)/usr/lib/$(ARCH)-linux-gnu/HaLVM-$(VERSION)/bin/cabal
chrpath -d debian/$(SUBDIR)/usr/lib/$(ARCH)-linux-gnu/HaLVM-$(VERSION)/bin/ghc
chrpath -d debian/$(SUBDIR)/usr/lib/$(ARCH)-linux-gnu/HaLVM-$(VERSION)/bin/ghc-pkg
chrpath -d debian/$(SUBDIR)/usr/lib/$(ARCH)-linux-gnu/HaLVM-$(VERSION)/bin/haddock
chrpath -d debian/$(SUBDIR)/usr/lib/$(ARCH)-linux-gnu/HaLVM-$(VERSION)/bin/happy
chrpath -d debian/$(SUBDIR)/usr/lib/$(ARCH)-linux-gnu/HaLVM-$(VERSION)/bin/HsColour
chrpath -r /usr/lib/$(ARCH)-linux-gnu/HaLVM-$(VERSION)/lib \
debian/$(SUBDIR)/usr/lib/$(ARCH)-linux-gnu/HaLVM-$(VERSION)/bin/hsc2hs.bin
mv debian/$(SUBDIR)/usr/share/doc/ghc debian/$(SUBDIR)/usr/share/doc/HaLVM-ghc
mkdir -p debian/$(SUBDIR)/usr/share/HaLVM-$(VERSION)
cp -r examples debian/$(SUBDIR)/usr/share/HaLVM-$(VERSION)/
View
@@ -0,0 +1 @@
3.0 (quilt)
@@ -0,0 +1 @@
extend-diff-ignore = "(^|/)(config\.sub|config\.guess|Makefile)$"
View
@@ -0,0 +1,17 @@
Format: 3.0 (quilt)
Source: halvm
Binary: halvm
Architecture: amd64 i386
Version: VERSION-RELEASE
Maintainer: HaLVM Maintainers <halvm-devel@community.galois.com>
Build-Depends: autoconf, automake, libtool, libncurses5-dev, zlib1g-dev,
libgmp-dev, g++, libxen-dev, curl, make, git, chrpath
Checksums-Sha1:
ORIG_SHA1 ORIG_SIZE halvm_VERSION.orig.tar.gz
CONF_SHA1 CONF_SIZE halvm_VERSION-RELEASE.debian.tar.gz
Checksums-Sha256:
ORIG_SHA256 ORIG_SIZE halvm_VERSION.orig.tar.gz
CONF_SHA256 CONF_SIZE halvm_VERSION-RELEASE.debian.tar.gz
Files:

0 comments on commit 51bd3e0

Please sign in to comment.