-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from benhylau/cjdns-deb
Build cjdns deb packages for amd64 and armhf
- Loading branch information
Showing
13 changed files
with
182 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,64 @@ | |
# Build and package cjdns | ||
# | ||
|
||
package_deb: | ||
echo TODO | ||
PACKAGE_NAME = cjdns | ||
VERSION = 20.0 | ||
DEBIAN_REVISION = 1 | ||
MAINTAINER = Benedict Lau <[email protected]> | ||
SOURCE_URL = https://github.com/cjdelisle/cjdns | ||
|
||
TAG = cjdns-v20 | ||
ARCHS = amd64 armhf | ||
BUILD_DIR = /tmp/$(PACKAGE_NAME) | ||
OUTPUT_DIR = /vagrant/output/debian-packages | ||
|
||
# Package deb for a particular architecture | ||
# | ||
# $1 is the architecture | ||
define package_deb_arch | ||
mkdir -p $(BUILD_DIR)/debian/$(1) | ||
cp -r debian $(BUILD_DIR)/debian/$(1)/ # Copy deb package files | ||
sed -i "s|__PACKAGE__|$(PACKAGE_NAME)|g" $(BUILD_DIR)/debian/$(1)/debian/DEBIAN/control # Replace __PACKAGE__ macro in control file | ||
sed -i "s|__VERSION__|$(VERSION)-$(DEBIAN_REVISION)|g" $(BUILD_DIR)/debian/$(1)/debian/DEBIAN/control # Replace __VERSION__ macro in control file | ||
sed -i "s|__ARCHITECTURE__|$(1)|g" $(BUILD_DIR)/debian/$(1)/debian/DEBIAN/control # Replace __ARCHITECTURE__ macro in control file | ||
sed -i "s|__MAINTAINER__|$(MAINTAINER)|g" $(BUILD_DIR)/debian/$(1)/debian/DEBIAN/control # Replace __MAINTAINER__ macro in control file | ||
sed -i "s|__HOMEPAGE__|$(SOURCE_URL)|g" $(BUILD_DIR)/debian/$(1)/debian/DEBIAN/control # Replace __HOMEPAGE__ macro in control file | ||
sed -i "s|__PACKAGE__|$(PACKAGE_NAME)|g" $(BUILD_DIR)/debian/$(1)/debian/usr/share/doc/$(PACKAGE_NAME)/copyright # Replace __PACKAGE__ macro in copyright file | ||
sed -i "s|__MAINTAINER__|$(MAINTAINER)|g" $(BUILD_DIR)/debian/$(1)/debian/usr/share/doc/$(PACKAGE_NAME)/copyright # Replace __MAINTAINER__ macro in copyright file | ||
sed -i "s|__SOURCE__|$(SOURCE_URL)|g" $(BUILD_DIR)/debian/$(1)/debian/usr/share/doc/$(PACKAGE_NAME)/copyright # Replace __SOURCE__ macro in copyright file | ||
cp $(BUILD_DIR)/bin/$(1)/cjdroute $(BUILD_DIR)/debian/$(1)/debian/usr/bin/ # Copy binary | ||
mkdir -p $(BUILD_DIR)/debian/$(1)/debian/lib/systemd/system # Make directories for systemd service files | ||
cp $(BUILD_DIR)/src/contrib/systemd/* $(BUILD_DIR)/debian/$(1)/debian/lib/systemd/system/ # Copy systemd service files | ||
cd $(BUILD_DIR)/debian/$(1); \ | ||
dpkg-deb --build debian; \ | ||
cp debian.deb $(OUTPUT_DIR)/$(PACKAGE_NAME)_$(VERSION)-$(DEBIAN_REVISION)_$(1).deb | ||
endef | ||
|
||
package_deb: build_bin_amd64 build_bin_armhf | ||
$(foreach arch,$(ARCHS),$(call package_deb_arch,$(arch));) | ||
|
||
build_bin_amd64: download_source | ||
mkdir -p $(BUILD_DIR)/bin/amd64 | ||
cd $(BUILD_DIR)/src; \ | ||
./clean; \ | ||
./do; \ | ||
cp cjdroute $(BUILD_DIR)/bin/amd64/ | ||
|
||
build_bin_armhf: mkdir_build | ||
mkdir -p $(BUILD_DIR)/bin/armhf | ||
cp -r docker $(BUILD_DIR)/ | ||
sed -i "s|__TAG__|$(TAG)|g" $(BUILD_DIR)/docker/Dockerfile # Replace __TAG__ macro in Dockerfile | ||
mkdir -p $(BUILD_DIR)/docker/build | ||
cd $(BUILD_DIR)/docker; \ | ||
sudo docker build -t cjdns-armv7hf . # Build armv7hf docker container | ||
sudo docker run --memory="5g" -v /usr/bin/qemu-arm-static:/usr/bin/qemu-arm-static -v $(BUILD_DIR)/docker/build:/tmp/cjdns cjdns-armv7hf # Build binary in emulated ARM docker | ||
cd $(BUILD_DIR)/docker/build; \ | ||
cp cjdroute $(BUILD_DIR)/bin/armhf/ | ||
|
||
download_source: mkdir_build | ||
git clone https://github.com/cjdelisle/cjdns.git -b $(TAG) $(BUILD_DIR)/src | ||
|
||
mkdir_build: | ||
sudo rm -rf $(BUILD_DIR) | ||
mkdir -p $(BUILD_DIR) | ||
mkdir -p $(OUTPUT_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Package: __PACKAGE__ | ||
Version: __VERSION__ | ||
Architecture: __ARCHITECTURE__ | ||
Maintainer: __MAINTAINER__ | ||
Section: net | ||
Priority: optional | ||
Homepage: __HOMEPAGE__ | ||
Description: An encrypted IPv6 network using public-key cryptography for | ||
address allocation and a distributed hash table for routing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh -e | ||
|
||
## from /usr/share/debhelper/autoscripts/postinst-systemd-enable : | ||
|
||
# This will only remove masks created by d-s-h on package removal. | ||
deb-systemd-helper unmask cjdns.service >/dev/null || true | ||
|
||
# was-enabled defaults to true, so new installations run enable. | ||
if deb-systemd-helper --quiet was-enabled cjdns.service; then | ||
# Enables the unit on first installation, creates new | ||
# symlinks on upgrades if the unit file has changed. | ||
deb-systemd-helper enable cjdns.service >/dev/null || true | ||
else | ||
# Update the statefile to add new symlinks (if any), which need to be | ||
# cleaned up on purge. Also remove old symlinks. | ||
deb-systemd-helper update-state cjdns.service >/dev/null || true | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/sh -e | ||
|
||
## from /usr/share/debhelper/autoscripts/postrm-systemd : | ||
|
||
if [ "$1" = "remove" ]; then | ||
if [ -x "/usr/bin/deb-systemd-helper" ]; then | ||
deb-systemd-helper mask cjdns.service >/dev/null | ||
fi | ||
fi | ||
|
||
if [ "$1" = "purge" ]; then | ||
if [ -x "/usr/bin/deb-systemd-helper" ]; then | ||
deb-systemd-helper purge cjdns.service >/dev/null | ||
deb-systemd-helper unmask cjdns.service >/dev/null | ||
fi | ||
|
||
# Remove user configurations | ||
rm -rf /etc/cjdroute.conf | ||
fi | ||
|
||
exit 0 |
Empty file.
16 changes: 16 additions & 0 deletions
16
src/debian-packages/cjdns/debian/usr/share/doc/cjdns/copyright
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
This package was put together by | ||
|
||
__MAINTAINER__ | ||
|
||
from sources obtained from | ||
|
||
__SOURCE__ | ||
|
||
__PACKAGE__ may be used, modified and redistributed only under the terms of | ||
the GNU General Public License, found in the file | ||
|
||
/usr/share/common-licenses/GPL-3 | ||
|
||
on Debian systems, or at | ||
|
||
http://www.fsf.org/licensing/licenses/gpl.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FROM resin/armv7hf-debian:stretch | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN [ "cross-build-start" ] | ||
|
||
# Get tools | ||
RUN { \ | ||
cd /tmp; \ | ||
apt-get update; \ | ||
apt-get install -y build-essential curl git python2.7; \ | ||
ln -s /usr/bin/python2.7 /usr/bin/python; \ | ||
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -; \ | ||
apt-get install -y nodejs; \ | ||
} | ||
|
||
# Download source and build binary | ||
ENTRYPOINT { \ | ||
mkdir /tmp/cjdns; \ | ||
git clone https://github.com/cjdelisle/cjdns.git -b __TAG__ /tmp/cjdns; \ | ||
cd /tmp/cjdns; \ | ||
git checkout __TAG__; \ | ||
NO_TEST=1 Seccomp_NO=1 ./do; \ | ||
} | ||
|
||
RUN [ "cross-build-end" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters