From 8a1388b9f7b6d081610c1c7fe970fc3ff132d204 Mon Sep 17 00:00:00 2001 From: Yann Weber Date: Fri, 7 Apr 2023 10:36:23 +0200 Subject: [PATCH] Setup deb & rpm packaging --- Makefile.am | 54 +++++++++++++++++++++++++++++++++++--- deb_folder/asmsh-docs.docs | 1 + deb_folder/changelog | 5 ++++ deb_folder/control | 16 +++++++++++ deb_folder/copyright | 38 +++++++++++++++++++++++++++ deb_folder/rules | 25 ++++++++++++++++++ src/Makefile.am | 2 +- tests/samples/Makefile.am | 2 +- 8 files changed, 138 insertions(+), 5 deletions(-) create mode 100644 deb_folder/asmsh-docs.docs create mode 100644 deb_folder/changelog create mode 100644 deb_folder/control create mode 100644 deb_folder/copyright create mode 100755 deb_folder/rules diff --git a/Makefile.am b/Makefile.am index 213f243..27653dc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,6 +2,7 @@ SUBDIRS = . src docs EXTRA_DIST = regen.sh +TO_LOCAL_CLEAN= ALL_CHECKS= LINT= if CHECK @@ -19,7 +20,7 @@ if HAVE_LCOV LCOV_INFO=lcov.info LCOV_HTML=lcov_html -TO_LOCAL_CLEAN = $(LCOV_INFO) $(LCOV_HTML) +TO_LOCAL_CLEAN += $(LCOV_INFO) $(LCOV_HTML) $(LCOV_INFO): $(CHECK_STAMP) $(LCOV) --base-directory $(top_builddir)/src/ --capture --directory $(top_builddir)/src/ --output-file $@ @@ -27,8 +28,6 @@ $(LCOV_INFO): $(CHECK_STAMP) $(LCOV_HTML): $(LCOV_INFO) genhtml $< --output-directory $@ -clean-local: - -rm -rf $(TO_LOCAL_CLEAN) endif # HAVE_LCOV @@ -53,3 +52,52 @@ lint: $(LINT) doxygen: $(MAKE) -C docs + + + +DEB_BUILD=$(PACKAGE)-$(VERSION) +DEB_PREF=$(PACKAGE)_$(VERSION)-1_amd64 +DEB_PKG=$(DEB_PREF).deb +DEB_FOLDER=$(DEB_BUILD)/debian +RPM_BUILD=rpm_build +PKGV=$(PACKAGE)-$(VERSION).tar.gz + +TO_LOCAL_CLEAN+=$(PACKAGE)_$(VERSION)-1.debian.tar.xz $(PACKAGE)_$(VERSION)-1.dsc\ + $(PACKAGE)_$(VERSION).orig.tar.gz \ + $(PACKAGE)-dbgsym_$(VERSION)-1_amd64.deb \ + $(DEB_PREF).buildinfo \ + $(DEB_PREF).changes \ + $(DEB_PREF).deb \ + $(PACKAGE)_$(VERSION).tar.gz \ + $(PACKAGE)-$(VERSION) \ + $(RPM_BUILD) \ + *.rpm + +$(PKGV): dist + + +$(DEB_BUILD): $(PACKAGE)-$(VERSION).tar.gz + tar -xf $< + +$(DEB_FOLDER): deb_folder $(DEB_BUILD) + cp -R $< $@ + + +$(DEB_PKG): $(PKGV) $(DEB_BUILD) $(DEB_FOLDER) + cd $(DEB_BUILD);\ + dh_make -a -y -s -f ../$(PACKAGE)-$(VERSION).tar.gz;\ + rm debian/*.ex debian/*.EX debian/README.Debian debian/README.source ;\ + dpkg-buildpackage $(shell [ -z ${DEB_SIGN_KEYID} ] && echo "-us -uc" || echo "--sign-key='${DEB_SIGN_KEYID}'"); + +deb: $(DEB_PKG) + +rpm: $(DEB_PKG) + mkdir -p $(RPM_BUILD);\ + cd $(RPM_BUILD); \ + fakeroot alien -k --to-rpm ../$(DEB_PKG);\ + mv *.rpm ../; + +release: deb rpm + +clean-local: + -rm -rf $(TO_LOCAL_CLEAN) diff --git a/deb_folder/asmsh-docs.docs b/deb_folder/asmsh-docs.docs new file mode 100644 index 0000000..ad22ca6 --- /dev/null +++ b/deb_folder/asmsh-docs.docs @@ -0,0 +1 @@ +../docs/man/asmsh.1 diff --git a/deb_folder/changelog b/deb_folder/changelog new file mode 100644 index 0000000..d0d46ee --- /dev/null +++ b/deb_folder/changelog @@ -0,0 +1,5 @@ +asmsh (0.0-dev-1) unstable; urgency=medium + + * Initial release + + -- Yann Weber Thu, 06 Apr 2023 09:24:01 +0200 diff --git a/deb_folder/control b/deb_folder/control new file mode 100644 index 0000000..4d01254 --- /dev/null +++ b/deb_folder/control @@ -0,0 +1,16 @@ +Source: asmsh +Section: shells +Priority: optional +Maintainer: Yann Weber +Build-Depends: debhelper-compat (= 13), autotools-dev, check, lcov, doxygen, libreadline-dev +Standards-Version: 4.5.1 +Homepage: https://git.yannweb.net/yannweb/asmsh/ +Vcs-Git: https://git.yannweb.net/yannweb/asmsh.git +Rules-Requires-Root: no + +Package: asmsh +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: asmsh : A shell that runs assembly + asmsh is a shell that allows to run x86_64 + assembly instructions in a traced sub-process diff --git a/deb_folder/copyright b/deb_folder/copyright new file mode 100644 index 0000000..c5e62c8 --- /dev/null +++ b/deb_folder/copyright @@ -0,0 +1,38 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: asmsh +Upstream-Contact: Yann Weber +Source: https://git.yannweb.net/yannweb/asmsh + +Files: * +Copyright: 2023 Yann Weber +License: GPL-3.0+ + +Files: debian/* +Copyright: 2023 Yann Weber +License: GPL-3.0+ + +License: GPL-3.0+ + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. +# Please avoid picking licenses with terms that are more restrictive than the +# packaged work, as it may make Debian's contributions unacceptable upstream. +# +# If you need, there are some extra license texts available in two places: +# /usr/share/debhelper/dh_make/licenses/ +# /usr/share/common-licenses/ diff --git a/deb_folder/rules b/deb_folder/rules new file mode 100755 index 0000000..59ea751 --- /dev/null +++ b/deb_folder/rules @@ -0,0 +1,25 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +#export DH_VERBOSE = 1 + + +# see FEATURE AREAS in dpkg-buildflags(1) +#export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +# see ENVIRONMENT in dpkg-buildflags(1) +# package maintainers to append CFLAGS +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +# package maintainers to append LDFLAGS +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + + +%: + dh $@ + + +# dh_make generated override targets +# This is example for Cmake (See https://bugs.debian.org/641051 ) +#override_dh_auto_configure: +# dh_auto_configure -- \ +# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) diff --git a/src/Makefile.am b/src/Makefile.am index c48de2e..254ad26 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -bin_PROGRAMS = asmsh child +bin_PROGRAMS = asmsh noinst_PROGRAMS = child noinst_LIBRARIES= libcheck_asmsh.a diff --git a/tests/samples/Makefile.am b/tests/samples/Makefile.am index 6da85ad..97628b9 100644 --- a/tests/samples/Makefile.am +++ b/tests/samples/Makefile.am @@ -1,5 +1,5 @@ if CHECK -bin_PROGRAMS = asm_env_stamps +noinst_PROGRAMS = asm_env_stamps EXTRA_DIST=procfs_pid_maps procfs_pid_maps_sm sample.history