new package: pdftk

This commit is contained in:
Tee KOBAYASHI 2021-12-12 01:28:25 +09:00 committed by Leonid Pliushch
parent 2e4a7b71ac
commit 52f907cd85
3 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,38 @@
--- a/java/com/gitlab/pdftk_java/com/lowagie/text/pdf/PdfPKCS7.java
+++ b/java/com/gitlab/pdftk_java/com/lowagie/text/pdf/PdfPKCS7.java
@@ -296,7 +296,7 @@ public class PdfPKCS7 {
ASN1TaggedObject tagsig = (ASN1TaggedObject)signerInfo.getObjectAt(next);
ASN1Sequence sseq = (ASN1Sequence)tagsig.getObject();
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
- ASN1OutputStream dout = new ASN1OutputStream(bOut);
+ ASN1OutputStream dout = ASN1OutputStream.create(bOut);
try {
ASN1EncodableVector attribute = new ASN1EncodableVector();
for (int k = 0; k < sseq.size(); ++k) {
@@ -735,7 +735,7 @@ public class PdfPKCS7 {
digest = sig.sign();
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
- ASN1OutputStream dout = new ASN1OutputStream(bOut);
+ ASN1OutputStream dout = ASN1OutputStream.create(bOut);
dout.writeObject(new DEROctetString(digest));
dout.close();
@@ -906,7 +906,7 @@ public class PdfPKCS7 {
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
- ASN1OutputStream dout = new ASN1OutputStream(bOut);
+ ASN1OutputStream dout = ASN1OutputStream.create(bOut);
dout.writeObject(new DERSequence(whole));
dout.close();
@@ -962,7 +962,7 @@ public class PdfPKCS7 {
attribute.add(new DERSequence(v));
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
- ASN1OutputStream dout = new ASN1OutputStream(bOut);
+ ASN1OutputStream dout = ASN1OutputStream.create(bOut);
dout.writeObject(new DERSet(attribute));
dout.close();

27
packages/pdftk/build.sh Normal file
View File

@ -0,0 +1,27 @@
TERMUX_PKG_HOMEPAGE=https://gitlab.com/pdftk-java/pdftk
TERMUX_PKG_DESCRIPTION="A simple tool for doing everyday things with PDF documents"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=3.3.1
TERMUX_PKG_SRCURL=https://gitlab.com/pdftk-java/pdftk/-/archive/v${TERMUX_PKG_VERSION}/pdftk-v${TERMUX_PKG_VERSION}.tar.bz2
TERMUX_PKG_SHA256=1d1199b02108b4f762209534b8342e79f474c007384dfa70174514e91205a2a7
TERMUX_PKG_DEPENDS="libbcprov-java, libcommons-lang3-java, openjdk-17"
TERMUX_PKG_BUILD_DEPENDS="ant"
TERMUX_PKG_PLATFORM_INDEPENDENT=true
TERMUX_PKG_BUILD_IN_SRC=true
termux_step_pre_configure() {
mkdir -p lib
ln -sf $TERMUX_PREFIX/share/java/commons-lang3.jar lib/
ln -sf $TERMUX_PREFIX/share/java/bcprov.jar lib/
}
termux_step_make() {
sh $TERMUX_PREFIX/bin/ant jar
}
termux_step_make_install() {
mkdir -p $TERMUX_PREFIX/share/java
install -Dm600 build/jar/pdftk.jar $TERMUX_PREFIX/share/java/
install -Dm700 pdftk $TERMUX_PREFIX/bin/
}

View File

@ -0,0 +1,5 @@
--- a/pdftk
+++ b/pdftk
@@ -0,0 +1,2 @@
+#!@TERMUX_PREFIX@/bin/sh
+exec java -jar @TERMUX_PREFIX@/share/java/pdftk.jar "$@"