diff --git a/.docker/Dockerfile-centos_6 b/.docker/Dockerfile-centos_6 index 7b5a244..b15c5d5 100644 --- a/.docker/Dockerfile-centos_6 +++ b/.docker/Dockerfile-centos_6 @@ -1,5 +1,5 @@ FROM centos:6 -RUN yum install -y ruby libjpeg-turbo libpng libXrender fontconfig libXext bzip2 +RUN yum install -y ruby libjpeg-turbo libpng libXrender fontconfig libXext CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version diff --git a/.docker/Dockerfile-centos_7 b/.docker/Dockerfile-centos_7 index 8921e9e..0092377 100644 --- a/.docker/Dockerfile-centos_7 +++ b/.docker/Dockerfile-centos_7 @@ -1,5 +1,5 @@ FROM centos:7 -RUN yum install -y ruby libjpeg-turbo libpng libXrender fontconfig libXext bzip2 +RUN yum install -y ruby libjpeg-turbo libpng libXrender fontconfig libXext CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version diff --git a/.docker/Dockerfile-debian_8 b/.docker/Dockerfile-debian_8 index 6659d3d..da33b16 100644 --- a/.docker/Dockerfile-debian_8 +++ b/.docker/Dockerfile-debian_8 @@ -3,6 +3,6 @@ FROM debian:8 ENV DEBIAN_FRONTEND noninteractive RUN apt-get update -RUN apt-get install -y ruby libjpeg62-turbo libpng12-0 libxrender1 libfontconfig1 libxext6 bzip2 +RUN apt-get install -y ruby libjpeg62-turbo libpng12-0 libxrender1 libfontconfig1 libxext6 CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version diff --git a/.docker/Dockerfile-debian_9 b/.docker/Dockerfile-debian_9 index b633578..cc66dfa 100644 --- a/.docker/Dockerfile-debian_9 +++ b/.docker/Dockerfile-debian_9 @@ -3,6 +3,6 @@ FROM debian:9 ENV DEBIAN_FRONTEND noninteractive RUN apt-get update -RUN apt-get install -y ruby libjpeg62-turbo libpng16-16 libxrender1 libfontconfig1 libxext6 bzip2 +RUN apt-get install -y ruby libjpeg62-turbo libpng16-16 libxrender1 libfontconfig1 libxext6 CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version diff --git a/.docker/Dockerfile-ubuntu_14.04 b/.docker/Dockerfile-ubuntu_14.04 index 5fc2a27..d3eb10a 100644 --- a/.docker/Dockerfile-ubuntu_14.04 +++ b/.docker/Dockerfile-ubuntu_14.04 @@ -3,6 +3,6 @@ FROM ubuntu:14.04 ENV DEBIAN_FRONTEND noninteractive RUN apt-get update -RUN apt-get install -y ruby libjpeg8 libxrender1 libfontconfig1 bzip2 +RUN apt-get install -y ruby libjpeg8 libxrender1 libfontconfig1 CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version diff --git a/.docker/Dockerfile-ubuntu_16.04 b/.docker/Dockerfile-ubuntu_16.04 index c17d80e..9a971b1 100644 --- a/.docker/Dockerfile-ubuntu_16.04 +++ b/.docker/Dockerfile-ubuntu_16.04 @@ -3,6 +3,6 @@ FROM ubuntu:16.04 ENV DEBIAN_FRONTEND noninteractive RUN apt-get update -RUN apt-get install -y ruby libjpeg8 libxrender1 libfontconfig1 bzip2 +RUN apt-get install -y ruby libjpeg8 libxrender1 libfontconfig1 CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version diff --git a/.docker/Dockerfile-ubuntu_18.04 b/.docker/Dockerfile-ubuntu_18.04 index ac042b3..d2e46a1 100644 --- a/.docker/Dockerfile-ubuntu_18.04 +++ b/.docker/Dockerfile-ubuntu_18.04 @@ -3,6 +3,6 @@ FROM ubuntu:18.04 ENV DEBIAN_FRONTEND noninteractive RUN apt-get update -RUN apt-get install -y ruby libjpeg8 libxrender1 libfontconfig1 bzip2 +RUN apt-get install -y ruby libjpeg8 libxrender1 libfontconfig1 CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version diff --git a/README.md b/README.md index e3db7cb..3464601 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ macOS ## Compression -Binaries should be compressed with `bzip2 -9` after extracting. The matching binary will be extracted on first +Binaries should be compressed with `gzip --best` after extracting. The matching binary will be extracted on first execution of `bin/wkhtmltopdf`. ## Testing with Docker diff --git a/bin/wkhtmltopdf b/bin/wkhtmltopdf index 29bdd7b..eabe5b1 100755 --- a/bin/wkhtmltopdf +++ b/bin/wkhtmltopdf @@ -8,6 +8,7 @@ # of the License at http://www.apache.org/licenses/LICENSE-2.0 require 'rbconfig' +require 'zlib' suffix = case RbConfig::CONFIG['host_os'] when /linux/ @@ -29,12 +30,10 @@ suffix = case RbConfig::CONFIG['host_os'] binary = "#{__FILE__}_#{suffix}" -if File.exist?("#{binary}.bz2") && !File.exist?(binary) - # There was an error on macOS when a hard link to the archive exists (could be - # Time Machine). Even with `--keep` it states: 'Input file has 1 other link'. - # Using `--force` fixes this. - system("bzip2 --decompress --keep --force #{binary}.bz2") || - raise("Decompression of #{binary}.bz2 failed. Do you have bzip2 installed?") +if File.exist?("#{binary}.gz") && !File.exist?(binary) + File.open binary, 'wb', 0o755 do |file| + Zlib::GzipReader.open("#{binary}.gz") { |gzip| file << gzip.read } + end end unless File.exist? binary diff --git a/bin/wkhtmltopdf_centos_6_amd64.bz2 b/bin/wkhtmltopdf_centos_6_amd64.bz2 deleted file mode 100755 index e549a9f..0000000 Binary files a/bin/wkhtmltopdf_centos_6_amd64.bz2 and /dev/null differ diff --git a/bin/wkhtmltopdf_debian_8_i386.bz2 b/bin/wkhtmltopdf_centos_6_amd64.gz similarity index 61% rename from bin/wkhtmltopdf_debian_8_i386.bz2 rename to bin/wkhtmltopdf_centos_6_amd64.gz index 2d5690a..0c0e008 100755 Binary files a/bin/wkhtmltopdf_debian_8_i386.bz2 and b/bin/wkhtmltopdf_centos_6_amd64.gz differ diff --git a/bin/wkhtmltopdf_centos_6_i386.bz2 b/bin/wkhtmltopdf_centos_6_i386.bz2 deleted file mode 100755 index fc91376..0000000 Binary files a/bin/wkhtmltopdf_centos_6_i386.bz2 and /dev/null differ diff --git a/bin/wkhtmltopdf_centos_6_i386.gz b/bin/wkhtmltopdf_centos_6_i386.gz new file mode 100755 index 0000000..fd81a61 Binary files /dev/null and b/bin/wkhtmltopdf_centos_6_i386.gz differ diff --git a/bin/wkhtmltopdf_centos_7_amd64.bz2 b/bin/wkhtmltopdf_centos_7_amd64.bz2 deleted file mode 100755 index f804029..0000000 Binary files a/bin/wkhtmltopdf_centos_7_amd64.bz2 and /dev/null differ diff --git a/bin/wkhtmltopdf_debian_9_amd64.bz2 b/bin/wkhtmltopdf_centos_7_amd64.gz similarity index 62% rename from bin/wkhtmltopdf_debian_9_amd64.bz2 rename to bin/wkhtmltopdf_centos_7_amd64.gz index 0c0a061..f19061d 100755 Binary files a/bin/wkhtmltopdf_debian_9_amd64.bz2 and b/bin/wkhtmltopdf_centos_7_amd64.gz differ diff --git a/bin/wkhtmltopdf_centos_7_i386.bz2 b/bin/wkhtmltopdf_centos_7_i386.bz2 deleted file mode 100755 index 740732a..0000000 Binary files a/bin/wkhtmltopdf_centos_7_i386.bz2 and /dev/null differ diff --git a/bin/wkhtmltopdf_ubuntu_18.04_amd64.bz2 b/bin/wkhtmltopdf_centos_7_i386.gz similarity index 63% rename from bin/wkhtmltopdf_ubuntu_18.04_amd64.bz2 rename to bin/wkhtmltopdf_centos_7_i386.gz index 0407eba..18a9601 100755 Binary files a/bin/wkhtmltopdf_ubuntu_18.04_amd64.bz2 and b/bin/wkhtmltopdf_centos_7_i386.gz differ diff --git a/bin/wkhtmltopdf_debian_8_amd64.bz2 b/bin/wkhtmltopdf_debian_8_amd64.bz2 deleted file mode 100755 index 53152b2..0000000 Binary files a/bin/wkhtmltopdf_debian_8_amd64.bz2 and /dev/null differ diff --git a/bin/wkhtmltopdf_debian_9_i386.bz2 b/bin/wkhtmltopdf_debian_8_amd64.gz similarity index 63% rename from bin/wkhtmltopdf_debian_9_i386.bz2 rename to bin/wkhtmltopdf_debian_8_amd64.gz index 2c604e3..14ad9c6 100755 Binary files a/bin/wkhtmltopdf_debian_9_i386.bz2 and b/bin/wkhtmltopdf_debian_8_amd64.gz differ diff --git a/bin/wkhtmltopdf_ubuntu_18.04_i386.bz2 b/bin/wkhtmltopdf_debian_8_i386.gz similarity index 64% rename from bin/wkhtmltopdf_ubuntu_18.04_i386.bz2 rename to bin/wkhtmltopdf_debian_8_i386.gz index cfd9b9b..16ab0bd 100755 Binary files a/bin/wkhtmltopdf_ubuntu_18.04_i386.bz2 and b/bin/wkhtmltopdf_debian_8_i386.gz differ diff --git a/bin/wkhtmltopdf_debian_9_amd64.gz b/bin/wkhtmltopdf_debian_9_amd64.gz new file mode 100755 index 0000000..705708a Binary files /dev/null and b/bin/wkhtmltopdf_debian_9_amd64.gz differ diff --git a/bin/wkhtmltopdf_debian_9_i386.gz b/bin/wkhtmltopdf_debian_9_i386.gz new file mode 100755 index 0000000..d6c8b7a Binary files /dev/null and b/bin/wkhtmltopdf_debian_9_i386.gz differ diff --git a/bin/wkhtmltopdf_macos_carbon.gz b/bin/wkhtmltopdf_macos_carbon.gz new file mode 100755 index 0000000..584d870 Binary files /dev/null and b/bin/wkhtmltopdf_macos_carbon.gz differ diff --git a/bin/wkhtmltopdf_macos_cocoa.gz b/bin/wkhtmltopdf_macos_cocoa.gz new file mode 100755 index 0000000..8bc0b68 Binary files /dev/null and b/bin/wkhtmltopdf_macos_cocoa.gz differ diff --git a/bin/wkhtmltopdf_ubuntu_14.04_amd64.bz2 b/bin/wkhtmltopdf_ubuntu_14.04_amd64.bz2 deleted file mode 100755 index c3ddf08..0000000 Binary files a/bin/wkhtmltopdf_ubuntu_14.04_amd64.bz2 and /dev/null differ diff --git a/bin/wkhtmltopdf_macos_carbon.bz2 b/bin/wkhtmltopdf_ubuntu_14.04_amd64.gz similarity index 62% rename from bin/wkhtmltopdf_macos_carbon.bz2 rename to bin/wkhtmltopdf_ubuntu_14.04_amd64.gz index 93eb36a..ba264b8 100755 Binary files a/bin/wkhtmltopdf_macos_carbon.bz2 and b/bin/wkhtmltopdf_ubuntu_14.04_amd64.gz differ diff --git a/bin/wkhtmltopdf_ubuntu_14.04_i386.bz2 b/bin/wkhtmltopdf_ubuntu_14.04_i386.bz2 deleted file mode 100755 index 176f518..0000000 Binary files a/bin/wkhtmltopdf_ubuntu_14.04_i386.bz2 and /dev/null differ diff --git a/bin/wkhtmltopdf_ubuntu_16.04_i386.bz2 b/bin/wkhtmltopdf_ubuntu_14.04_i386.gz similarity index 63% rename from bin/wkhtmltopdf_ubuntu_16.04_i386.bz2 rename to bin/wkhtmltopdf_ubuntu_14.04_i386.gz index bfae7cb..7cfd134 100755 Binary files a/bin/wkhtmltopdf_ubuntu_16.04_i386.bz2 and b/bin/wkhtmltopdf_ubuntu_14.04_i386.gz differ diff --git a/bin/wkhtmltopdf_ubuntu_16.04_amd64.bz2 b/bin/wkhtmltopdf_ubuntu_16.04_amd64.bz2 deleted file mode 100755 index 4988e33..0000000 Binary files a/bin/wkhtmltopdf_ubuntu_16.04_amd64.bz2 and /dev/null differ diff --git a/bin/wkhtmltopdf_macos_cocoa.bz2 b/bin/wkhtmltopdf_ubuntu_16.04_amd64.gz similarity index 63% rename from bin/wkhtmltopdf_macos_cocoa.bz2 rename to bin/wkhtmltopdf_ubuntu_16.04_amd64.gz index 0d75cc4..c768995 100755 Binary files a/bin/wkhtmltopdf_macos_cocoa.bz2 and b/bin/wkhtmltopdf_ubuntu_16.04_amd64.gz differ diff --git a/bin/wkhtmltopdf_ubuntu_16.04_i386.gz b/bin/wkhtmltopdf_ubuntu_16.04_i386.gz new file mode 100755 index 0000000..d81692d Binary files /dev/null and b/bin/wkhtmltopdf_ubuntu_16.04_i386.gz differ diff --git a/bin/wkhtmltopdf_ubuntu_18.04_amd64.gz b/bin/wkhtmltopdf_ubuntu_18.04_amd64.gz new file mode 100755 index 0000000..5831e40 Binary files /dev/null and b/bin/wkhtmltopdf_ubuntu_18.04_amd64.gz differ diff --git a/bin/wkhtmltopdf_ubuntu_18.04_i386.gz b/bin/wkhtmltopdf_ubuntu_18.04_i386.gz new file mode 100755 index 0000000..a7a2f53 Binary files /dev/null and b/bin/wkhtmltopdf_ubuntu_18.04_i386.gz differ