Package: java-package
Version: 0.54
Severity: wishlist
Tags: patch

Please support creating a Debian source package instead of only creating a
Debian binary package. I want to use make-jpkg to create a Debian source package
that I can upload to our build infrastructure to get it build and released to
our local repository.

I created a bunch of patches (attached) to create a full source package that can
be build with dpkg-buildpackage.
>From 863de6685b954cdacef2a51cc81c320620a00cfd Mon Sep 17 00:00:00 2001
From: Benjamin Drung <benjamin.dr...@profitbricks.com>
Date: Thu, 24 Apr 2014 22:03:08 +0200
Subject: [PATCH 7/8] Fix path reference of copyright files.

---
 lib/javase.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/javase.sh b/lib/javase.sh
index d8ea025..7efc779 100644
--- a/lib/javase.sh
+++ b/lib/javase.sh
@@ -51,7 +51,7 @@ EOF
     while read file; do
         cat << EOF
 
-File: /$file
+File: $jvm_base$file
 
 ----------------------------------------------------------------------
 
-- 
1.9.1

>From 963868700195579560097814cff159da39992acd Mon Sep 17 00:00:00 2001
From: Benjamin Drung <benjamin.dr...@profitbricks.com>
Date: Thu, 24 Apr 2014 17:26:12 +0200
Subject: [PATCH 2/8] Bump Standards-Version of guest package to 3.9.5.

---
 lib/javase.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/javase.sh b/lib/javase.sh
index 65c6272..e8b1cce 100644
--- a/lib/javase.sh
+++ b/lib/javase.sh
@@ -29,7 +29,7 @@ Section: non-free/devel
 Priority: optional
 Maintainer: $maintainer_name <$maintainer_email>
 Build-Depends: debhelper (>= 4.0.0)
-Standards-Version: 3.7.2
+Standards-Version: 3.9.5
 
 EOF
 }
-- 
1.9.1

>From 1bdd95a489fdd6698d903a8ed6856538ada7dbd8 Mon Sep 17 00:00:00 2001
From: Benjamin Drung <benjamin.dr...@profitbricks.com>
Date: Thu, 24 Apr 2014 21:51:14 +0200
Subject: [PATCH 5/8] Add ${misc:Depends} to the guest dependency.

