Update precompiled pdfium for mac to chromium/3071 and add version info file with minimal build instructions

This commit is contained in:
Felix Kauselmann
2017-05-07 15:18:00 +02:00
commit d5c72ad2d1
1035 changed files with 102209 additions and 0 deletions

View File

@ -0,0 +1,6 @@
To use unarr as a decompression engine when building YACReader, download https://github.com/zeniko/unarr/archive/master.zip and extract it in this folder.
This will build unarr as a part of YACReader (static build).
If you're on a Linux/Unix system and prefer to use unarr as a shared library, have a look at https://github.com/selmf/unarr/
This fork of unarr includes a CMake based build system that allows you to build and install unarr as a shared library. YACReader will detect and use
the installed library at build time if it is installed.

View File

@ -0,0 +1,127 @@
#include "compressed_archive.h"
#include <QFileInfo>
#include <QDebug>
#include "extract_delegate.h"
extern"C" {
#include <unarr.h>
}
CompressedArchive::CompressedArchive(const QString & filePath, QObject *parent) :
QObject(parent),valid(false),tools(true),numFiles(0),ar(NULL),stream(NULL)
{
//open file
stream = ar_open_file(filePath.toStdString().c_str());
if (!stream)
{
return;
}
//open archive
ar = ar_open_rar_archive(stream);
//TODO: build unarr with 7z support and test this!
//if (!ar) ar = ar_open_7z_archive(stream);
if (!ar) ar = ar_open_tar_archive(stream);
//zip detection is costly, so it comes last...
if (!ar) ar = ar_open_zip_archive(stream, false);
if (!ar)
{
return;
}
//initial parse
while (ar_parse_entry(ar))
{
//make sure we really got a file header
if (ar_entry_get_size(ar) > 0)
{
fileNames.append(ar_entry_get_name(ar));
offsets.append(ar_entry_get_offset(ar));
numFiles++;
}
}
if (!ar_at_eof(ar))
{
//fail if the initial parse didn't reach EOF
//this might be a bit too drastic
qDebug() << "Error while parsing archive";
return;
}
if (numFiles > 0)
{
valid = true;
}
}
CompressedArchive::~CompressedArchive()
{
ar_close_archive(ar);
ar_close(stream);
}
QList<QString> CompressedArchive::getFileNames()
{
return fileNames;
}
bool CompressedArchive::isValid()
{
return valid;
}
bool CompressedArchive::toolsLoaded()
{
//for backwards compatibilty
return tools;
}
int CompressedArchive::getNumFiles()
{
return numFiles;
}
void CompressedArchive::getAllData(const QVector<quint32> & indexes, ExtractDelegate * delegate)
{
if (indexes.isEmpty())
return;
QByteArray buffer;
int i=0;
while (i < indexes.count())
{
//use the offset list so we generated so we're not getting any non-page files
ar_parse_entry_at(ar, offsets.at(indexes.at(i))); //set ar_entry to start of indexes
buffer.resize(ar_entry_get_size(ar));
if (ar_entry_uncompress(ar, buffer.data(), buffer.size())) //did we extract it?
{
delegate->fileExtracted(indexes.at(i), buffer); //return extracted file
}
else
{
delegate->crcError(indexes.at(i)); //we could not extract it...
}
i++;
}
}
QByteArray CompressedArchive::getRawDataAtIndex(int index)
{
QByteArray buffer;
if(index >= 0 && index < getNumFiles())
{
ar_parse_entry_at(ar, offsets.at(index));
buffer.resize(ar_entry_get_size(ar));
if(ar_entry_uncompress(ar, buffer.data(), buffer.size()))
{
return buffer;
}
else
{
return QByteArray();
}
}
return buffer;
}

View File

@ -0,0 +1,37 @@
#ifndef COMPRESSED_ARCHIVE_H
#define COMPRESSED_ARCHIVE_H
#include <QObject>
#include "extract_delegate.h"
extern"C" {
#include <unarr.h>
}
class CompressedArchive : public QObject
{
Q_OBJECT
public:
explicit CompressedArchive(const QString & filePath, QObject *parent = 0);
~CompressedArchive();
signals:
public slots:
int getNumFiles();
void getAllData(const QVector<quint32> & indexes, ExtractDelegate * delegate=0);
QByteArray getRawDataAtIndex(int index);
QList<QString> getFileNames();
bool isValid();
bool toolsLoaded();
private:
bool tools;
bool valid;
QList<QString> fileNames;
int numFiles;
ar_archive *ar;
ar_stream *stream;
QList<qint64> offsets;
};
#endif // COMPRESSED_ARCHIVE_H

View File

