Source: qr-code-generator
Version: 1.7.0-2
Severity: wishlist
Tags: patch

Hi,

the new version of src:jameica depends on the java-fast implementation
of qr-code-generator which is part of version 1.8. I have imported the
new version locally and added the attached patch on top to build the
java package. Note that it needs some patching to compile with maven
which I send upstream here:

https://github.com/nayuki/QR-Code-generator/pull/143

Could you update the version in Salsa and apply the attached patch?
I could also push my version if you give me write access to the repo.
Also I would be happy to sponsor the new package to get through new.

Cheers Jochen


-- System Information:
Debian Release: bookworm/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.17.0-1-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
>From 11fda9ed89d3196c27822db7679f10df322fb2ef Mon Sep 17 00:00:00 2001
From: Jochen Sprickerhof <jspri...@debian.org>
Date: Thu, 5 May 2022 10:06:58 +0200
Subject: [PATCH] Add libfastqrcodegen-java package

---
 debian/control                                |  28 ++++
 debian/libfastqrcodegen-java.poms             |   1 +
 debian/maven.ignoreRules                      |   4 +
 debian/maven.rules                            |   1 +
 .../patches/0003-Add-java-fast-pom.xml.patch  | 151 ++++++++++++++++++
 debian/patches/series                         |   1 +
 debian/rules                                  |  19 +++
 7 files changed, 205 insertions(+)
 create mode 100644 debian/libfastqrcodegen-java.poms
 create mode 100644 debian/maven.ignoreRules
 create mode 100644 debian/maven.rules
 create mode 100644 debian/patches/0003-Add-java-fast-pom.xml.patch

diff --git a/debian/control b/debian/control
index c2c180f..1650984 100644
--- a/debian/control
+++ b/debian/control
@@ -4,9 +4,12 @@ Priority: optional
 Maintainer: Yangfl <mmyan...@gmail.com>
 Build-Depends:
  debhelper-compat (= 13),
+ default-jdk,
+ maven-debian-helper,
 Build-Depends-Indep:
  dh-python,
  python3,
+ libmaven-compiler-plugin-java,
  python3-setuptools,
 Rules-Requires-Root: no
 Standards-Version: 4.6.0
@@ -138,3 +141,28 @@ Description: QR Code generator library in multiple 
languages - Python3 version
   * Open source code under the permissive MIT License
  .
  This package contains the module in Python3.
