~alpine/devel

1

[alpine-devel] [PATCH 1/2] Add Xpdf, an X11/Motif PDF viewer.

Isaac Dunham <ibid.ag@gmail.com>
Details
Message ID
<1403475856-4621-1-git-send-email-ibid.ag@gmail.com>
Sender timestamp
1403475856
DKIM signature
missing
Download raw message
Patch: +146 -0
---
 testing/xpdf/APKBUILD                   | 62 ++++++++++++++++++++++++
 testing/xpdf/xpdf-3.04-protection.patch | 84 +++++++++++++++++++++++++++++++++
 2 files changed, 146 insertions(+)
 create mode 100644 testing/xpdf/APKBUILD
 create mode 100644 testing/xpdf/xpdf-3.04-protection.patch

diff --git a/testing/xpdf/APKBUILD b/testing/xpdf/APKBUILD
new file mode 100644
index 0000000..196c9d9
--- /dev/null
+++ b/testing/xpdf/APKBUILD
@@ -0,0 +1,62 @@
# Contributor: Isaac Dunham <ibid.ag@gmail.com>
# Maintainer:  Isaac Dunham <ibid.ag@gmail.com>
pkgname=xpdf
pkgver="3.04"
pkgrel=0
pkgdesc="The classic X11 PDF viewer"
url="http://foolabs.com/xpdf"
arch="all"
license="GPL2/GPL3"
depends=""
depends_dev=""
makedepends="motif-dev freetype-dev libpng-dev"
install=""
subpackages="$pkgname-doc"
source="ftp://ftp.foolabs.com/pub/xpdf/$pkgname-$pkgver.tar.gz
xpdf-3.04-protection.patch"

