Skip to content

Commit

Permalink
alpine 3.9, wkhtmltopdf 0.12.5 relase
Browse files Browse the repository at this point in the history
  • Loading branch information
aantonw committed Mar 27, 2019
1 parent a590a15 commit 8770e4e
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 164 deletions.
153 changes: 74 additions & 79 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,86 +1,81 @@
FROM alpine:3.8
FROM alpine:3.9
MAINTAINER Anton Wahyu <[email protected]>

ENV WKHTMLTOPDF_VERSION=ccf91a0
ENV WKHTMLTOPDF_VERSION=tags/0.12.5
# install qt build packages #
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
&& apk update \
&& apk add gtk+ openssl glib fontconfig bash vim \
&& apk add --virtual .deps git patch make g++ \
libc-dev gettext-dev zlib-dev bzip2-dev libffi-dev pcre-dev \
glib-dev atk-dev expat-dev libpng-dev freetype-dev fontconfig-dev \
libxau-dev libxdmcp-dev libxcb-dev xf86bigfontproto-dev libx11-dev \
libxrender-dev pixman-dev libxext-dev cairo-dev perl-dev \
libxfixes-dev libxdamage-dev graphite2-dev icu-dev harfbuzz-dev \
libxft-dev pango-dev gtk+-dev libdrm-dev \
libxxf86vm-dev libxshmfence-dev wayland-dev mesa-dev openssl-dev \
&& git clone --recursive https://github.com/wkhtmltopdf/wkhtmltopdf.git /tmp/wkhtmltopdf \
&& cd /tmp/wkhtmltopdf \
&& git checkout $WKHTMLTOPDF_VERSION
RUN apk update \
&& apk add gtk+ openssl glib fontconfig libstdc++ bash vim \
&& apk add --virtual .deps git patch make g++ \
libc-dev gettext-dev zlib-dev bzip2-dev libffi-dev pcre-dev \
glib-dev atk-dev expat-dev libpng-dev freetype-dev fontconfig-dev \
libxau-dev libxdmcp-dev libxcb-dev libx11-dev \
libxrender-dev pixman-dev libxext-dev cairo-dev perl-dev \
libxfixes-dev libxdamage-dev graphite2-dev icu-dev harfbuzz-dev \
libxft-dev pango-dev gtk+-dev libdrm-dev \
libxxf86vm-dev libxshmfence-dev wayland-dev mesa-dev openssl-dev \
&& git clone --recursive https://github.com/wkhtmltopdf/wkhtmltopdf.git /tmp/wkhtmltopdf \
&& cd /tmp/wkhtmltopdf \
&& git checkout $WKHTMLTOPDF_VERSION

