Skip to content

Commit

Permalink
Initial Debian packaging and publish artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Oct 22, 2020
1 parent da3ff47 commit 86053b4
Show file tree
Hide file tree
Showing 7 changed files with 186 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ on: push
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:

# The type of runner that the job will run on
runs-on: ubuntu-latest

Expand All @@ -36,3 +37,9 @@ jobs:
run: make -C tests
- name: Regenerate
run: sh autogen.sh
- name: Debian
run: make -C dist
- name: Pub
uses: actions/upload-artifact@v2
with:
path: dist/acr/*.deb
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src/vim/install.sh
Makefile
8 changes: 8 additions & 0 deletions dist/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
all:
make -C acr

clean:
make -C acr clean

mrproper:
make -C acr mrproper
6 changes: 6 additions & 0 deletions dist/acr/CONFIG
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PACKAGE=acr
ARCH=all
SECTION=devel
PRIORITY=optional
MAINTAINER=pancake <[email protected]>
VERSION=$(shell ../../configure --quiet-version)
2 changes: 2 additions & 0 deletions dist/acr/DESCR
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
autoconf replacement
Minimalistic autoconf replacement written in shellscript
24 changes: 24 additions & 0 deletions dist/acr/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
PACKAGE_DIR=$(shell pwd)
include ./CONFIG
DEPENDS=
ABSROOT=$(shell pwd)/root

SUDO=fakeroot
SUDO=sudo
SUDO=

all:
$(SUDO) rm -rf control data
${MAKE} clean
$(MAKE) root
cp -aRf root data
${MAKE} control
${MAKE} deb

root: $(ABSROOT)

$(ABSROOT):
mkdir $(ABSROOT)
cd ../.. ; ./configure --prefix=/usr ; make install DESTDIR=$(ABSROOT)

include ../deb_hand.mak
137 changes: 137 additions & 0 deletions dist/deb_hand.mak
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# Create .deb without using dpkg tools.
#
# Author: Tim Wegener <[email protected]>
#
# Use 'include deb_hand.mak' after defining the user variables in a local
# makefile.
#
# The 'data' rule must be customised in the local make file.
# This rule should make a 'data' directory containing the full file
# layout of the installed package.
#
# This makefile will create a debian-binary file a control directory and a
# a build directory in the current directory.
# Do 'make clobber' to remove these generated files.
#
# Destination:
# PACKAGE_DIR - directory where package (and support files) will be built
# defaults to the current directory
#
# Sources:
# SOURCE_DIR - directory containing files to be packaged
# ICON_SOURCE - 26x26 icon file for maemo
# DESCR - description with summary on first line
# preinst, postinst, prerm, postrm - optional control shell scripts

# These fields are used to build the control file:
# PACKAGE =
# VERSION =
# ARCH =
# SECTION =
# PRIORITY =
# MAINTAINER =
# DEPENDS =
#
# SOURCE_DIR =
# ICON_SOURCE =
# (ICON_SOURCE is optional)

# *** NO USER CHANGES REQUIRED BEYOND THIS POINT ***
ifeq ($(shell uname),Darwin)
MD5SUM=md5
else
MD5SUM=md5sum
endif

GAWK=awk
PACKAGE_DIR?=$(shell pwd)
ifeq (${PACKAGE_DIR},)
all:
@echo Invalid package directory
false
endif
CONTROL_EXTRAS ?= ${wildcard preinst postinst prerm postrm}

${PACKAGE_DIR}/control: ${PACKAGE_DIR}/data ${CONTROL_EXTRAS} DESCR \
${ICON_SOURCE}
#rm -rf $@
mkdir -p $@
ifneq (${CONTROL_EXTRAS},)
cp ${CONTROL_EXTRAS} $@
endif
# Make control file.
echo "Package: ${PACKAGE}" > $@/control
echo "Version: ${VERSION}" >> $@/control
echo "Section: ${SECTION}" >> $@/control
echo "Priority: ${PRIORITY}" >> $@/control
echo "Architecture: ${ARCH}" >> $@/control
ifneq (${DEPENDS},)
echo "Depends: ${DEPENDS}" >> $@/control
endif
echo "Installed-Size: ${shell du -s ${PACKAGE_DIR}/data|cut -f1}" \
>> $@/control
echo "Maintainer: ${MAINTAINER}" >> $@/control
printf "Description:" >> $@/control
cat DESCR | ${GAWK} '{print " "$$0;}' >> $@/control
#ifneq (${ICON_SOURCE},)
# echo "Maemo-Icon-26:" >> $@/control
# base64 ${ICON_SOURCE} | ${GAWK} '{print " "$$0;}' >> $@/control
#endif
# Make md5sums.
cd ${PACKAGE_DIR}/data && find . -type f -exec ${MD5SUM} {} \; \
| sed -e 's| \./| |' \
> $@/md5sums

${PACKAGE_DIR}/debian-binary:
echo "2.0" > $@

${PACKAGE_DIR}/clean:
rm -rf ${PACKAGE_DIR}/data ${PACKAGE_DIR}/control ${PACKAGE_DIR}/build *.deb

${PACKAGE_DIR}/build: ${PACKAGE_DIR}/debian-binary ${PACKAGE_DIR}/control \
${PACKAGE_DIR}/data
rm -rf $@
mkdir $@
cp ${PACKAGE_DIR}/debian-binary $@/
cd ${PACKAGE_DIR}/control && tar cJvf $@/control.tar.xz *
cd ${PACKAGE_DIR}/data && \
COPY_EXTENDED_ATTRIBUTES_DISABLE=true \
COPYFILE_DISABLE=true \
tar cpJvf $@/data.tar.xz ./*

# Convert GNU ar to BSD ar that debian requires.
# Note: Order of files within ar archive is important!
${PACKAGE_DIR}/${PACKAGE}_${VERSION}_${ARCH}.deb: ${PACKAGE_DIR}/build
${AR} -rc $@ $</debian-binary $</control.tar.xz $</data.tar.xz
#sed -e 's|^\([^/]\+\)/ \(.*\)|\1 \2|g' $@tmp > $@fail
#rm -f $@tmp
#mv $@fail $@

.PHONY: data
data: ${PACKAGE_DIR}/data

.PHONY: control
control: ${PACKAGE_DIR}/control

.PHONY: build
build: ${PACKAGE_DIR}/build

.PHONY: clean
clean: ${PACKAGE_DIR}/clean
rm -f debian-binary

.PHONY: mrproper
mrproper: clean
echo ${PACKAGE_DIR}
rm -rf root

.PHONY: deb
deb: ${PACKAGE_DIR}/${PACKAGE}_${VERSION}_${ARCH}.deb


clobber::
rm -rf ${PACKAGE_DIR}/debian_binary ${PACKAGE_DIR}/control \
${PACKAGE_DIR}/data ${PACKAGE_DIR}/build

push:
scp *.deb radare.org:/srv/http/radareorg/cydia/debs

0 comments on commit 86053b4

Please sign in to comment.