---
 lib/jdk-doc.sh | 4 +---
 lib/jdk.sh     | 2 +-
 lib/jre.sh     | 2 +-
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/jdk-doc.sh b/lib/jdk-doc.sh
index 4dbfa04..a1891ba 100644
--- a/lib/jdk-doc.sh
+++ b/lib/jdk-doc.sh
@@ -3,9 +3,7 @@ j2sdk_doc_control() {
     cat << EOF
 Package: $j2se_package
 Architecture: any
-Depends: 
-Recommends: 
-Provides: 
+Depends: \${misc:Depends}
 Description: $j2se_title
  The Java(TM) SE JDK is a development environment for building
  applications, applets, and components that can be deployed on the
diff --git a/lib/jdk.sh b/lib/jdk.sh
index 55802e6..220f213 100644
--- a/lib/jdk.sh
+++ b/lib/jdk.sh
@@ -15,7 +15,7 @@ j2sdk_control() {
     cat << EOF
 Package: $j2se_package
 Architecture: any
-Depends: $depends
+Depends: \${misc:Depends}, $depends
 Recommends: netbase
 Provides: java-virtual-machine, java-runtime, java2-runtime, java${j2se_release}-runtime, java$((${j2se_release}-1))-runtime, java$((${j2se_release}-2))-runtime, $java_browser_plugin java-compiler, java2-compiler, java-runtime-headless, java2-runtime-headless, java${j2se_release}-runtime-headless, java$((${j2se_release}-1))-runtime-headless, java$((${j2se_release}-2))-runtime-headless, java-sdk, java2-sdk, java$((${j2se_release}-2))-sdk, java$((${j2se_release}-1))-sdk, java${j2se_release}-sdk
 Description: $j2se_title
diff --git a/lib/jre.sh b/lib/jre.sh
index 9d12cb6..9154993 100644
--- a/lib/jre.sh
+++ b/lib/jre.sh
@@ -4,7 +4,7 @@ j2re_control() {
     cat << EOF
 Package: $j2se_package
 Architecture: any
-Depends: \${shlibs:Depends}
+Depends: \${misc:Depends}, \${shlibs:Depends}
 Recommends: netbase
 Provides: java-virtual-machine, java-runtime, java2-runtime, java${j2se_release}-runtime, java$((${j2se_release}-1))-runtime, java$((${j2se_release}-2))-runtime, java-runtime-headless, java2-runtime-headless, java${j2se_release}-runtime-headless, java$((${j2se_release}-1))-runtime-headless, java$((${j2se_release}-2))-runtime-headless, java-browser-plugin
 Description: $j2se_title
-- 
1.9.1

>From 4afb08b562eb8d8f9ece2e477d108baf41ffedf1 Mon Sep 17 00:00:00 2001
From: Benjamin Drung <benjamin.dr...@profitbricks.com>
Date: Thu, 24 Apr 2014 17:28:30 +0200
Subject: [PATCH 3/8] Use debhelper 9 for guest package.

---
 debian/control | 2 +-
 lib/javase.sh  | 3 +--
 lib/jdk-doc.sh | 2 +-
 lib/jdk.sh     | 2 +-
 lib/jre.sh     | 2 +-
 5 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/debian/control b/debian/control
index 834396c..753f37b 100644
--- a/debian/control
+++ b/debian/control
@@ -10,7 +10,7 @@ Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-java/java-package.git
 
 Package: java-package
 Architecture: all
-Depends: ${misc:Depends}, debhelper, fakeroot, unzip, libx11-6, libasound2,
+Depends: ${misc:Depends}, debhelper (>= 9), fakeroot, unzip, libx11-6, libasound2,
  lsb-release
 Recommends: dpkg-dev, gcc
 Suggests: openjdk-7-jre
diff --git a/lib/javase.sh b/lib/javase.sh
index e8b1cce..cb4ed49 100644
--- a/lib/javase.sh
+++ b/lib/javase.sh
@@ -28,7 +28,7 @@ Source: $j2se_package
 Section: non-free/devel
 Priority: optional
 Maintainer: $maintainer_name <$maintainer_email>
-Build-Depends: debhelper (>= 4.0.0)
+Build-Depends: debhelper (>= 9)
 Standards-Version: 3.9.5
 
 EOF
@@ -197,7 +197,6 @@ j2se_build() {
     echo "Create debian package:"
     
     #export DH_VERBOSE=1
-    export DH_COMPAT=7
     export DH_OPTIONS=--tmpdir="$install_dir"
 
     echo "    dh_testdir"
diff --git a/lib/jdk-doc.sh b/lib/jdk-doc.sh
index 2e3924d..d9efde7 100644
--- a/lib/jdk-doc.sh
+++ b/lib/jdk-doc.sh
@@ -44,7 +44,7 @@ j2sdk_doc_run() {
     install -d -m 755 "$( dirname "$target" )"
     extract_bin "$archive_path" "$j2se_expected_min_size" "$target"
     rm -rf "$target/.systemPrefs"
-    echo "7" > "$debian_dir/compat"
+    echo "9" > "$debian_dir/compat"
     j2se_readme > "$debian_dir/README.Debian"
     j2se_changelog > "$debian_dir/changelog"
     j2sdk_doc_control > "$debian_dir/control"
diff --git a/lib/jdk.sh b/lib/jdk.sh
index 29b2f8a..9205fab 100644
--- a/lib/jdk.sh
+++ b/lib/jdk.sh
@@ -44,7 +44,7 @@ j2sdk_run() {
     install -d -m 755 "$( dirname "$target" )"
     extract_bin "$archive_path" "$j2se_expected_min_size" "$target"
     rm -rf "$target/.systemPrefs"
-    echo "7" > "$debian_dir/compat"
+    echo "9" > "$debian_dir/compat"
     j2se_readme > "$debian_dir/README.Debian"
     j2se_changelog > "$debian_dir/changelog"
     j2sdk_control > "$debian_dir/control"
diff --git a/lib/jre.sh b/lib/jre.sh
index 850c18f..5231e38 100644
--- a/lib/jre.sh
+++ b/lib/jre.sh
@@ -30,7 +30,7 @@ j2re_run() {
     install -d -m 755 "$( dirname "$target" )"
     extract_bin "$archive_path" "$j2se_expected_min_size" "$target"
     rm -rf "$target/.systemPrefs"
-    echo "7" > "$debian_dir/compat"
+    echo "9" > "$debian_dir/compat"
     j2se_readme > "$debian_dir/README.Debian"
     j2se_changelog > "$debian_dir/changelog"
     j2re_control > "$debian_dir/control"
-- 
1.9.1

>From 515a468b68f1f5eb980a1cbe5268b7a666b08376 Mon Sep 17 00:00:00 2001
From: Benjamin Drung <benjamin.dr...@profitbricks.com>
Date: Thu, 24 Apr 2014 21:56:43 +0200
Subject: [PATCH 6/8] Remove trailing spaces.

---
 README            |  2 +-
 debian/changelog  | 36 ++++++++++++++++++------------------
 debian/copyright  |  2 +-
 lib/common.sh     | 14 +++++++-------
 lib/javase.sh     | 10 +++++-----
 lib/oracle-jdk.sh |  4 ++--
 make-jpkg         |  6 +++---
 make-jpkg.1       |  4 ++--
 8 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/README b/README
index 7367c22..4436370 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
 
-* To be done : 
+* To be done :
 
 - update java-package wiki page : http://wiki.debian.org/JavaPackage?action=edit&editor=text
 - make symbolic links for j2se/jre/bin/* in j2se/bin/ to avoid duplication
diff --git a/debian/changelog b/debian/changelog
index ef3d97d..46c198d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -134,7 +134,7 @@ java-package (0.50) unstable; urgency=low
   * debian-rules-missing-recommended-target removed
   * maintainer-script-lacks-debhelper-token removed
   * Declare the debian/compat to 7 to avoid warnings
-  
+
   [ Michael Koch ]
   * Remove Java plugins for all browsers (Closes: #367887).
   * Add support for Sun Java 6 Update XX (Closes: #514364).
@@ -257,13 +257,13 @@ java-package (0.28) unstable; urgency=low
     (Closes: #338569)
   * Corrected pathing for alternatives installation for Mozilla and
     Firefox plugins (Closes: #341751)
-  * Relaxed architectural restrictions on plugin alternative 
+  * Relaxed architectural restrictions on plugin alternative
     installation for IBM Java 5 JREs and JDKs (Closes: #343837)
   * Added plugin installation for the new packaging of Firefox 1.5 and
     later (Closes: #341749)
-  * Modified warning suppression for dh_shlibdeps to accommodate 
+  * Modified warning suppression for dh_shlibdeps to accommodate
     changes in dpkg-dev (Closes: #354427)
-  * Added quotes to variable tests for maintainer name and email 
+  * Added quotes to variable tests for maintainer name and email
     (Closes: #342623)
   * Refactored architecture evaluation to eliminate repetition and
     evaluate DEB_BUILD_GNU_TYPE correctly for i486-linux-gnu
@@ -289,7 +289,7 @@ java-package (0.26) unstable; urgency=low
   * Resolve issues with powerpc-linux support detection (Closes: #317671)
   * Added support for Blackdown 1.4.2+02 release (Closes: #316831)
   * Added support for packaging Sun JDK documentation (Closes: #272971)
-  * Modified make-jpkg behavior to default the generated packages' 
+  * Modified make-jpkg behavior to default the generated packages'
     name and email address for the maintainer to Debian Java Maintainers
     (Closes: #325554)
 
@@ -305,7 +305,7 @@ java-package (0.25) unstable; urgency=low
 java-package (0.24) unstable; urgency=low
 
   * Added plugin alternatives support for i386 IBM JREs and JDKs
-  * Corrected pathing for plugin alternatives to reflect difference in 
+  * Corrected pathing for plugin alternatives to reflect difference in
     layout between JREs and JDKs for Sun and Blackdown (Closes: #305219,
     #301806)
 
@@ -313,7 +313,7 @@ java-package (0.24) unstable; urgency=low
 
 java-package (0.23.1) experimental; urgency=low
 
-  * Added architecture-specific pathing for plugin alternatives for 
+  * Added architecture-specific pathing for plugin alternatives for
     Blackdown 1.3 and 1.4 JREs and JDKs
 
  -- Barry Hawkins <ba...@bytemason.org>  Wed, 06 Apr 2005 00:03:40 -0500
@@ -321,9 +321,9 @@ java-package (0.23.1) experimental; urgency=low
 java-package (0.23) unstable; urgency=low
 
   * Further expanded 1.3.1 Blackdown JRE/JDK support for i386
-  * Added architecture-specific pathing for plugin alternatives for 
+  * Added architecture-specific pathing for plugin alternatives for
     Sun 1.4 and 1.5 JREs and JDKs (Closes: #301806)
-  * Added recommends for system elements required by applets and 
+  * Added recommends for system elements required by applets and
     graphical user interface elements (Closes: #300817)
   * Jeroen van Wolffelaar:
     + Fixed packages description to not have too long lines, and make the 3
@@ -336,24 +336,24 @@ java-package (0.22.1) experimental; urgency=low
   * Corrected IBM and Blackdown JRE/JDK file size specifications
   * Added support for additional 1.3.1 Blackdown JREs and JDKs for i386,
     powerpc (Closes: #301092)
-  * Added installation of javaws alternative for Sun 1.5 JREs and JDKs 
+  * Added installation of javaws alternative for Sun 1.5 JREs and JDKs
     (Closes: #300303)
 
  -- Barry Hawkins <ba...@bytemason.org>  Thu, 24 Mar 2005 13:20:18 -0500
 
 java-package (0.22) unstable; urgency=low
 
-  * Corrected IBM JRE/JDK scripts to accurately reflect the supported 
+  * Corrected IBM JRE/JDK scripts to accurately reflect the supported
     IBM JDKs and JREs in the generated SUPPORTED file
 
  -- Barry Hawkins <ba...@alltc.com>  Fri, 18 Mar 2005 10:21:53 -0500
 
 java-package (0.21) unstable; urgency=low
 
-  * Enable support for IBM JDKs and JREs for x86, amd64, powerpc, 
-    powerpc64, and s390 architectures, based upon a patch by Rico 
+  * Enable support for IBM JDKs and JREs for x86, amd64, powerpc,
+    powerpc64, and s390 architectures, based upon a patch by Rico
     Schiekel (Closes: #264137)
-  * Enable suppport for Blackdown 1.3.1 JDK and JRE for PowerPC 
+  * Enable suppport for Blackdown 1.3.1 JDK and JRE for PowerPC
     architecture. (Closes: #296205)
   * Update documentation and to reflect current supported JDKs and JREs
 
@@ -475,7 +475,7 @@ java-package (0.12) unstable; urgency=low
 
 java-package (0.11) unstable; urgency=low
 
-  * change package name java-package and the command build package is 
+  * change package name java-package and the command build package is
     make-jpkg.
 
  -- Takashi Okamoto <t...@debian.org>  Sat, 31 Jul 2004 15:07:36 +0900
@@ -483,9 +483,9 @@ java-package (0.11) unstable; urgency=low
 java-package (0.10) unstable; urgency=low
 
   * change package name mpkg-j2se.
-  * not use *-j2[re|sdk]debian package. Instead of this, add package 
-    dependency to generated package. This reduce the installation for 
-    such extra package. 
+  * not use *-j2[re|sdk]debian package. Instead of this, add package
+    dependency to generated package. This reduce the installation for
+    such extra package.
   * SUN's jdk1.5 beta2 support.
 
  -- Takashi Okamoto <t...@debian.org>  Sun, 18 Jul 2004 13:53:36 +0900
diff --git a/debian/copyright b/debian/copyright
index 3028586..e77187e 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -19,7 +19,7 @@ License: GPL-2
  .
  You should have received a copy of the GNU General Public License
  along with this package; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  02110-1301  USA.
  .
  On Debian systems, the complete text of the GNU General Public License
diff --git a/lib/common.sh b/lib/common.sh
index a9ed231..ec10531 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -69,7 +69,7 @@ EOF
     mkdir "$extract_dir"
     cd "$extract_dir"
     echo
-    
+
     local extract_cmd
     case "$archive_path" in
     *.tar)
@@ -83,7 +83,7 @@ EOF
     *)
         extract_cmd=sh
     esac
-    
+
     if ! $extract_cmd "$archive_path"; then
     cat << EOF
 
@@ -137,7 +137,7 @@ read_maintainer_info() {
         maintainer_name="$DEBNAME"
     else
         default_name="$(getent passwd $(id -run) | cut -d: -f5| cut -d, -f1)"
-    
+
     cat << EOF
 
 Please enter your full name. This value will be used in the maintainer
@@ -154,12 +154,12 @@ EOF
     done
     fi
     fi
-    
+
     if [ -z "$maintainer_email" ]; then
     local default_email=
     if [ -n "$DEBEMAIL" ]; then
         maintainer_email="$DEBEMAIL"
-    else 
+    else
     if [ -r "/etc/mailname" ]; then
         default_email="$( id -run )@$( cat /etc/mailname )"
     else
@@ -187,9 +187,9 @@ get_architecture() {
     export DEB_BUILD_ARCH=$(dpkg-architecture -qDEB_BUILD_ARCH)
 
     export DEB_BUILD_GNU_TYPE=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE)
-    
+
     echo "Detected Debian build architecture: ${DEB_BUILD_ARCH:-N/A}"
-    
+
     echo "Detected Debian GNU type: ${DEB_BUILD_GNU_TYPE:-N/A}"
 }
 
diff --git a/lib/javase.sh b/lib/javase.sh
index c3c6a88..d8ea025 100644
--- a/lib/javase.sh
+++ b/lib/javase.sh
@@ -3,7 +3,7 @@ j2se_readme() {
 Package for $j2se_title
 ---
 
-This package has been automatically created with java-package ($version). 
+This package has been automatically created with java-package ($version).
 All files from the original distribution should have been installed in
 the directory $jvm_base$j2se_name. Please take a look at this directory for
 further information.
@@ -45,7 +45,7 @@ subdirectories.
 
 ----------------------------------------------------------------------
 EOF
-    ( 
+    (
     cd "$package_dir"
     find * -type f -iname copyright ! -path debian/copyright |
     while read file; do
@@ -137,7 +137,7 @@ fi
 exit 0
 EOF
     chmod 755 "$debian_dir/postinst"
-    
+
     cat > "$debian_dir/prerm" << EOF
 #!/bin/bash
 
@@ -194,7 +194,7 @@ jinfos() {
     program_base="$2"
     shift ; shift
     for program in $*; do
-      echo "$prefix $program $program_base$program" 
+      echo "$prefix $program $program_base$program"
     done
 }
 
@@ -207,7 +207,7 @@ j2se_build() {
     local deb_filename="$( echo "${j2se_package}_"*.deb )"
     echo "    copy $deb_filename into directory $working_dir/"
     cp "$deb_filename" "$working_dir/"
-    if [ -n "$genchanges" ]; then 
+    if [ -n "$genchanges" ]; then
         echo "    dpkg-genchanges"
         local changes_filename="${deb_filename%.deb}.changes"
         echo "    copy $changes_filename into directory $working_dir/"
diff --git a/lib/oracle-jdk.sh b/lib/oracle-jdk.sh
index 6d45ce5..aba8be5 100644
--- a/lib/oracle-jdk.sh
+++ b/lib/oracle-jdk.sh
@@ -74,8 +74,8 @@ oracle_j2sdk_detect() {
       echo "The archive $archive_name is not supported on the ${DEB_BUILD_ARCH} architecture"
       return
     fi
-    
-    
+
+
     cat << EOF
 
 Detected product:
diff --git a/make-jpkg b/make-jpkg
index a075633..9eb0fab 100755
--- a/make-jpkg
+++ b/make-jpkg
@@ -15,8 +15,8 @@ lib_dir="/usr/share/java-package"
 [ "$J2SE_PACKAGE_LIBDIR" ] && lib_dir="$J2SE_PACKAGE_LIBDIR"
 
 # If a default has been set for either of the
-# environment variables, use it; otherwise, 
-# default to the name and email used by the 
+# environment variables, use it; otherwise,
+# default to the name and email used by the
 # Debian Java Maintainers project.
 if [ -z "$J2SE_PACKAGE_FULL_NAME" ]; then
     maintainer_name="Debian Java Maintainers"
@@ -226,7 +226,7 @@ jvm_base="/usr/lib/jvm/"
 javadoc_base="/usr/share/doc/"
 
 j2se_found=
-for var in ${!j2se_detect_*}; do 
+for var in ${!j2se_detect_*}; do
     eval "\$$var"
     if [[ "$j2se_found" == "true" ]]; then
     break;
diff --git a/make-jpkg.1 b/make-jpkg.1
index 9575561..2b6baad 100644
--- a/make-jpkg.1
+++ b/make-jpkg.1
@@ -22,7 +22,7 @@ make-jpkg \- builds Debian packages from Java binary distributions
 [\fIOPTION\fR]... [\fIFILE\fR]
 .SH DESCRIPTION
 .\" TeX users may be more comfortable with the \fB<whatever>\fP and
-.\" \fI<whatever>\fP escape sequences to invode bold face and italics, 
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
 .\" respectively.
 .PP
 \fBmake-jpkg\fP builds a Debian package from the given Java
@@ -65,7 +65,7 @@ information and builds a Debian binary package in the current
 directory.
 .PP
 The program requires about 200 MB free disk space in a temporary
-directory. The temporary directory defaults to 
+directory. The temporary directory defaults to
 .I /tmp
 but you can specify an alternate directory by setting the environment
 variable \fITMPDIR\fR.
-- 
1.9.1

>From 60dde2b9a5eeecc67b5cf15f0597cf31a2375505 Mon Sep 17 00:00:00 2001
From: Benjamin Drung <benjamin.dr...@profitbricks.com>
Date: Thu, 24 Apr 2014 21:45:55 +0200
Subject: [PATCH 4/8] Use dpkg-buildpackage to build the guest package.

---
 debian/control |  4 ++--
 lib/javase.sh  | 58 ++++++++++++----------------------------------------------
 lib/jdk-doc.sh |  3 ++-
 lib/jdk.sh     |  6 ++++--
 lib/jre.sh     |  6 ++++--
 make-jpkg      |  8 ++++----
 6 files changed, 28 insertions(+), 57 deletions(-)

diff --git a/debian/control b/debian/control
index 753f37b..db98df0 100644
--- a/debian/control
+++ b/debian/control
@@ -10,9 +10,9 @@ Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-java/java-package.git
 
 Package: java-package
 Architecture: all
-Depends: ${misc:Depends}, debhelper (>= 9), fakeroot, unzip, libx11-6, libasound2,
+Depends: ${misc:Depends}, debhelper (>= 9), dpkg-dev, fakeroot, unzip, libx11-6, libasound2,
  lsb-release
-Recommends: dpkg-dev, gcc
+Recommends: gcc
 Suggests: openjdk-7-jre
 Description: Utility for creating Java Debian packages
  This package provides the capability to build a Debian package from
diff --git a/lib/javase.sh b/lib/javase.sh
index cb4ed49..c3c6a88 100644
--- a/lib/javase.sh
+++ b/lib/javase.sh
@@ -46,8 +46,8 @@ subdirectories.
 ----------------------------------------------------------------------
 EOF
     ( 
-    cd "$install_dir"
-    find * -type f -iname copyright |
+    cd "$package_dir"
+    find * -type f -iname copyright ! -path debian/copyright |
     while read file; do
         cat << EOF
 
@@ -71,6 +71,12 @@ j2se_rules() {
 
 %:
 	dh \$@
+
+override_dh_compress:
+	dh_compress \$(shell find $j2se_name/man/ -type f ! -name '*.gz' -printf '${jvm_base##/}/%p\n')
+
+override_dh_shlibdeps:
+	dh_shlibdeps --exclude=fxavcodecplugin -l\$(shell find $j2se_name -type f -name '*.so*' -printf '${jvm_base##/}/%h\n' | sort -u | tr '\n' ':' | sed 's/:\$\$//')
 EOF
 }
 
@@ -193,57 +199,17 @@ jinfos() {
 }
 
 j2se_build() {
-    cd "$tmp"
+    cd "$package_dir"
     echo "Create debian package:"
-    
-    #export DH_VERBOSE=1
-    export DH_OPTIONS=--tmpdir="$install_dir"
-
-    echo "    dh_testdir"
-    dh_testdir
-    echo "    dh_testroot"
-    dh_testroot
-    echo "    dh_installchangelogs"
-    dh_installchangelogs
-    # Problem: dh_installchangelogs thinks this is a native package.
-    echo "    dh_installdocs"
-    dh_installdocs
-    # dh_install
-    # dh_link
-    # Conditionally wrapping this as not all JRE/JDKs have man directories
-    if [ -e "$install_dir/$jvm_base$j2se_name/man" ]; then
-        echo "    dh_compress"
-        dh_compress $( find "$install_dir/$jvm_base$j2se_name/man" -type f ! -name "*.gz" )
-    fi
-    echo "    dh_fixperms"
-    dh_fixperms
-    echo "    dh_installdeb"
-    dh_installdeb
-    echo "    dh_shlibdeps"
-    ldpath=
-    for dir in $( find "$install_dir" -type f -name "*.so*" -printf "%h\n" | sort -u ); do
-        if [[ -z "$ldpath" ]]; then
-            ldpath="$dir"
-        else
-            ldpath="$ldpath:$dir"
-        fi
-    done
-    # suppress some warnings
-    dh_shlibdeps --exclude=fxavcodecplugin -l"$ldpath" 2>&1 |
-    { grep -v "warning: format of \`NEEDED lib.*\.so' not recognized" >&2 || true; }
-    echo "    dh_gencontrol"
-    dh_gencontrol
-    echo "    dh_md5sums"
-    dh_md5sums
-    echo "    dh_builddeb"
-    dh_builddeb --destdir="$tmp"
+
+    dpkg-buildpackage -b -uc -us
+    cd "$tmp"
     local deb_filename="$( echo "${j2se_package}_"*.deb )"
     echo "    copy $deb_filename into directory $working_dir/"
     cp "$deb_filename" "$working_dir/"
     if [ -n "$genchanges" ]; then 
         echo "    dpkg-genchanges"
         local changes_filename="${deb_filename%.deb}.changes"
-        dpkg-genchanges -b -u. > "$changes_filename"
         echo "    copy $changes_filename into directory $working_dir/"
         cp "$changes_filename" "$working_dir/"
     fi
diff --git a/lib/jdk-doc.sh b/lib/jdk-doc.sh
index d9efde7..4dbfa04 100644
--- a/lib/jdk-doc.sh
+++ b/lib/jdk-doc.sh
@@ -40,7 +40,7 @@ j2sdk_doc_run() {
     read_maintainer_info
     j2se_package="$j2se_vendor-java$j2se_release-doc"
     j2se_name="jdk$j2se_release-$j2se_vendor-doc"
-    local target="$install_dir$javadoc_base$j2se_name"
+    local target="$package_dir/$j2se_name"
     install -d -m 755 "$( dirname "$target" )"
     extract_bin "$archive_path" "$j2se_expected_min_size" "$target"
     rm -rf "$target/.systemPrefs"
@@ -49,6 +49,7 @@ j2sdk_doc_run() {
     j2se_changelog > "$debian_dir/changelog"
     j2sdk_doc_control > "$debian_dir/control"
     j2se_copyright > "$debian_dir/copyright"
+    echo "$j2se_name $javadoc_base" > "$debian_dir/install"
     j2sdk_doc_doc-base > "$debian_dir/$j2se_package.doc-base"
     j2se_rules > "$debian_dir/rules"
     chmod +x "$debian_dir/rules"
diff --git a/lib/jdk.sh b/lib/jdk.sh
index 9205fab..55802e6 100644
--- a/lib/jdk.sh
+++ b/lib/jdk.sh
@@ -40,7 +40,7 @@ j2sdk_run() {
     read_maintainer_info
     j2se_package="$j2se_vendor-java$j2se_release-jdk"
     j2se_name="jdk-$j2se_release-$j2se_vendor-$j2se_arch"
-    local target="$install_dir$jvm_base$j2se_name"
+    local target="$package_dir/$j2se_name"
     install -d -m 755 "$( dirname "$target" )"
     extract_bin "$archive_path" "$j2se_expected_min_size" "$target"
     rm -rf "$target/.systemPrefs"
@@ -49,11 +49,13 @@ j2sdk_run() {
     j2se_changelog > "$debian_dir/changelog"
     j2sdk_control > "$debian_dir/control"
     j2se_copyright > "$debian_dir/copyright"
+    echo "$j2se_name $jvm_base" > "$debian_dir/install"
     j2se_rules > "$debian_dir/rules"
     chmod +x "$debian_dir/rules"
     j2se_install_scripts
     install -d "$target/debian"
     j2se_info > "$target/debian/info"
-    eval "$j2se_jinfo" > "$install_dir$jvm_base.$j2se_name.jinfo"
+    eval "$j2se_jinfo" > "$package_dir/.$j2se_name.jinfo"
+    echo ".$j2se_name.jinfo $jvm_base" >> "$debian_dir/install"
     j2se_build
 }
diff --git a/lib/jre.sh b/lib/jre.sh
index 5231e38..9d12cb6 100644
--- a/lib/jre.sh
+++ b/lib/jre.sh
@@ -26,7 +26,7 @@ j2re_run() {
     read_maintainer_info
     j2se_package="$j2se_vendor-java$j2se_release-jre"
     j2se_name="jre-$j2se_release-$j2se_vendor-$j2se_arch"
-    local target="$install_dir$jvm_base$j2se_name"
+    local target="$package_dir/$j2se_name"
     install -d -m 755 "$( dirname "$target" )"
     extract_bin "$archive_path" "$j2se_expected_min_size" "$target"
     rm -rf "$target/.systemPrefs"
@@ -35,11 +35,13 @@ j2re_run() {
     j2se_changelog > "$debian_dir/changelog"
     j2re_control > "$debian_dir/control"
     j2se_copyright > "$debian_dir/copyright"
+    echo "$j2se_name $jvm_base" > "$debian_dir/install"
     j2se_rules > "$debian_dir/rules"
     chmod +x "$debian_dir/rules"
     j2se_install_scripts
     install -d "$target/debian"
     j2se_info > "$target/debian/info"
-    eval "$j2se_jinfo" > "$install_dir$jvm_base.$j2se_name.jinfo"
+    eval "$j2se_jinfo" > "$package_dir/.$j2se_name.jinfo"
+    echo ".$j2se_name.jinfo $jvm_base" >> "$debian_dir/install"
     j2se_build
 }
diff --git a/make-jpkg b/make-jpkg
index f22594a..a075633 100755
--- a/make-jpkg
+++ b/make-jpkg
@@ -200,11 +200,11 @@ echo -n "Creating temporary directory: "
 tmp="$( mktemp -d -t "$program_name.XXXXXXXXXX" )"
 echo "$tmp"
 
-debian_dir="$tmp/debian"
-install -d -m 755 "$debian_dir"
+package_dir="$tmp/package"
+install -d -m 755 "$package_dir"
 
-install_dir="$tmp/install"
-install -d -m 755 "$install_dir"
+debian_dir="$package_dir/debian"
+install -d -m 755 "$debian_dir"
 
 # load and execute plugins
 echo -n "Loading plugins:"
-- 
1.9.1

>From 92c704efbdbe8a0ab8535dfc60cc8d616bcd309b Mon Sep 17 00:00:00 2001
From: Benjamin Drung <benjamin.dr...@profitbricks.com>
Date: Thu, 24 Apr 2014 17:25:00 +0200
Subject: [PATCH 1/8] Create a debian/rules file.

---
 lib/javase.sh  | 9 +++++++++
 lib/jdk-doc.sh | 2 ++
 lib/jdk.sh     | 2 ++
 lib/jre.sh     | 2 ++
 4 files changed, 15 insertions(+)

diff --git a/lib/javase.sh b/lib/javase.sh
index 6e081cd..65c6272 100644
--- a/lib/javase.sh
+++ b/lib/javase.sh
@@ -65,6 +65,15 @@ EOF
     )
 }
 
+j2se_rules() {
+    cat << EOF
+#!/usr/bin/make -f
+
+%:
+	dh \$@
+EOF
+}
+
 j2se_install_scripts() {
     cat > "$debian_dir/postinst" << EOF
 #!/bin/bash
diff --git a/lib/jdk-doc.sh b/lib/jdk-doc.sh
index baca98e..2e3924d 100644
--- a/lib/jdk-doc.sh
+++ b/lib/jdk-doc.sh
@@ -50,6 +50,8 @@ j2sdk_doc_run() {
     j2sdk_doc_control > "$debian_dir/control"
     j2se_copyright > "$debian_dir/copyright"
     j2sdk_doc_doc-base > "$debian_dir/$j2se_package.doc-base"
+    j2se_rules > "$debian_dir/rules"
+    chmod +x "$debian_dir/rules"
     j2se_install_scripts
     install -d "$target/debian"
     j2se_info > "$target/debian/info"
diff --git a/lib/jdk.sh b/lib/jdk.sh
index ae8d96f..29b2f8a 100644
--- a/lib/jdk.sh
+++ b/lib/jdk.sh
@@ -49,6 +49,8 @@ j2sdk_run() {
     j2se_changelog > "$debian_dir/changelog"
     j2sdk_control > "$debian_dir/control"
     j2se_copyright > "$debian_dir/copyright"
+    j2se_rules > "$debian_dir/rules"
+    chmod +x "$debian_dir/rules"
     j2se_install_scripts
     install -d "$target/debian"
     j2se_info > "$target/debian/info"
diff --git a/lib/jre.sh b/lib/jre.sh
index da86095..850c18f 100644
--- a/lib/jre.sh
+++ b/lib/jre.sh
@@ -35,6 +35,8 @@ j2re_run() {
     j2se_changelog > "$debian_dir/changelog"
     j2re_control > "$debian_dir/control"
     j2se_copyright > "$debian_dir/copyright"
+    j2se_rules > "$debian_dir/rules"
+    chmod +x "$debian_dir/rules"
     j2se_install_scripts
     install -d "$target/debian"
     j2se_info > "$target/debian/info"
-- 
1.9.1

>From ef5b9525df011b2a8cf3b2c9bb2e954b00c077c5 Mon Sep 17 00:00:00 2001
From: Benjamin Drung <benjamin.dr...@profitbricks.com>
Date: Thu, 24 Apr 2014 22:04:27 +0200
Subject: [PATCH 8/8] Remove empty new lines at end of files.

---
 lib/javase.sh | 2 --
 1 file changed, 2 deletions(-)

diff --git a/lib/javase.sh b/lib/javase.sh
index 7efc779..31c4bbb 100644
--- a/lib/javase.sh
+++ b/lib/javase.sh
@@ -7,7 +7,6 @@ This package has been automatically created with java-package ($version).
 All files from the original distribution should have been installed in
 the directory $jvm_base$j2se_name. Please take a look at this directory for
 further information.
-
 EOF
 }
 
@@ -18,7 +17,6 @@ $j2se_package ($j2se_version) unstable; urgency=low
   * This package was created with java-package ($version).
 
  -- $maintainer_name <$maintainer_email>  $( date -R )
-
 EOF
 }
 
-- 
1.9.1

Reply via email to