COPY conf/* /tmp/wkhtmltopdf/qt/

RUN cd /tmp/wkhtmltopdf/qt && \
patch -p1 -i qt-musl.patch && \
patch -p1 -i qt-musl-iconv-no-bom.patch && \
patch -p1 -i qt-recursive-global-mutex.patch && \
patch -p1 -i qt-gcc6.patch && \
sed -i "s|-O2|$CXXFLAGS|" mkspecs/common/g++.conf && \
sed -i "/^QMAKE_RPATH/s| -Wl,-rpath,||g" mkspecs/common/g++.conf && \
sed -i "/^QMAKE_LFLAGS\s/s|+=|+= $LDFLAGS|g" mkspecs/common/g++.conf && \
CFLAGS=-w CPPFLAGS=-w CXXFLAGS=-w LDFLAGS=-w \
./configure -confirm-license -opensource \
-prefix /usr \
-datadir /usr/share/qt \
-sysconfdir /etc \
-plugindir /usr/lib/qt/plugins \
-importdir /usr/lib/qt/imports \
-fast \
-release \
-static \
-largefile \
-glib \
-graphicssystem raster \
-qt-zlib \
-qt-libpng \
-qt-libmng \
-qt-libtiff \
-qt-libjpeg \
-svg \
-script \
-webkit \
-gtkstyle \
-xmlpatterns \
-script \
-scripttools \
-openssl-linked \
-nomake demos \
-nomake docs \
-nomake examples \
-nomake tools \
-nomake tests \
-nomake translations \
-no-qt3support \
-no-pch \
-no-icu \
-no-phonon \
-no-phonon-backend \
-no-rpath \
-no-separate-debug-info \
-no-dbus \
-no-opengl \
-no-openvg && \
NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
export MAKEFLAGS=-j${NPROC} && \
export MAKE_COMMAND="make -j${NPROC}" && \
make --silent && \
make install && \
cd /tmp/wkhtmltopdf && \
sed -i -E "s|(.*)|\1@$WKHTMLTOPDF_VERSION" && \
qmake && \
make --silent && \
make install && \
rm -rf /tmp/* \
# remove qt build packages #
&& apk del .deps \
&& rm -rf /var/cache/apk/*
patch -p1 -i qt-musl.patch && \
patch -p1 -i qt-musl-iconv-no-bom.patch && \
patch -p1 -i qt-recursive-global-mutex.patch && \
patch -p1 -i qt-gcc8.patch && \
CFLAGS=-w CPPFLAGS=-w CXXFLAGS=-w LDFLAGS=-w \
./configure -confirm-license -opensource \
-prefix /usr \
-datadir /usr/share/qt \
-sysconfdir /etc \
-plugindir /usr/lib/qt/plugins \
-importdir /usr/lib/qt/imports \
-fast \
-release \
-static \
-largefile \
-glib \
-graphicssystem raster \
-qt-zlib \
-qt-libpng \
-qt-libmng \
-qt-libtiff \
-qt-libjpeg \
-svg \
-script \
-webkit \
-gtkstyle \
-xmlpatterns \
-script \
-scripttools \
-openssl-linked \
-nomake demos \
-nomake docs \
-nomake examples \
-nomake tools \
-nomake tests \
-nomake translations \
-no-qt3support \
-no-pch \
-no-icu \
-no-phonon \
-no-phonon-backend \
-no-rpath \
-no-separate-debug-info \
-no-dbus \
-no-opengl \
-no-openvg && \
NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
export MAKEFLAGS=-j${NPROC} && \
export MAKE_COMMAND="make -j${NPROC}" && \
make --silent && \
make install && \
cd /tmp/wkhtmltopdf && \
qmake && \
make --silent && \
make install && \
rm -rf /tmp/* \
# remove qt build packages #
&& apk del .deps \
&& rm -rf /var/cache/apk/*
29 changes: 22 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
#### Alpine Linux 3.6 wkhtmltopdf 0.12.5-dev (with patched qt)
#### Alpine Linux 3.9 wkhtmltopdf 0.12.5 (with patched qt)

Based on [alloylab/Docker-Alpine-wkhtmltopdf](https://github.com/alloylab/Docker-Alpine-wkhtmltopdf)

Alpine has wkhtmltopdf package but with unpatched qt, therefor not all wkhtmltopdf features can be used.

This container aim to build wkhtmltopdf and patched qt.

Resulting binary from build process can be reused as long as glib and openssl packages is installed.
Certain wkhtmltopdf features cant be used with Alpine default wkhtmlpdf package, qt is unpatched. This container aim to build wkhtmltopdf and patched qt. The binary in this container is using shared library that can be fulfilled with installing Alpine default wkhtmltopdf package

Build step:

```
docker build -t aantonw/wkhtmltohtml .
docker run --name wkhtmltopdf -it aantonw/wkhtmltopdf html
docker run --name wkhtmltopdf -it aantonw/wkhtmltopdf bash
# copy build result to host
docker cp wkhtmltopdf:/lib/libwkhtmltox.so.0.12.5 wkhtmltox.so.0.12.5
docker cp wkhtmltopdf:/bin/wkhtmltopdf wkhtmltopdf
docker cp wkhtmltopdf:/bin/wkhtmltoimage wkhtmltoimage
```

Using binary to replace default wkhtmltopdf via Dockerfile:

```
FROM alpine:3.9
### install unpatched wkhtmltopdf
RUN apk add --update wkhtmltopdf
### replace binary and lib
COPY wkhtmltopdf /usr/bin/wkhtmltopdf
COPY wkhtmltoimage /usr/bin/wkhtmltoimage
```

93 changes: 15 additions & 78 deletions conf/qt-gcc6.patch → conf/qt-gcc8.patch
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ index 499c53a71d..ccc307089d 100644
+ m_previous->table.remove(StructureTransitionTableHash::Key(RefPtr<UString::Rep>(m_nameInPrevious.get()), (unsigned int)(m_attributesInPrevious)), m_specificValueInPrevious);
else
m_previous->table.removeAnonymousSlotTransition(m_anonymousSlotsInPrevious);

diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.h b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.h
index 7571efc1e9..77d4f5047f 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.h
Expand All @@ -23,15 +23,15 @@ index 7571efc1e9..77d4f5047f 100644
+ add(StructureTransitionTableHash::Key(RefPtr<UString::Rep>(existingTransition->m_nameInPrevious.get()), (unsigned int)(existingTransition->m_attributesInPrevious)), existingTransition, existingTransition->m_specificValueInPrevious);
}
} // namespace JSC

diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h
index 42a9233000..e761edb1fa 100644
index 42a9233000..b0584c1bf5 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h
@@ -257,17 +257,6 @@ namespace WTF {
@@ -257,16 +257,6 @@ namespace WTF {

using std::swap;

-#if !COMPILER(MSVC) && !OS(QNX) && !defined(_LIBCPP_VERSION)
- // The Dinkumware C++ library (used by MSVC and QNX) and clang's libc++ have a swap for pairs defined.
-
Expand All @@ -42,107 +42,44 @@ index 42a9233000..e761edb1fa 100644
- swap(a.second, b.second);
- }
-#endif
-

template<typename T, bool useSwap> struct Mover;
template<typename T> struct Mover<T, true> { static void move(T& from, T& to) { swap(from, to); } };
template<typename T> struct Mover<T, false> { static void move(T& from, T& to) { to = from; } };
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h
index ede98e4f26..ce890876ee 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h
@@ -25,7 +25,7 @@
#include "Platform.h"

#if (defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || (defined(_MSC_VER) && (_MSC_VER >= 1600))
-#include <type_traits>
+#include <tr1/type_traits>
#endif

namespace WTF {
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/UTF8.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/UTF8.cpp
index 21d58563cc..ba819fc11a 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/UTF8.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/UTF8.cpp
@@ -228,7 +228,7 @@ static bool isLegalUTF8(const unsigned char* source, int length)
// Magic values subtracted from a buffer value during UTF8 conversion.
// This table contains as many values as there might be trailing bytes
// in a UTF-8 sequence.
-static const UChar32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
+static const long offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
0x03C82080UL, 0xFA082080UL, 0x82082080UL };

ConversionResult convertUTF8ToUTF16(
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexCompiler.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexCompiler.cpp
index 9cd3d123c1..917eac055a 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexCompiler.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexCompiler.cpp
@@ -719,7 +719,7 @@ const char* compileRegex(const UString& patternString, RegexPattern& pattern)

constructor.setupOffsets();

- return false;
+ return nullptr;
};


diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 7b69922b89..d88d4e5ead 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -52,7 +52,7 @@
/*
can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
*/
-#define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
+#define QT_VERSION_CHECK(qt_version_check_major, qt_version_check_minor, qt_version_check_patch) ((qt_version_check_major<<16)|(qt_version_check_minor<<8)|(qt_version_check_patch))

