You are not logged in.

#1 2014-07-16 04:41:17

tomd123
Developer
Registered: 2008-08-12
Posts: 565

[REQUEST] pdfium - an open-source PDF rendering engine.

Here are the build instructions to help anyone interested: https://code.google.com/p/pdfium/wiki/Build
You might want to look at chromium's PKGBUILD for any helpful tricks you might want to reuse.

I would love to have an opensource pdf rendering library available to me so that I can run it in my opensource browser smile

I wish I had time to package this myself but I do not.

Cheers!

Offline

#2 2014-07-16 17:00:25

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 5,138

Re: [REQUEST] pdfium - an open-source PDF rendering engine.

Getting there. I've been able to build the test app, but no library yet. Anyone else working on this?

Offline

#3 2014-08-20 23:35:54

silverhammermba
Member
Registered: 2011-04-14
Posts: 141

Re: [REQUEST] pdfium - an open-source PDF rendering engine.

Here's my stab at a PKGBUILD:

pkgname=pdfium-git
pkgver=r171.8f2c3dc
pkgrel=1
pkgdesc="An open-source PDF rendering engine."
url="https://code.google.com/p/pdfium/"
arch=('i686' 'x86_64')
makedepends=('git' 'subversion' 'python2')
license=('BSD')
source=(
	"git+https://pdfium.googlesource.com/pdfium"
	"gyp::svn+http://gyp.googlecode.com/svn/trunk"
	"v8::svn+http://v8.googlecode.com/svn/trunk"
	"icu::svn+https://src.chromium.org/chrome/trunk/deps/third_party/icu46"
)
md5sums=('SKIP' 'SKIP' 'SKIP' 'SKIP')

pkgver() {
	cd "${srcdir}/pdfium"
	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
	cd "${srcdir}"
	mv gyp pdfium/build/
	mv v8  pdfium/
	mv icu pdfium/v8/third_party/

	echo "Fixing python2 dependence..."
	find -type f -exec grep -Il . {} + | grep -v '/\.\(svn\|git\)/' | xargs -d '\n' sed --in-place "s/\bpython\b/python2/g"
}

package() {
	cd "${srcdir}/pdfium"

	build/gyp_pdfium

	BUILDTYPE=Release make
}

Notes:
1. I have no idea what the depends should be.
2. It feels really wrong to checkout three other repos in order to build this one, but it looks like there are actual source dependencies. I.e. Arch's v8 package does not supply the GYP files that the pdfium build looks for. Maybe the gyp checkout could be replaced by gyp-svn?
3. I couldn't find any guidance on handling scripts that expect `python` to be Python 2.7, so I went with a really ugly, overzealous find-and-replace. Would a symlink to python2 and some PATH manipulation work? What's preferred?
4. This builds binaries mksnapshot and pdfium_test... how does this end up as a browser plugin?

Last edited by silverhammermba (2014-08-21 12:05:39)

Offline

#4 2014-08-21 02:31:46

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 5,138

Re: [REQUEST] pdfium - an open-source PDF rendering engine.

I gave up on this, I'm pretty sure in order to build it as a plugin, you need to build it when you build chromium, and I'm not getting into that can of worms.

Offline

#5 2014-08-21 04:08:30

silverhammermba
Member
Registered: 2011-04-14
Posts: 141

Re: [REQUEST] pdfium - an open-source PDF rendering engine.

I'm starting to think it's even worse, and this is just the bare bones PDF library without any browser plugin stuff whatsoever. It's also annoying that I can't find many people talking about this elsewhere.

Offline

#6 2014-08-21 08:43:48

sekret
Member
Registered: 2013-07-22
Posts: 206

Re: [REQUEST] pdfium - an open-source PDF rendering engine.

Why not put all three svn checkouts to the source array and then check them out locally?

Offline

#7 2014-08-21 11:39:12

silverhammermba
Member
Registered: 2011-04-14
Posts: 141

Re: [REQUEST] pdfium - an open-source PDF rendering engine.

That definitely makes more sense, but the pdfium build instructions expect you to check them out into pdfium's source directory. What is the proper way to put them there? Just mv them in prepare()?

Offline

#8 2014-08-21 14:36:03

sekret
Member
Registered: 2013-07-22
Posts: 206

Re: [REQUEST] pdfium - an open-source PDF rendering engine.

I tried to check them out locally, but it doesn't seem to be that easy with svn.

PKGBUILD

pkgname=pdfium-git
pkgver=r171.8f2c3dc
pkgrel=1
pkgdesc="An open-source PDF rendering engine."
url="https://code.google.com/p/pdfium/"
arch=('i686' 'x86_64')
makedepends=('git' 'subversion' 'python2')
license=('BSD')
source=("pdfium::git+https://pdfium.googlesource.com/pdfium"
        "gyp::svn+http://gyp.googlecode.com/svn/trunk"
        "v8::svn+http://v8.googlecode.com/svn/trunk"
        "icu46::svn+https://src.chromium.org/chrome/trunk/deps/third_party/icu46")
