From b312167aaf9021f1204b4d8ee339e26353a28b68 Mon Sep 17 00:00:00 2001
From: Maximilian Ernestus <maximilian@ernestus.de>
Date: Thu, 4 Jul 2019 14:45:37 +0200
Subject: [PATCH 01/11] Add debian package generation script.

---
 DEBIAN/control.in                     | 11 ++++++
 DEBIAN/wscript                        | 11 ++++++
 examples/waftools/strip_on_install.py | 20 ++++++++++
 gen/version.h                         |  2 +-
 scripts/make_debian_package.sh        | 56 +++++++++++++++++++++++++++
 wscript                               |  3 ++
 zcm/js/node/package.json              |  2 +-
 zcm/zcm.h                             |  2 +-
 8 files changed, 104 insertions(+), 3 deletions(-)
 create mode 100644 DEBIAN/control.in
 create mode 100644 DEBIAN/wscript
 create mode 100644 examples/waftools/strip_on_install.py
 create mode 100755 scripts/make_debian_package.sh

diff --git a/DEBIAN/control.in b/DEBIAN/control.in
new file mode 100644
index 00000000..22b16e5f
--- /dev/null
+++ b/DEBIAN/control.in
@@ -0,0 +1,11 @@
+Package: zcm
+Version: @version@-1
+Maintainer: Jonathan Bendes <jonathan@skyspecs.com>
+Section: devel
+Priority: optional
+Build-Essential: yes
+Architecture: amd64
+Depends: default-jre, libzmq5, python, python3, libc6
+Description: Zero Communications and Marshalling Library
+ Communication middleware for various transport layer.
+
diff --git a/DEBIAN/wscript b/DEBIAN/wscript
new file mode 100644
index 00000000..b267927a
--- /dev/null
+++ b/DEBIAN/wscript
@@ -0,0 +1,11 @@
+#! /usr/bin/env python
+# encoding: utf-8
+from waflib import Utils
+
+def build(ctx):
+    ctx(features='subst',
+        source='control.in',
+        target='control',
+        #install_path='${BINDIR}',
+        #chmod=Utils.O755,
+        always=True)
diff --git a/examples/waftools/strip_on_install.py b/examples/waftools/strip_on_install.py
new file mode 100644
index 00000000..9990b814
--- /dev/null
+++ b/examples/waftools/strip_on_install.py
@@ -0,0 +1,20 @@
+#! /usr/bin/env python
+
+"""
+Strip executables upon installation
+"""
+
+import shutil, os
+from waflib import Build, Utils, Context
+
+def copy_fun(self, src, tgt):
+        if Utils.is_win32 and len(tgt) > 259 and not tgt.startswith('\\\\?\\'):
+                tgt = '\\\\?\\' + tgt
+        shutil.copy2(src, tgt)
+        os.chmod(tgt, self.chmod)
+
+        if getattr(self.generator, 'link_task', None):
+                if self.generator.link_task.outputs[0] in self.inputs:
+                        self.generator.bld.cmd_and_log('strip %s' % tgt, quiet=Context.BOTH)
+Build.inst.copy_fun = copy_fun
+
diff --git a/gen/version.h b/gen/version.h
index 1a5534d9..9587be56 100644
--- a/gen/version.h
+++ b/gen/version.h
@@ -1,7 +1,7 @@
 #ifndef _VERSION_H
 #define _VERSION_H
 
-#define ZCM_MAJOR_VERSION 1
+#define ZCM_MAJOR_VERSION 2
 #define ZCM_MINOR_VERSION 0
 #define ZCM_MICRO_VERSION 0
 