+
+Package: libfastqrcodegen-java
+Section: java
+Architecture: all
+Multi-Arch: foreign
+Depends: ${misc:Depends}, ${maven:Depends}, ${maven:CompileDepends}
+Description: QR Code generator library in multiple languages - fast Java 
version
+ This project aims to be the best, clearest QR Code generator library in
+ multiple languages. The primary goals are flexible options and absolute
+ correctness. Secondary goals are compact implementation size and good
+ documentation comments. Core features:
+  * Available in 7 programming languages, all with nearly equal functionality:
+    Java, JavaScript, TypeScript, Python, C++, C, Rust
+  * Significantly shorter code but more documentation comments compared to
+    competing libraries
+  * Supports encoding all 40 versions (sizes) and all 4 error correction 
levels,
+    as per the QR Code Model 2 standard
+  * Output formats: Raw modules/pixels of the QR symbol (all languages), SVG 
XML
+    string (all languages except C), BufferedImage raster bitmap (Java only),
+    HTML5 canvas (JavaScript and TypeScript only)
+  * Encodes numeric and special-alphanumeric text in less space than general
+    text
+  * Open source code under the permissive MIT License
+ .
+ This package contains the fast libarary for Java.
diff --git a/debian/libfastqrcodegen-java.poms 
b/debian/libfastqrcodegen-java.poms
new file mode 100644
index 0000000..e613562
--- /dev/null
+++ b/debian/libfastqrcodegen-java.poms
@@ -0,0 +1 @@
+java-fast/pom.xml --has-package-version
diff --git a/debian/maven.ignoreRules b/debian/maven.ignoreRules
new file mode 100644
index 0000000..a7175a8
--- /dev/null
+++ b/debian/maven.ignoreRules
@@ -0,0 +1,4 @@
+org.apache.maven.plugins maven-gpg-plugin * * * *
+org.apache.maven.plugins maven-javadoc-plugin * * * *
+org.apache.maven.plugins maven-release-plugin * * * *
+org.apache.maven.plugins maven-source-plugin * * * *
diff --git a/debian/maven.rules b/debian/maven.rules
new file mode 100644
index 0000000..038c2cd
--- /dev/null
+++ b/debian/maven.rules
@@ -0,0 +1 @@
+io.nayuki fastqrcodegen jar s/.*/debian/ * *
diff --git a/debian/patches/0003-Add-java-fast-pom.xml.patch 
b/debian/patches/0003-Add-java-fast-pom.xml.patch
new file mode 100644
index 0000000..534056c
--- /dev/null
+++ b/debian/patches/0003-Add-java-fast-pom.xml.patch
@@ -0,0 +1,151 @@
+From: Jochen Sprickerhof <jspri...@debian.org>
+Date: Thu, 5 May 2022 16:33:09 +0200
+Subject: Add java-fast/pom.xml
+
+https://github.com/nayuki/QR-Code-generator/pull/143
+---
+ java-fast/pom.xml | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 135 insertions(+)
+ create mode 100644 java-fast/pom.xml
+
+diff --git a/java-fast/pom.xml b/java-fast/pom.xml
+new file mode 100644
+index 0000000..19bcd3a
+--- /dev/null
++++ b/java-fast/pom.xml
+@@ -0,0 +1,135 @@
++<?xml version="1.0" encoding="UTF-8"?>
++<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
++      <modelVersion>4.0.0</modelVersion>
++
++      <groupId>io.nayuki</groupId>
++      <artifactId>fastqrcodegen</artifactId>
++      <version>1.8.0</version>
++      <packaging>jar</packaging>
++      <properties>
++              
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
++      </properties>
++
++
++      <build>
++              <plugins>
++
++                      <plugin>
++                              <groupId>org.apache.maven.plugins</groupId>
++                              <artifactId>maven-compiler-plugin</artifactId>
++                              <version>3.8.1</version>
++                              <executions>
++                                      <execution>
++                                              <id>default-compile</id>
++                                              <configuration>
++                                                      <release>9</release>
++                                              </configuration>
++                                      </execution>
++                                      <execution>
++                                              <id>java8-compile</id>
++                                              <goals>
++                                                      <goal>compile</goal>
++                                              </goals>
++                                              <configuration>
++                                                      <source>1.8</source>
++                                                      <target>1.8</target>
++                                                      <excludes>
++                                                              
<exclude>module-info.java</exclude>
++                                                      </excludes>
++                                              </configuration>
++                                      </execution>
++                              </executions>
++                      </plugin>
++
++                      <plugin>
++                              <groupId>org.apache.maven.plugins</groupId>
++                              <artifactId>maven-release-plugin</artifactId>
++                              <configuration>
++                                      <checkModificationExcludes>
++                                              
<checkModificationExclude>java-fast/pom.xml</checkModificationExclude>
++                                      </checkModificationExcludes>
++                              </configuration>
++                      </plugin>
++
++                      <plugin>
++                              <groupId>org.apache.maven.plugins</groupId>
++                              <artifactId>maven-source-plugin</artifactId>
++                              <version>2.2.1</version>
++                              <executions>
++                                      <execution>
++                                              <id>attach-sources</id>
++                                              <goals>
++                                                      <goal>jar-no-fork</goal>
++                                              </goals>
++                                      </execution>
++                              </executions>
++                      </plugin>
++
++                      <plugin>
++                              <groupId>org.apache.maven.plugins</groupId>
++                              <artifactId>maven-javadoc-plugin</artifactId>
++                              <version>3.1.1</version>
++                              <executions>
++                                      <execution>
++                                              <id>attach-javadocs</id>
++                                              <goals>
++                                                      <goal>jar</goal>
++                                              </goals>
++                                      </execution>
++                              </executions>
++                      </plugin>
++
++                      <plugin>
++                              <groupId>org.apache.maven.plugins</groupId>
++                              <artifactId>maven-gpg-plugin</artifactId>
++                              <version>1.5</version>
++                              <executions>
++                                      <execution>
++                                              <id>sign-artifacts</id>
++                                              <phase>verify</phase>
++                                              <goals>
++                                                      <goal>sign</goal>
++                                              </goals>
++                                      </execution>
++                              </executions>
++                      </plugin>
++
++              </plugins>
++      </build>
++
++
++      <name>Fast QR Code generator library</name>
++      <description>High quality fast QR Code generator library</description>
++      <url>https://www.nayuki.io/page/qr-code-generator-library</url>
++      <inceptionYear>2016</inceptionYear>
++      <licenses>
++              <license>
++                      <name>The MIT License</name>
++                      <url>https://opensource.org/licenses/MIT</url>
++                      <distribution>repo</distribution>
++              </license>
++      </licenses>
++      <developers>
++              <developer>
++                      <name>Project Nayuki</name>
++                      <email>m...@nayuki.io</email>
++                      <url>https://www.nayuki.io/</url>
++              </developer>
++      </developers>
++
++      <scm>
++              
<connection>scm:git:git://github.com/nayuki/QR-Code-generator.git</connection>
++              
<developerConnection>scm:git:ssh://github.com:nayuki/QR-Code-generator.git</developerConnection>
++              
<url>https://github.com/nayuki/QR-Code-generator/tree/master/java-fast</url>
++      </scm>
++      <distributionManagement>
++              <snapshotRepository>
++                      <id>ossrh</id>
++                      
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
++              </snapshotRepository>
++              <repository>
++                      <id>ossrh</id>
++                      
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
++              </repository>
++      </distributionManagement>
++</project>
diff --git a/debian/patches/series b/debian/patches/series
index 494c965..c21b53b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 0001-Make-C-shared-lib.patch
 0002-Make-C-shared-lib.patch