md5sums=('SKIP'
         'SKIP'
         'SKIP'
         'SKIP')
pkgver() {
 cd "$srcdir/pdfium"
 printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
prepare() {
 cd "$srcdir/pdfium"
 # checkout third party tools
 svn co file://"$srcdir"/gyp build/gyp
 svn co file://"$srcdir"/v8 v8
 svn co file://"$srcdir"/icu46 v8/third_party/icu
 # fix for python2
 find -type f -exec grep -Il . {} + | grep -v '/\.\(svn\|git\)/' | xargs -d '\n' sed --in-place "s/\bpython\b/python2/g"
}
build() {
 cd "$srcdir/pdfium"
 build/gyp_pdfium
 BUILDTYPE=Release make
}
package() {
 cd "$srcdir/pdfium"
}

output of makepkg

==> Making package: pdfium-git r171.8f2c3dc-1 (Thu Aug 21 16:33:25 CEST 2014)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Updating pdfium git repo...
Fetching origin
  -> Updating gyp svn repo...
Updating '.':
At revision 1967.
  -> Updating v8 svn repo...
Updating '.':
At revision 23280.
  -> Updating icu46 svn repo...
Updating '.':
At revision 291064.
==> Validating source files with md5sums...
    pdfium ... Skipped
    gyp ... Skipped
    v8 ... Skipped
    icu46 ... Skipped
==> Extracting sources...
  -> Creating working copy of pdfium git repo...
Cloning into 'pdfium'...
done.
  -> Creating working copy of trunk svn repo...
  -> Creating working copy of trunk svn repo...
  -> Creating working copy of icu46 svn repo...
==> Starting pkgver()...
==> Starting prepare()...
svn: E180001: Unable to connect to a repository at URL 'file:///tmp/pdfium-git/src/gyp'
svn: E180001: Unable to open an ra_local session to URL
svn: E180001: Unable to open repository 'file:///tmp/pdfium-git/src/gyp'
==> ERROR: A failure occurred in prepare().
    Aborting...

Offline

#9 2014-08-21 14:41:42

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 5,138

Re: [REQUEST] pdfium - an open-source PDF rendering engine.

This is what I was doing:

_pkgname=pdfium
pkgname=$_pkgname-git
pkgver=r154.fda0d42
pkgrel=1
pkgdesc="Open-source PDF rendering engine"
arch=('i686' 'x86_64')
url="https://code.google.com/p/pdfium/"
license=('BSD')
depends=()
makedepends=('git' 'subversion' 'python2')
source=("git+https://pdfium.googlesource.com/pdfium"
        "gyp::svn+http://gyp.googlecode.com/svn/trunk"
        "v8::svn+http://v8.googlecode.com/svn/trunk"
        "icu::svn+https://src.chromium.org/chrome/trunk/deps/third_party/icu46")
sha256sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP')

pkgver() {
  cd "$srcdir/$_pkgname"

  printf "r$(git rev-list --count HEAD).$(git rev-parse --short HEAD)"
}

prepare() {
  cd "$srcdir/$_pkgname"

  mv "$srcdir/gyp" build
  mv "$srcdir/v8" .
  mv "$srcdir/icu" v8/third_party

  find -name *.py -exec sed -i 's/env python$/&2/' {} \;
  sed -i 's/env python$/&2/' build/gyp_pdfium
  sed -i "s/'python'/'python2'/g" v8/tools/gyp/v8.gyp
}

build() {
  cd "$srcdir/$_pkgname"

  build/gyp_pdfium

  make
}

Last edited by Scimmia (2014-08-21 14:43:53)

Offline

#10 2014-08-21 17:46:14

sekret
Member
Registered: 2013-07-22
Posts: 206

Re: [REQUEST] pdfium - an open-source PDF rendering engine.

Ok now I feel stupid, of course it makes more sense to just move this stuff.. big_smile

Offline

#11 2014-08-21 18:04:28

progandy
Member
Registered: 2012-05-17
Posts: 2,152

Re: [REQUEST] pdfium - an open-source PDF rendering engine.

sekret wrote:

Ok now I feel stupid, of course it makes more sense to just move this stuff.. big_smile

I'd use a symlink if the build process allows it.

Offline

#12 2014-08-21 18:42:35

sekret
Member
Registered: 2013-07-22
Posts: 206

Re: [REQUEST] pdfium - an open-source PDF rendering engine.

Right, sounds like the cleaner way. The package still builds here, no idea how long it'll take..

Offline

#13 2014-08-21 21:01:01

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 5,138

Re: [REQUEST] pdfium - an open-source PDF rendering engine.

progandy wrote:
sekret wrote:

Ok now I feel stupid, of course it makes more sense to just move this stuff.. big_smile

I'd use a symlink if the build process allows it.

I tried that first, build failed.

Offline

Board footer

Powered by FluxBB