_builddir="$srcdir/$pkgname-$pkgver"
prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	echo "$_builddir"
	cd "$_builddir"
	./configure \
		--with-x \
		--with-freetype2-includes=/usr/include/freetype2 \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		|| return 1
	make || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1
	rm -f "$pkgdir"/usr/lib/*.la
	#delete pdf* utils that conflict with poppler-utils.
	for i in pdftops pdftotxt pdfinfo pdfdetach; do
		rm -f "$pkgdir"/usr/bin/$i
		rm -f "$pkgdir"/usr/share/man/man1/$i.1
	done
}

md5sums="3bc86c69c8ff444db52461270bef3f44  xpdf-3.04.tar.gz
11bd32802d9e600ad028f5b84194178d  xpdf-3.04-protection.patch"
sha256sums="11390c74733abcb262aaca4db68710f13ffffd42bfe2a0861a5dfc912b2977e5  xpdf-3.04.tar.gz
5a12a1781eb29f83b3f0e3c1484e6c99537f84e42aa3dda9bb9c4a5befd83217  xpdf-3.04-protection.patch"
sha512sums="3fb3c380fdbd13d937449ae3f7d7a163815cc85296d30be7b9907687884385d6171bb48ee5d5c13368d6bba87740b678f491bdcf61b38d130809e9afa260f6cf  xpdf-3.04.tar.gz
4c6360731ad60ed45e0612b016116a9588f293267ee3e2c1f7cd2f046f045f165334c6e7fceb6b51b3181adb7a74087036a28fcec0e04b23e6374ffc421c1f54  xpdf-3.04-protection.patch"
diff --git a/testing/xpdf/xpdf-3.04-protection.patch b/testing/xpdf/xpdf-3.04-protection.patch
new file mode 100644
index 0000000..677db00
--- /dev/null
+++ b/testing/xpdf/xpdf-3.04-protection.patch
@@ -0,0 +1,84 @@
Port Johannes Bauer's protection patch to 3.04.
This does NOT disable the error messages, since the user should
be aware of the author's intent.

Also, this does not deal with permission to print.

diff --git a/xpdf/PDFCore.cc b/xpdf/PDFCore.cc
index 34b6483..e93fe52 100644
--- a/xpdf/PDFCore.cc
+++ b/xpdf/PDFCore.cc
@@ -1677,9 +1677,6 @@ GString *PDFCore::extractText(int pg, double xMin, double yMin,
   int x0, y0, x1, y1, t;
   GString *s;
 
-  if (!doc->okToCopy()) {
-    return NULL;
-  }
   if ((page = findPage(pg))) {
     cvtUserToDev(pg, xMin, yMin, &x0, &y0);
     cvtUserToDev(pg, xMax, yMax, &x1, &y1);
diff --git a/xpdf/XPDFCore.cc b/xpdf/XPDFCore.cc
index 9a3725f..1562c7a 100644
--- a/xpdf/XPDFCore.cc
+++ b/xpdf/XPDFCore.cc
@@ -384,9 +384,8 @@ void XPDFCore::endSelection(int wx, int wy) {
 #ifndef NO_TEXT_SELECT
       if (selectULX != selectLRX &&
 	  selectULY != selectLRY) {
-	if (doc->okToCopy()) {
 	  copySelection();
-	} else {
+	if (!doc->okToCopy()) {
 	  error(errNotAllowed, -1,
 		"Copying of text from this document is not allowed.");
 	}
@@ -408,9 +407,6 @@ void XPDFCore::copySelection() {
   int pg;
   double ulx, uly, lrx, lry;
 
-  if (!doc->okToCopy()) {
-    return;
-  }
   if (getSelection(&pg, &ulx, &uly, &lrx, &lry)) {
     //~ for multithreading: need a mutex here
     if (currentSelection) {
diff --git a/xpdf/pdfimages.cc b/xpdf/pdfimages.cc
index dc79443..9aaa811 100644
--- a/xpdf/pdfimages.cc
+++ b/xpdf/pdfimages.cc
@@ -122,8 +122,6 @@ int main(int argc, char *argv[]) {
   if (!doc->okToCopy()) {
     error(errNotAllowed, -1,
 	  "Copying of images from this document is not allowed.");
-    exitCode = 3;
-    goto err1;
   }
 
   // get page range
diff --git a/xpdf/pdftohtml.cc b/xpdf/pdftohtml.cc
index f1fe691..824233e 100644
--- a/xpdf/pdftohtml.cc
+++ b/xpdf/pdftohtml.cc
@@ -134,8 +134,6 @@ int main(int argc, char *argv[]) {
   if (!doc->okToCopy()) {
     error(errNotAllowed, -1,
 	  "Copying of text from this document is not allowed.");
-    exitCode = 3;
-    goto err1;
   }
 
   // get page range
diff --git a/xpdf/pdftotext.cc b/xpdf/pdftotext.cc
index 758413e..e6779fa 100644
--- a/xpdf/pdftotext.cc
+++ b/xpdf/pdftotext.cc
@@ -192,8 +192,6 @@ int main(int argc, char *argv[]) {
   if (!doc->okToCopy()) {
     error(errNotAllowed, -1,
 	  "Copying of text from this document is not allowed.");
-    exitCode = 3;
-    goto err2;
   }
 
   // construct text file name
-- 
2.0.0



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Natanael Copa <ncopa@alpinelinux.org>
Details
Message ID
<20140623101253.1e38a1f4@ncopa-desktop.alpinelinux.org>
In-Reply-To
<1403475856-4621-1-git-send-email-ibid.ag@gmail.com> (view parent)
Sender timestamp
1403511173
DKIM signature
missing
Download raw message
On Sun, 22 Jun 2014 22:24:16 +0000
Isaac Dunham <ibid.ag@gmail.com> wrote:

> ---
>  testing/xpdf/APKBUILD                   | 62 ++++++++++++++++++++++++
>  testing/xpdf/xpdf-3.04-protection.patch | 84 +++++++++++++++++++++++++++++++++
>  2 files changed, 146 insertions(+)
>  create mode 100644 testing/xpdf/APKBUILD
>  create mode 100644 testing/xpdf/xpdf-3.04-protection.patch


applied. thanks!

-nc


---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)