+0003-Add-java-fast-pom.xml.patch
diff --git a/debian/rules b/debian/rules
index 9bff7c0..a5652b8 100755
--- a/debian/rules
+++ b/debian/rules
@@ -28,12 +28,31 @@ clean:
 
 override_dh_auto_clean-indep:
        -dh_auto_clean --buildsystem=pybuild --sourcedirectory=python/
+       # mh_(un)patchpoms does not obeye --sourcedirectory
+       mh_patchpoms -plibfastqrcodegen-java
+       dh_auto_clean --buildsystem=maven --sourcedirectory=java-fast/ 
-plibfastqrcodegen-java
+       mh_unpatchpoms -plibfastqrcodegen-java
+       rm -rf java-fast/src
        rm -rf python/qrcodegen.egg-info
 
+execute_before_dh_auto_configure-indep:
+       # mddir, ln: workaround till upstream has a build system
+       mkdir -p java-fast/src/main/java/
+       ln -s -t java-fast/src/main/java/ ../../../io/
+       dh_auto_configure --buildsystem=maven -plibfastqrcodegen-java
+
 override_dh_auto_build-indep:
        dh_auto_build --buildsystem=pybuild --sourcedirectory=python/
+       dh_auto_build --buildsystem=maven --sourcedirectory=java-fast/
 
 override_dh_auto_install-indep:
+       # mv, sed, rm: work around buildsystem=maven calling 
mh_resolve_dependencies in java-fast/
+       mv java-fast/pom.xml.save java-fast/pom.xml.backup
+       dh_auto_install -plibfastqrcodegen-java --buildsystem=maven 
--sourcedirectory=java-fast/
+       mv java-fast/pom.xml.backup java-fast/pom.xml.save
+       mh_unpatchpoms -plibfastqrcodegen-java
+       sed -i 's/maven\./maven:/' debian/libfastqrcodegen-java.substvars
+       rm -r java-fast/.debianVersion java-fast/debian/
        dh_auto_install --buildsystem=pybuild --sourcedirectory=python/
 
 override_dh_auto_clean-arch:
-- 
2.36.0

Reply via email to