#define QT_PACKAGEDATE_STR "YYYY-MM-DD"

@@ -2432,7 +2432,7 @@ class QFlags
public:
typedef Enum enum_type;
Q_DECL_CONSTEXPR inline QFlags(const QFlags &f) : i(f.i) {}
- Q_DECL_CONSTEXPR inline QFlags(Enum f) : i(f) {}
+ Q_DECL_CONSTEXPR inline QFlags(Enum f) : i(int(f)) {}
Q_DECL_CONSTEXPR inline QFlags(Zero = 0) : i(0) {}
inline QFlags(QFlag f) : i(f) {}

diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro
index 5bf4e0115f..d1c56ae4da 100644
--- a/src/declarative/declarative.pro
+++ b/src/declarative/declarative.pro
@@ -4,7 +4,7 @@ QT = core gui script network
contains(QT_CONFIG, svg): QT += svg
DEFINES += QT_BUILD_DECLARATIVE_LIB QT_NO_URL_CAST_FROM_STRING
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000
-solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
+QMAKE_CXXFLAGS_RELEASE -= -O2

unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui



diff --git a/src/plugins/accessible/widgets/itemviews.cpp b/src/plugins/accessible/widgets/itemviews.cpp
index 14c9279dbe..c982b6c43c 100644
index 14c9279dbe..dcfffa3ddb 100644
--- a/src/plugins/accessible/widgets/itemviews.cpp
+++ b/src/plugins/accessible/widgets/itemviews.cpp
@@ -393,7 +393,7 @@ bool QAccessibleTable2::unselectColumn(int column)
QModelIndex index = view()->model()->index(0, column, view()->rootIndex());
if (!index.isValid() || view()->selectionMode() & QAbstractItemView::NoSelection)
return false;
- view()->selectionModel()->select(index, QItemSelectionModel::Columns & QItemSelectionModel::Deselect);
+ view()->selectionModel()->select(index, QItemSelectionModel::SelectionFlag(QItemSelectionModel::Columns & QItemSelectionModel::Deselect));
+ view()->selectionModel()->select(index, static_cast<QItemSelectionModel::SelectionFlags>(QItemSelectionModel::Columns & QItemSelectionModel::Deselect));
return true;
}

diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp
index 147e3f5a79..7e4453d8f1 100644
--- a/src/tools/moc/main.cpp
+++ b/src/tools/moc/main.cpp
@@ -190,6 +190,8 @@ int runMoc(int _argc, char **_argv)

// Workaround a bug while parsing the boost/type_traits/has_operator.hpp header. See QTBUG-22829
pp.macros["BOOST_TT_HAS_OPERATOR_HPP_INCLUDED"];
+ pp.macros["BOOST_TYPE_TRAITS_HPP"];
+ pp.macros["_SYS_SYSMACROS_H_OUTER"];

QByteArray filename;
QByteArray output;

0 comments on commit 8770e4e

Please sign in to comment.