From 03f1f3c4a7c13e9747300bf99e173a8a0d39ddf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= Date: Tue, 22 Oct 2024 00:06:09 +0900 Subject: [PATCH] Move Debian package build recipe to Makefile --- Makefile | 33 +++++++++++++++-- VERSION | 1 - debian-binary-control.in | 15 ++++++++ install.sh | 76 ---------------------------------------- 4 files changed, 46 insertions(+), 79 deletions(-) delete mode 100644 VERSION create mode 100644 debian-binary-control.in delete mode 100755 install.sh diff --git a/Makefile b/Makefile index 060898e..51dc6fa 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,14 @@ -.PHONY: all clean install dev release debug sanitize +.PHONY: all clean install dev release debug sanitize deb debian-dirs ######################################################################### # BUILD COMMON ######################################################################### +VERSION ?= 1.0.0-rc10 PREFIX ?= /usr CXXFLAGS ?= -march=native CXXFLAGS += -std=c++11 -Wall -Wno-reorder -fPIC -pie \ - -DVERSION=$(shell cat VERSION) -Wl,-rpath=$(PREFIX)/share/e9tool/lib/ + -DVERSION=$(VERSION) -Wl,-rpath=$(PREFIX)/share/e9tool/lib/ E9PATCH_OBJS=\ src/e9patch/e9CFR.o \ @@ -164,3 +165,31 @@ debug: dev sanitize: CXXFLAGS += -O0 -g -fsanitize=address sanitize: dev + +DEB := e9patch_$(VERSION)_amd64.deb +deb: $(DEB) + +$(DEB): install/debian-binary install/control.tar.gz install/data.tar.gz + fakeroot ar cr $@ $^ + +install/debian-binary: debian-dirs + echo 2.0 > $@ + +install/control.tar.gz: install/control/md5sums install/control/control + (cd install/control;\ + tar cz --owner root --group root -f ../control.tar.gz .) + +install/control/md5sums: install/data + find $< -type f | xargs md5sum | sed 's#$ $@ + +install/control/control: debian-binary-control.in + sed 's/\bVERSION\b/$(VERSION)/' $< > $@ + +install/data.tar.gz: install/data + (cd $<; tar cz --owner root --group root -f ../data.tar.gz .) + +install/data: tool release + $(MAKE) DESTDIR=install/data install + +debian-dirs: + mkdir -p install/control diff --git a/VERSION b/VERSION deleted file mode 100644 index 950f8ca..0000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0.0-rc10 diff --git a/debian-binary-control.in b/debian-binary-control.in new file mode 100644 index 0000000..0ad3848 --- /dev/null +++ b/debian-binary-control.in @@ -0,0 +1,15 @@ +Package: e9patch +Version: VERSION +Maintainer: Gregory J. Duck +Section: universe/devel +Priority: optional +Homepage: https://github.com/GJDuck/e9patch +Architecture: amd64 +Depends: libc6 (>= 2.14), zlib1g (>= 1:1.2.2.3) +Description: The E9Patch static binary rewriting system + E9Patch is a powerful static rewriting system for stripped x86_64 Linux ELF + and Windows PE binaries. E9Patch is primarily designed for robustness, and + can scale to very large/complex binaries without introducing rewriting + errors. + . + This package also includes the E9Tool frontend for E9Patch. diff --git a/install.sh b/install.sh deleted file mode 100755 index 7fc1f24..0000000 --- a/install.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -# -# Copyright (C) National University of Singapore -# -# 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 -# (at your option) any later version. -# -# This program 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 . - -if [ -t 1 ] -then - RED='\033[31m' - GREEN='\033[32m' - YELLOW='\033[33m' - BOLD='\033[1m' - OFF='\033[0m' -else - RED= - GREEN= - YELLOW= - BOLD= - OFF= -fi - -NAME=e9patch -VERSION=`cat VERSION` - -set -e - -./build.sh -rm -rf install/ -mkdir -p install -mkdir -p install/data -mkdir -p install/control - -DESTDIR=install/data make install - -cd install/data -tar cz --owner root --group root -f ../data.tar.gz . -md5sum `find ../data/ -type f -printf "%P "` > ../control/md5sums - -cd ../control/ -cat << EOF > control -Package: ${NAME} -Version: ${VERSION} -Maintainer: Gregory J. Duck -Section: universe/devel -Priority: optional -Homepage: https://github.com/GJDuck/e9patch -Architecture: amd64 -Depends: libc6 (>= 2.14), zlib1g (>= 1:1.2.2.3) -Description: The E9Patch static binary rewriting system - E9Patch is a powerful static rewriting system for stripped x86_64 Linux ELF - and Windows PE binaries. E9Patch is primarily designed for robustness, and - can scale to very large/complex binaries without introducing rewriting - errors. - . - This package also includes the E9Tool frontend for E9Patch. -EOF -tar cz --owner root --group root -f ../control.tar.gz control md5sums -cd .. -echo "2.0" > debian-binary -PACKAGE="${NAME}_${VERSION}_amd64.deb" -fakeroot ar cr "../${PACKAGE}" debian-binary control.tar.gz \ - data.tar.gz - -echo -e "${GREEN}$0${OFF}: Successfully built ${YELLOW}${PACKAGE}${OFF}..." -