@ -0,0 +1,14 @@
#ifndef EXTRACT_DELEGATE_H
#define EXTRACT_DELEGATE_H
#include <QByteArray>
class ExtractDelegate
{
public:
virtual void fileExtracted(int index, const QByteArray & rawData) = 0;
virtual void crcError(int index) = 0;
virtual void unknownError(int index) = 0;
};
#endif //EXTRACT_DELEGATE_H

View File

@ -0,0 +1,40 @@
INCLUDEPATH += $$PWD
DEPENDPATH += $$PWD
HEADERS += $$PWD/extract_delegate.h \
$$PWD/compressed_archive.h \
SOURCES += $$PWD/compressed_archive.cpp \
unix:!macx:exists (/usr/include/unarr.h) {
message(Using system provided unarr installation)
LIBS+=-lunarr
DEFINES+=use_unarr
}
else:macx:exists (../../dependencies/unarr/macx/libunarr.a) {
message(Found prebuilt unarr library in dependencies directory.)
INCLUDEPATH += $$PWD/../../dependencies/unarr/macx
LIBS += -L$$PWD/../../dependencies/unarr/macx -lunarr -lz -lbz2
DEFINES+=use_unarr
}
else:win32:exists (../../dependencies/unarr/win/unarr.h) {
message(Found prebuilt unarr library in dependencies directory.)
INCLUDEPATH += $$PWD/../../dependencies/unarr/win
LIBS += -L../../dependencies/unarr/win/ -lunarr
DEFINES+=use_unarr
}
else:exists ($$PWD/unarr-master) {
message(Found unarr source-code)
message(Unarr will be build as a part of YACReader)
#qmake based unarr build system
#this should only be used for testing or as a last resort
include(unarr.pro)
DEFINES+=use_unarr
}
else {
error(Missing dependency: unarr decrompression backend. Please install libunarr on your system\
or provide a copy of the unarr source code in compressed_archive/unarr/unarr-master)
}

View File

@ -0,0 +1,46 @@
INCLUDEPATH += $$PWD/unarr-master/
DEPENDPATH += $$PWD/unarr-master/
unix:QMAKE_CFLAGS_RELEASE -= "-O2"
unix:QMAKE_CFLAGS_RELEASE += "-O3"
unix:QMAKE_CFLAGS_RELEASE += "-DNDEBUG"
unix:QMAKE_CFLAGS += "-D_FILE_OFFSET_BITS=64"
win32:QMAKE_CFLAGS_RELEASE += "/DNDEBUG"
HEADERS+=$$PWD/unarr-master/common/allocator.h\
$$PWD/unarr-master/common/unarr-imp.h\
$$PWD/unarr-master/lzmasdk/7zTypes.h\
$$PWD/unarr-master/lzmasdk/CpuArch.h\
$$PWD/unarr-master/lzmasdk/Ppmd7.h\
$$PWD/unarr-master/lzmasdk/Ppmd.h\
$$PWD/unarr-master/lzmasdk/LzmaDec.h\
$$PWD/unarr-master/lzmasdk/Ppmd8.h\
$$PWD/unarr-master/tar/tar.h\
$$PWD/unarr-master/_7z/_7z.h\
$$PWD/unarr-master/unarr.h
SOURCES+=$$PWD/unarr-master/common/conv.c\
$$PWD/unarr-master/common/custalloc.c\
$$PWD/unarr-master/common/unarr.c\
$$PWD/unarr-master/common/crc32.c\
$$PWD/unarr-master/common/stream.c\
$$PWD/unarr-master/lzmasdk/CpuArch.c\
$$PWD/unarr-master/lzmasdk/Ppmd7.c\
$$PWD/unarr-master/lzmasdk/Ppmd8.c\
$$PWD/unarr-master/lzmasdk/LzmaDec.c\
$$PWD/unarr-master/lzmasdk/Ppmd7Dec.c\
$$PWD/unarr-master/lzmasdk/Ppmd8Dec.c\
$$PWD/unarr-master/zip/inflate.c\
$$PWD/unarr-master/zip/parse-zip.c\
$$PWD/unarr-master/zip/uncompress-zip.c\
$$PWD/unarr-master/zip/zip.c\
$$PWD/unarr-master/rar/filter-rar.c\
$$PWD/unarr-master/rar/parse-rar.c\
$$PWD/unarr-master/rar/rarvm.c\
$$PWD/unarr-master/rar/huffman-rar.c\
$$PWD/unarr-master/rar/rar.c\
$$PWD/unarr-master/rar/uncompress-rar.c\
$$PWD/unarr-master/tar/parse-tar.c\
$$PWD/unarr-master/tar/tar.c\
$$PWD/unarr-master/_7z/_7z.c