diff options
author | Jay Berkenbilt <ejb@ql.org> | 2020-10-25 01:31:09 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2020-10-25 23:06:16 +0100 |
commit | 4e8d21d849dc4c562d02c4aa22683296cbd314f7 (patch) | |
tree | 3cd6beac7fecc761c9404bcefff0ab0a8365e638 /build-scripts | |
parent | 026330ebcdbef825a340eb04915483573b3c8be2 (diff) | |
download | qpdf-4e8d21d849dc4c562d02c4aa22683296cbd314f7.tar.zst |
Build Windows releases with openssl; automate external libraries
External libraries for Windows are now built automatically in the
qpdf/external-libs repository and include openssl in addition to zlib
and jpeg. Use these, and update the Windows build to build with the
openssl crypto provider by default. We leave the native crypto
provider enabled in case there is a problem with openssl and also to
continue to exercise that code.
Diffstat (limited to 'build-scripts')
-rwxr-xr-x | build-scripts/build-mac | 7 | ||||
-rwxr-xr-x | build-scripts/build-windows | 3 | ||||
-rwxr-xr-x | build-scripts/download-external-libs | 56 | ||||
-rwxr-xr-x | build-scripts/make-distfiles | 2 |
4 files changed, 63 insertions, 5 deletions
diff --git a/build-scripts/build-mac b/build-scripts/build-mac index 96d900bb..eb41f817 100755 --- a/build-scripts/build-mac +++ b/build-scripts/build-mac @@ -1,8 +1,9 @@ #!/bin/bash set -ex -curl -L https://github.com/qpdf/qpdf/raw/external-libs/jpegsrc.v9c.tar.gz -o jpegsrc.v9c.tar.gz -tar xzf jpegsrc.v9c.tar.gz -cd jpeg-9c +cd $(dirname $0)/.. +unzip qpdf-external-libs-src.zip +tar xzf external-libs-src/jpegsrc* +cd jpeg-* ./configure make -k sudo make install diff --git a/build-scripts/build-windows b/build-scripts/build-windows index 2ec6a500..f67b8f2e 100755 --- a/build-scripts/build-windows +++ b/build-scripts/build-windows @@ -23,14 +23,13 @@ fi if [ -f distfiles/distfiles.zip ]; then unzip distfiles/distfiles.zip fi -curl -L https://github.com/qpdf/qpdf/raw/external-libs/qpdf-external-libs-bin.zip -o qpdf-external-libs-bin.zip unzip qpdf-external-libs-bin.zip cwd=`pwd` PATH=$cwd/libqpdf/build:$PATH installdir=install-$tool$wordsize rm -rf $installdir -./config-$tool --enable-show-failed-test-output --disable-crypto-gnutls --disable-crypto-openssl +./config-$tool --enable-show-failed-test-output make -j$(nproc) -k make -k check make install diff --git a/build-scripts/download-external-libs b/build-scripts/download-external-libs new file mode 100755 index 00000000..94d3ff52 --- /dev/null +++ b/build-scripts/download-external-libs @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +import json +import os +import requests +import sys +from zipfile import ZipFile +from operator import itemgetter + + +def warn(*args, **kwargs): + print(*args, **kwargs, file=sys.stderr) + + +def download_file(url, local_filename): + # From https://stackoverflow.com/questions/16694907/ + # download-large-file-in-python-with-requests + if os.path.exists(local_filename): + warn('Using existing', local_filename) + return + warn('Downloading', local_filename) + with requests.get(url, stream=True) as r: + r.raise_for_status() + with open(local_filename, 'wb') as f: + for chunk in r.iter_content(chunk_size=8192): + f.write(chunk) + return local_filename + + +bin_name = 'qpdf-external-libs-bin.zip' +src_name = 'qpdf-external-libs-src.zip' +dir_name = 'external-libs-dist' +os.makedirs(dir_name, exist_ok=True) + +r = requests.get( + 'https://api.github.com/repos/qpdf/external-libs/releases') +releases = json.loads(r.text) +by_tag = sorted( + [(r['tag_name'], r) for r in releases + if r['prerelease'] is False], + reverse=True) +latest = by_tag[0][1] +bin_url = None +src_url = None +for i in latest['assets']: + if i['name'] == bin_name: + bin_url = i['browser_download_url'] + elif i['name'] == src_name: + src_url = i['browser_download_url'] +print(bin_url) +download_file(bin_url, f'{dir_name}/{bin_name}') +download_file(src_url, f'{dir_name}/{src_name}') + +print('\n** external library information **') +with ZipFile(f'{dir_name}/{src_name}') as z1: + with z1.open('external-libs-src/versions') as z2: + print(z2.read().decode()) diff --git a/build-scripts/make-distfiles b/build-scripts/make-distfiles index 6a074aee..26ef161d 100755 --- a/build-scripts/make-distfiles +++ b/build-scripts/make-distfiles @@ -1,4 +1,5 @@ #!/bin/bash +cd $(dirname $0)/.. set -ex sudo apt-get update sudo apt-get -y install \ @@ -6,3 +7,4 @@ sudo apt-get -y install \ docbook-xsl fop xsltproc libxml2-utils inkscape imagemagick ./configure --enable-doc-maintenance make -j$(nproc) distfiles.zip +build-scripts/download-external-libs |