diff --git a/scripts/make_debian_package.sh b/scripts/make_debian_package.sh
new file mode 100755
index 00000000..6c2d6721
--- /dev/null
+++ b/scripts/make_debian_package.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+## SETUP
+
+# In this directory we assemble the deb package. Later we call dpkg-deb on it to pack the package.
+DEB_PACKAGE_ASSEMBLY_DIR=./build/deb_package_root
+mkdir -p $DEB_PACKAGE_ASSEMBLY_DIR/usr/
+
+# Required to find java
+export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/
+
+# Change to the directory containing the source code
+THISDIR=$(dirname "$(readlink -f "$0")")
+BASEDIR=$(dirname $THISDIR)
+cd $BASEDIR
+
+
+## BUILD
+
+# Build with python2 support and install to temporary $DEB_PACKAGE_ASSEMBLY_DIR/usr directory
+export PYTHON=/usr/bin/python2
+./waf configure --use-java --use-python --use-elf --use-clang --use-udpm --use-ipc --use-zmq --use-inproc --use-serial -d -s --prefix=$DEB_PACKAGE_ASSEMBLY_DIR/usr/
+./waf build
+./waf install
+
+# Build again for python3 and install to the temporary $DEB_PACKAGE_ASSEMBLY_DIR/usr directory.
+# Note 1: This overrides most of the already existing files except for the python2 files in usr/lib/python2.7 <- this is to be considered an ugly hack but I found no other way to make waf build for python2 AND python3
+# Note 2: we use --targets=pyzcm to hopefully not build everything again
+export PYTHON=/usr/bin/python3
+./waf configure --use-java --use-python --use-elf --use-clang --use-udpm --use-ipc --use-zmq --use-inproc --use-serial -d -s --prefix=$DEB_PACKAGE_ASSEMBLY_DIR/usr/
+./waf build --targets=pyzcm
+./waf install
+
+
+### HACKS TO PREPARE DEBIAN PACKAGE STRUCTURE
+
+# Move the debian control files directory to the temporary $DEB_PACKAGE_ASSEMBLY_DIR
+cp -r ./build/DEBIAN $DEB_PACKAGE_ASSEMBLY_DIR
+
+
+cd $DEB_PACKAGE_ASSEMBLY_DIR
+# Unfortunately waf automatically installs to 'pythonX.X/site-packages' as soon as the root directory is not contained in the install prefix.
+# We need it in 'dist-packages' so we just rename it manually here.
+# Note: since this modifies the folder structure that 'find' is iterating, it causes find to print an error such as "find: ‘./usr/lib/python3.6/site-packages’: No such file or directory". It works anyways ...
+find -type d -wholename '*python*/site-packages' -execdir mv ./site-packages ./dist-packages \;
+
+# There is a number of files in which the install prefix appears such as the java launchers in usr/bin and the package-config files.
+# This is undesirable since the temporary install prefix in $DEB_PACKAGE_ASSEMBLY_DIR is obviously wrong after the files have been installed.
+# The following lines replaces all occurences of the $DEB_PACKAGE_ASSEMBLY_DIR as path with '/usr' which is our actual install prefix with the debian package.
+find -type f -exec sed -i "s+$PWD++g" {} +
+cd -
+
+### PACK DEBIAN PACKAGE
+##  Debian compliance: fakeroot is required to get correct uids and gids for all installed files
+fakeroot dpkg-deb -b $DEB_PACKAGE_ASSEMBLY_DIR
+mv $DEB_PACKAGE_ASSEMBLY_DIR.deb ./build/zcm.deb
diff --git a/wscript b/wscript
index 3884e1e1..dce43a9c 100644
--- a/wscript
+++ b/wscript
@@ -87,6 +87,7 @@ def configure(ctx):
     ctx.load('compiler_c')
     ctx.load('compiler_cxx')
     ctx.recurse('config')
+    ctx.load('strip_on_install')
 
     ctx.env.variantsEnabledByConfigure = ['examples', 'tests']
 
@@ -414,6 +415,8 @@ def build(ctx):
         ctx.recurse('config')
         ctx.recurse('gen')
         ctx.recurse('tools')
+   	ctx.recurse('DEBIAN')
+	ctx.install_as('${PREFIX}/share/doc/zcm/copyright', 'LICENSE')
         generate_signature(ctx)
 
 
diff --git a/zcm/js/node/package.json b/zcm/js/node/package.json
index a69d12af..54c49ddd 100644
--- a/zcm/js/node/package.json
+++ b/zcm/js/node/package.json
@@ -1,6 +1,6 @@
 {
   "name": "zerocm",
-  "version": "1.0.0",
+  "version": "2.0.0",
   "description": "Bindings to Zero Communications and Marshalling",
   "dependencies": {
     "big-integer": "^1.6.25",
diff --git a/zcm/zcm.h b/zcm/zcm.h
index dd010850..034d95eb 100644
--- a/zcm/zcm.h
+++ b/zcm/zcm.h
@@ -11,7 +11,7 @@ extern "C" {
  *   m: Minor
  *   u: Micro
  */
-#define ZCM_MAJOR_VERSION 1
+#define ZCM_MAJOR_VERSION 2
 #define ZCM_MINOR_VERSION 0
 #define ZCM_MICRO_VERSION 0
 

From 130cb812a3ec187efedcee382886fff14fbd3153 Mon Sep 17 00:00:00 2001
From: Maximilian Ernestus <maximilian@ernestus.de>
Date: Fri, 5 Jul 2019 14:13:48 +0200
Subject: [PATCH 02/11] Build debian package with --use-all

---
 scripts/make_debian_package.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/make_debian_package.sh b/scripts/make_debian_package.sh
index 6c2d6721..c2f607a0 100755
--- a/scripts/make_debian_package.sh
+++ b/scripts/make_debian_package.sh
@@ -19,7 +19,7 @@ cd $BASEDIR
 
 # Build with python2 support and install to temporary $DEB_PACKAGE_ASSEMBLY_DIR/usr directory
 export PYTHON=/usr/bin/python2
-./waf configure --use-java --use-python --use-elf --use-clang --use-udpm --use-ipc --use-zmq --use-inproc --use-serial -d -s --prefix=$DEB_PACKAGE_ASSEMBLY_DIR/usr/
+./waf configure --use-all --use-third-party --use-clang -d -s --prefix=$DEB_PACKAGE_ASSEMBLY_DIR/usr/
 ./waf build
 ./waf install
 
@@ -27,7 +27,7 @@ export PYTHON=/usr/bin/python2
 # Note 1: This overrides most of the already existing files except for the python2 files in usr/lib/python2.7 <- this is to be considered an ugly hack but I found no other way to make waf build for python2 AND python3
 # Note 2: we use --targets=pyzcm to hopefully not build everything again
 export PYTHON=/usr/bin/python3
-./waf configure --use-java --use-python --use-elf --use-clang --use-udpm --use-ipc --use-zmq --use-inproc --use-serial -d -s --prefix=$DEB_PACKAGE_ASSEMBLY_DIR/usr/
+./waf configure --use-all --use-third-party --use-clang -d -s --prefix=$DEB_PACKAGE_ASSEMBLY_DIR/usr/
 ./waf build --targets=pyzcm
 ./waf install
 

From e576eef723ea1da6fde9b838757a5a4fe2ef2cf4 Mon Sep 17 00:00:00 2001
From: Maximilian Ernestus <maximilian@ernestus.de>
Date: Fri, 5 Jul 2019 14:26:21 +0200
Subject: [PATCH 03/11] Insert @version@ to the package config templates.

---
 config/zcm-tools.pc.in | 2 +-
 config/zcm.pc.in       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/config/zcm-tools.pc.in b/config/zcm-tools.pc.in
index fc9a9a11..8a8d0121 100644
--- a/config/zcm-tools.pc.in
+++ b/config/zcm-tools.pc.in
@@ -6,5 +6,5 @@ jardir=${datarootdir}/java
 Name: zcm
 Description: Zero Communications and Marshalling (ZCM) Java Tools
 Requires:
-Version: 1.0.0
+Version: @version@
 classpath=${jardir}/zcm-tools.jar
diff --git a/config/zcm.pc.in b/config/zcm.pc.in
index e54376d1..21f196bd 100644
--- a/config/zcm.pc.in
+++ b/config/zcm.pc.in
@@ -8,7 +8,7 @@ jardir=${datarootdir}/java
 Name: zcm
 Description: Zero Communications and Marshalling (ZCM)
 Requires:
-Version: 1.0.0
+Version: @version@
 Libs: -L${libdir} -lzcm
 Cflags: -I${includedir}
 classpath=${jardir}/zcm.jar

From e1a2347c310f48688fcc835198db854ff503ca0a Mon Sep 17 00:00:00 2001
From: Maximilian Ernestus <maximilian@ernestus.de>
Date: Fri, 5 Jul 2019 17:18:07 +0200
Subject: [PATCH 04/11] Properly name the debian file

---
 scripts/make_debian_package.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/make_debian_package.sh b/scripts/make_debian_package.sh
index c2f607a0..c0e8b2f8 100755
--- a/scripts/make_debian_package.sh
+++ b/scripts/make_debian_package.sh
@@ -53,4 +53,4 @@ cd -
 ### PACK DEBIAN PACKAGE
 ##  Debian compliance: fakeroot is required to get correct uids and gids for all installed files
 fakeroot dpkg-deb -b $DEB_PACKAGE_ASSEMBLY_DIR
-mv $DEB_PACKAGE_ASSEMBLY_DIR.deb ./build/zcm.deb
+dpkg-name $DEB_PACKAGE_ASSEMBLY_DIR.deb

From 4e339608cf50bcf30e01d84508d665c219590166 Mon Sep 17 00:00:00 2001
From: Maximilian Ernestus <maximilian@ernestus.de>
Date: Tue, 3 Sep 2019 11:34:23 +0200
Subject: [PATCH 05/11] move strop_on_install

---
 {examples/waftools => waftools}/strip_on_install.py | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename {examples/waftools => waftools}/strip_on_install.py (100%)

diff --git a/examples/waftools/strip_on_install.py b/waftools/strip_on_install.py
similarity index 100%
rename from examples/waftools/strip_on_install.py
rename to waftools/strip_on_install.py

From 147c6ba0508be1c1d174a0df6ec402fc7752800e Mon Sep 17 00:00:00 2001
From: Jonathan Bendes <jonathan@skyspecs.com>
Date: Fri, 24 Apr 2020 01:03:19 -0400
Subject: [PATCH 06/11] Minor formatting

---
 scripts/make_debian_package.sh | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/scripts/make_debian_package.sh b/scripts/make_debian_package.sh
index c0e8b2f8..18f74a41 100755
--- a/scripts/make_debian_package.sh
+++ b/scripts/make_debian_package.sh
@@ -24,7 +24,9 @@ export PYTHON=/usr/bin/python2
 ./waf install
 
 # Build again for python3 and install to the temporary $DEB_PACKAGE_ASSEMBLY_DIR/usr directory.
-# Note 1: This overrides most of the already existing files except for the python2 files in usr/lib/python2.7 <- this is to be considered an ugly hack but I found no other way to make waf build for python2 AND python3
+# Note 1: This overrides most of the already existing files except for the python2
+#         files in usr/lib/python2.7 <- this is to be considered an ugly hack but
+#         I found no other way to make waf build for python2 AND python3
 # Note 2: we use --targets=pyzcm to hopefully not build everything again
 export PYTHON=/usr/bin/python3
 ./waf configure --use-all --use-third-party --use-clang -d -s --prefix=$DEB_PACKAGE_ASSEMBLY_DIR/usr/
@@ -39,14 +41,21 @@ cp -r ./build/DEBIAN $DEB_PACKAGE_ASSEMBLY_DIR
 
 
 cd $DEB_PACKAGE_ASSEMBLY_DIR
-# Unfortunately waf automatically installs to 'pythonX.X/site-packages' as soon as the root directory is not contained in the install prefix.
+# Unfortunately waf automatically installs to 'pythonX.X/site-packages' as soon as the
+# root directory is not contained in the install prefix.
 # We need it in 'dist-packages' so we just rename it manually here.
-# Note: since this modifies the folder structure that 'find' is iterating, it causes find to print an error such as "find: ‘./usr/lib/python3.6/site-packages’: No such file or directory". It works anyways ...
+# Note: since this modifies the folder structure that 'find' is iterating, it causes
+#       find to print an error such as:
+#       "find: ‘./usr/lib/python3.6/site-packages’: No such file or directory".
+# It works anyways ...
 find -type d -wholename '*python*/site-packages' -execdir mv ./site-packages ./dist-packages \;
 
-# There is a number of files in which the install prefix appears such as the java launchers in usr/bin and the package-config files.
-# This is undesirable since the temporary install prefix in $DEB_PACKAGE_ASSEMBLY_DIR is obviously wrong after the files have been installed.
-# The following lines replaces all occurences of the $DEB_PACKAGE_ASSEMBLY_DIR as path with '/usr' which is our actual install prefix with the debian package.
+# There are a number of files in which the install prefix appears such as the java
+# launchers in usr/bin and the package-config files.
+# This is undesirable since the temporary install prefix in $DEB_PACKAGE_ASSEMBLY_DIR
+# is obviously wrong after the files have been installed.
+# The following lines replaces all occurences of the $DEB_PACKAGE_ASSEMBLY_DIR as
+# path with '/usr' which is our actual install prefix with the debian package.
 find -type f -exec sed -i "s+$PWD++g" {} +
 cd -
 

From 291e1b6fd1cd9c1e0a4e0b34d3bde28d767123d4 Mon Sep 17 00:00:00 2001
From: Jonathan Bendes <jonathan@skyspecs.com>
Date: Sat, 25 Apr 2020 01:13:24 -0400
Subject: [PATCH 07/11] Trying a release

---
 .github/workflows/release.yml | 14 +++++++++++++-
 DEBIAN/control.in             |  4 ++--
 DEBIAN/wscript                |  2 --
 gen/version.h                 |  2 +-
 zcm/js/node/package.json      |  2 +-
 zcm/zcm.h                     |  2 +-
 6 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 93ad78fa..b82803c7 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -20,10 +20,22 @@ jobs:
         id: create_release
         uses: actions/create-release@latest
         env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
         with:
           tag_name: ${{ github.ref }}
           release_name: Release ${{ github.ref }}
           body: ${{ steps.changelog.outputs.body }}
           draft: true
           prerelease: true
+      - name: Build Deb
+        run: |
+          ./scripts/make_debian_package.sh
+      - name: Upload Deb
+        id: upload-release-asset
+        uses: actions/upload-release-asset@v1
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        with:
+          upload_url: ${{ steps.create_release.outputs.upload_url }}
+          asset_path: ./build/deb_package_root.deb
+          asset_name: zcm.deb
diff --git a/DEBIAN/control.in b/DEBIAN/control.in
index 22b16e5f..7101b9ae 100644
--- a/DEBIAN/control.in
+++ b/DEBIAN/control.in
@@ -5,7 +5,7 @@ Section: devel
 Priority: optional
 Build-Essential: yes
 Architecture: amd64
-Depends: default-jre, libzmq5, python, python3, libc6
+Depends: default-jre, libzmq5, python, python3, libc6, libelf1
 Description: Zero Communications and Marshalling Library
- Communication middleware for various transport layer.
+ Communication middleware for various transport layers.
 
diff --git a/DEBIAN/wscript b/DEBIAN/wscript
index b267927a..90484a9a 100644
--- a/DEBIAN/wscript
+++ b/DEBIAN/wscript
@@ -6,6 +6,4 @@ def build(ctx):
     ctx(features='subst',
         source='control.in',
         target='control',
-        #install_path='${BINDIR}',
-        #chmod=Utils.O755,
         always=True)
diff --git a/gen/version.h b/gen/version.h
index 9587be56..1a5534d9 100644
--- a/gen/version.h
+++ b/gen/version.h
@@ -1,7 +1,7 @@
 #ifndef _VERSION_H
 #define _VERSION_H
 
-#define ZCM_MAJOR_VERSION 2
+#define ZCM_MAJOR_VERSION 1
 #define ZCM_MINOR_VERSION 0
 #define ZCM_MICRO_VERSION 0
 
diff --git a/zcm/js/node/package.json b/zcm/js/node/package.json
index 54c49ddd..a69d12af 100644
--- a/zcm/js/node/package.json
+++ b/zcm/js/node/package.json
@@ -1,6 +1,6 @@
 {
   "name": "zerocm",
-  "version": "2.0.0",
+  "version": "1.0.0",
   "description": "Bindings to Zero Communications and Marshalling",
   "dependencies": {
     "big-integer": "^1.6.25",
diff --git a/zcm/zcm.h b/zcm/zcm.h
index 034d95eb..dd010850 100644
--- a/zcm/zcm.h
+++ b/zcm/zcm.h
@@ -11,7 +11,7 @@ extern "C" {
  *   m: Minor
  *   u: Micro
  */
-#define ZCM_MAJOR_VERSION 2
+#define ZCM_MAJOR_VERSION 1
 #define ZCM_MINOR_VERSION 0
 #define ZCM_MICRO_VERSION 0
 

From 791d3cc032fc30b61878a490830d66f6e7899835 Mon Sep 17 00:00:00 2001
From: Jonathan Bendes <jonathan@skyspecs.com>
Date: Sat, 25 Apr 2020 01:24:00 -0400
Subject: [PATCH 08/11] Anoter try

---
 .github/workflows/release.yml | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index b82803c7..9dcc512c 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -9,9 +9,20 @@ jobs:
   build:
     name: Create Release
     runs-on: ubuntu-16.04
+    defaults:
+      run:
+        shell: bash -l {0}
     steps:
       - name: Checkout code
         uses: actions/checkout@master
+      - name: env
+        run: |
+            echo "::add-path::$(pwd)/deps/julia/bin"
+      - name: deps
+        run: ./scripts/install-deps.sh -i -s
+      - name: Build Deb
+        run: |
+          ./scripts/make_debian_package.sh
       - name: Read CHANGELOG
         id: changelog
         run: |
@@ -27,9 +38,6 @@ jobs:
           body: ${{ steps.changelog.outputs.body }}
           draft: true
           prerelease: true
-      - name: Build Deb
-        run: |
-          ./scripts/make_debian_package.sh
       - name: Upload Deb
         id: upload-release-asset
         uses: actions/upload-release-asset@v1
@@ -39,3 +47,4 @@ jobs:
           upload_url: ${{ steps.create_release.outputs.upload_url }}
           asset_path: ./build/deb_package_root.deb
           asset_name: zcm.deb
+          asset_content_type: application/octet-stream

From 53d1775079797768995c1c43d76fc30b5cea7cbc Mon Sep 17 00:00:00 2001
From: Jonathan Bendes <jonathan@skyspecs.com>
Date: Sat, 25 Apr 2020 01:57:12 -0400
Subject: [PATCH 09/11] A bit more work

---
 .github/workflows/release.yml  |  7 +++++--
 scripts/make_debian_package.sh | 15 +++++++++++----
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 9dcc512c..0937a231 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -21,8 +21,11 @@ jobs:
       - name: deps
         run: ./scripts/install-deps.sh -i -s
       - name: Build Deb
+        id: builddeb
         run: |
           ./scripts/make_debian_package.sh
+          echo "::set-output name=pkgpath::$(find build -name '*.deb')"
+          echo "::set-output name=pkgname::$(basename $(find build -name '*.deb'))"
       - name: Read CHANGELOG
         id: changelog
         run: |
@@ -45,6 +48,6 @@ jobs:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
         with:
           upload_url: ${{ steps.create_release.outputs.upload_url }}
-          asset_path: ./build/deb_package_root.deb
-          asset_name: zcm.deb
+          asset_path: ${{ steps.builddeb.outputs.pkgpath }}
+          asset_name: ${{ steps.builddeb.outputs.pkgname }}
           asset_content_type: application/octet-stream
diff --git a/scripts/make_debian_package.sh b/scripts/make_debian_package.sh
index 18f74a41..2f71fb92 100755
--- a/scripts/make_debian_package.sh
+++ b/scripts/make_debian_package.sh
@@ -1,5 +1,8 @@
 #!/bin/bash
 
+set -euo pipefail
+IFS=$'\n\t'
+
 ## SETUP
 
 # In this directory we assemble the deb package. Later we call dpkg-deb on it to pack the package.
@@ -7,7 +10,9 @@ DEB_PACKAGE_ASSEMBLY_DIR=./build/deb_package_root
 mkdir -p $DEB_PACKAGE_ASSEMBLY_DIR/usr/
 
 # Required to find java
-export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/
+if [ -z ${JAVA_HOME+x} ]; then
+    export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")
+fi
 
 # Change to the directory containing the source code
 THISDIR=$(dirname "$(readlink -f "$0")")
@@ -17,9 +22,11 @@ cd $BASEDIR
 
 ## BUILD
 
+./waf configure distclean
+
 # Build with python2 support and install to temporary $DEB_PACKAGE_ASSEMBLY_DIR/usr directory
 export PYTHON=/usr/bin/python2
-./waf configure --use-all --use-third-party --use-clang -d -s --prefix=$DEB_PACKAGE_ASSEMBLY_DIR/usr/
+./waf configure --use-all --use-third-party --prefix=$DEB_PACKAGE_ASSEMBLY_DIR/usr/
 ./waf build
 ./waf install
 
@@ -29,7 +36,7 @@ export PYTHON=/usr/bin/python2
 #         I found no other way to make waf build for python2 AND python3
 # Note 2: we use --targets=pyzcm to hopefully not build everything again
 export PYTHON=/usr/bin/python3
-./waf configure --use-all --use-third-party --use-clang -d -s --prefix=$DEB_PACKAGE_ASSEMBLY_DIR/usr/
+./waf configure --use-all --use-third-party --prefix=$DEB_PACKAGE_ASSEMBLY_DIR/usr/
 ./waf build --targets=pyzcm
 ./waf install
 
@@ -48,7 +55,7 @@ cd $DEB_PACKAGE_ASSEMBLY_DIR
 #       find to print an error such as:
 #       "find: ‘./usr/lib/python3.6/site-packages’: No such file or directory".
 # It works anyways ...
-find -type d -wholename '*python*/site-packages' -execdir mv ./site-packages ./dist-packages \;
+find -type d -wholename '*python*/site-packages' -execdir mv ./site-packages ./dist-packages \; || true
 
 # There are a number of files in which the install prefix appears such as the java
 # launchers in usr/bin and the package-config files.

From 90b5f6b84364b0072914fb550f1af6e54c18b2a0 Mon Sep 17 00:00:00 2001
From: Jonathan Bendes <jonathan@skyspecs.com>
Date: Sat, 25 Apr 2020 02:04:46 -0400
Subject: [PATCH 10/11] Corrected version

---
 DEBIAN/control.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/DEBIAN/control.in b/DEBIAN/control.in
index 7101b9ae..03112359 100644
--- a/DEBIAN/control.in
+++ b/DEBIAN/control.in
@@ -1,5 +1,5 @@
 Package: zcm
-Version: @version@-1
+Version: @version@
 Maintainer: Jonathan Bendes <jonathan@skyspecs.com>
 Section: devel
 Priority: optional

From de8e6ba27d2b20a033e225ffcfe9c83a9c645791 Mon Sep 17 00:00:00 2001
From: Jonathan Bendes <jonathan@skyspecs.com>
Date: Sat, 25 Apr 2020 02:06:01 -0400
Subject: [PATCH 11/11] Finalized release

---
 .github/workflows/release.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 0937a231..cc0b452d 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -39,8 +39,8 @@ jobs:
           tag_name: ${{ github.ref }}
           release_name: Release ${{ github.ref }}
           body: ${{ steps.changelog.outputs.body }}
-          draft: true
-          prerelease: true
+          draft: false
+          prerelease: false
       - name: Upload Deb
         id: upload-release-asset
         uses: actions/upload-release-asset@v1