New module pdftops.
With Qt 6 copy and sign pdftops from brew.
This commit is contained in:
parent
5876813056
commit
f2596591e5
|
@ -123,4 +123,9 @@ CppApplication {
|
||||||
}
|
}
|
||||||
fileTags: ["cpp_pch_src"]
|
fileTags: ["cpp_pch_src"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Export {
|
||||||
|
Depends { name: "bundle"; condition: qbs.targetOS.contains("macos") }
|
||||||
|
Depends { name: "macdeployqt"; condition: qbs.targetOS.contains("macos") }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ VApp {
|
||||||
Depends { name: "i18nconfig"; }
|
Depends { name: "i18nconfig"; }
|
||||||
Depends { name: "i18n"; }
|
Depends { name: "i18n"; }
|
||||||
Depends { name: "ib"; condition: qbs.targetOS.contains("macos") }
|
Depends { name: "ib"; condition: qbs.targetOS.contains("macos") }
|
||||||
Depends { name: "macdeployqt"; condition: qbs.targetOS.contains("macos") }
|
|
||||||
|
|
||||||
version: buildconfig.projectVersion
|
version: buildconfig.projectVersion
|
||||||
install: true
|
install: true
|
||||||
|
@ -204,7 +203,6 @@ VApp {
|
||||||
Properties {
|
Properties {
|
||||||
condition: qbs.targetOS.contains("macos")
|
condition: qbs.targetOS.contains("macos")
|
||||||
ib.appIconName: targetName
|
ib.appIconName: targetName
|
||||||
macdeployqt.targetApps: ["Tape", "Puzzle"]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Properties {
|
Properties {
|
||||||
|
|
|
@ -87,10 +87,10 @@ Module {
|
||||||
cmdArgs.push("-codesign=" + product.macdeployqt.signingIdentity);
|
cmdArgs.push("-codesign=" + product.macdeployqt.signingIdentity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (product.macdeployqt.targetApps !== undefined && !product.buildconfig.enableMultiBundle && product.primaryApp)
|
if (product.macdeployqt.targetApps !== undefined)
|
||||||
{
|
{
|
||||||
product.macdeployqt.targetApps.forEach(function(targetApp) {
|
product.macdeployqt.targetApps.forEach(function(targetApp) {
|
||||||
cmdArgs.push("-executable=\"" + installRoot + "/" + product.targetName + ".app/Contents/MacOS/" + targetApp + "\"");
|
cmdArgs.push("-executable=" + FileInfo.joinPaths(installRoot, product.targetName + ".app", "Contents", "MacOS", targetApp));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
106
qbs/modules/pdftops/pdftops.qbs
Normal file
106
qbs/modules/pdftops/pdftops.qbs
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
import qbs.Process
|
||||||
|
import qbs.File
|
||||||
|
import qbs.FileInfo
|
||||||
|
import qbs.Utilities
|
||||||
|
|
||||||
|
Module {
|
||||||
|
|
||||||
|
additionalProductTypes: ["pdftops.bundled"]
|
||||||
|
|
||||||
|
readonly property string pdftopsPath: pdftopsProbe.path
|
||||||
|
readonly property bool pdftopsPresent: pdftopsProbe.found
|
||||||
|
|
||||||
|
Probe {
|
||||||
|
id: pdftopsProbe
|
||||||
|
|
||||||
|
property string path
|
||||||
|
property string sourceDirectory: project.sourceDirectory
|
||||||
|
property string qtVersion: product.Qt.core.version
|
||||||
|
|
||||||
|
configure: {
|
||||||
|
if (Utilities.versionCompare(qtVersion, "6") >= 0) {
|
||||||
|
var detector = new Process();
|
||||||
|
try {
|
||||||
|
if (detector.exec("which", ["pdftops"]) === 0) {
|
||||||
|
var binPath = detector.readStdOut().trim(); // we can read only one time
|
||||||
|
if (detector.exec("realpath", [binPath]) === 0) {
|
||||||
|
path = detector.readStdOut().trim();
|
||||||
|
console.info("Found pdftops at '" + path + "'.");
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
detector.close();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var binPath = sourceDirectory + "/dist/macx/bin64/pdftops";
|
||||||
|
if (product.qbs.architecture.contains("x86_64") && File.exists(binPath)) {
|
||||||
|
path = binPath;
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rule {
|
||||||
|
multiplex: true
|
||||||
|
inputs: ["pdftops.in"]
|
||||||
|
|
||||||
|
prepare: {
|
||||||
|
var cmds = [];
|
||||||
|
|
||||||
|
var src = input.filePath;
|
||||||
|
var dst = output.filePath;
|
||||||
|
var copyCmd = new Command("cp", [src, dst]);
|
||||||
|
copyCmd.highlight = 'filegen';
|
||||||
|
copyCmd.description = "copying " + input.fileName;
|
||||||
|
cmds.push(copyCmd);
|
||||||
|
|
||||||
|
if (!product.codesign.enableCodeSigning)
|
||||||
|
return cmds;
|
||||||
|
|
||||||
|
var actualSigningIdentity = product.codesign._actualSigningIdentity;
|
||||||
|
if (!actualSigningIdentity) {
|
||||||
|
throw "No codesigning identities (i.e. certificate and private key pairs) matching “"
|
||||||
|
+ product.codesign.signingIdentity + "” were found.";
|
||||||
|
}
|
||||||
|
|
||||||
|
var args = ["--force", "--sign", actualSigningIdentity.SHA1];
|
||||||
|
|
||||||
|
// If signingTimestamp is undefined or empty, do not specify the flag at all -
|
||||||
|
// this uses the system-specific default behavior
|
||||||
|
var signingTimestamp = product.codesign.signingTimestamp;
|
||||||
|
if (signingTimestamp) {
|
||||||
|
// If signingTimestamp is an empty string, specify the flag but do
|
||||||
|
// not specify a value - this uses a default Apple-provided server
|
||||||
|
var flag = "--timestamp";
|
||||||
|
if (signingTimestamp)
|
||||||
|
flag += "=" + signingTimestamp;
|
||||||
|
args.push(flag);
|
||||||
|
}
|
||||||
|
|
||||||
|
args = args.concat(product.codesign.codesignFlags || []);
|
||||||
|
|
||||||
|
args.push(output.filePath);
|
||||||
|
console.warn(args);
|
||||||
|
var cmdSign = new Command(product.codesign.codesignPath, args);
|
||||||
|
cmdSign.description = "codesign " + output.fileName
|
||||||
|
+ " (" + actualSigningIdentity.subjectInfo.CN + ")";
|
||||||
|
cmdSign.outputFilePath = output.filePath;
|
||||||
|
cmdSign.stderrFilterFunction = function(stderr) {
|
||||||
|
return stderr.replace(outputFilePath + ": replacing existing signature\n", "");
|
||||||
|
};
|
||||||
|
cmds.push(cmdSign);
|
||||||
|
|
||||||
|
return cmds;
|
||||||
|
}
|
||||||
|
|
||||||
|
Artifact {
|
||||||
|
filePath: FileInfo.joinPaths(product.qbs.installRoot, product.qbs.installPrefix,
|
||||||
|
product.buildconfig.installAppPath,
|
||||||
|
product.targetName + ".app", "Contents", "MacOS", "pdftops")
|
||||||
|
fileTags: ["pdftops.bundled"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ VToolApp {
|
||||||
Depends { name: "FervorLib" }
|
Depends { name: "FervorLib" }
|
||||||
Depends { name: "multibundle"; }
|
Depends { name: "multibundle"; }
|
||||||
Depends { name: "VGAnalyticsLib" }
|
Depends { name: "VGAnalyticsLib" }
|
||||||
|
Depends { name: "pdftops"; condition: qbs.targetOS.contains("macos") }
|
||||||
|
|
||||||
// Explicitly link to libcrypto and libssl to avoid error: Failed to load libssl/libcrypto.
|
// Explicitly link to libcrypto and libssl to avoid error: Failed to load libssl/libcrypto.
|
||||||
// Use moduleProviders.qbspkgconfig.extraPaths to define the missing dependency.
|
// Use moduleProviders.qbspkgconfig.extraPaths to define the missing dependency.
|
||||||
|
@ -201,14 +202,23 @@ VToolApp {
|
||||||
qbs.installDir: buildconfig.installBinaryPath
|
qbs.installDir: buildconfig.installBinaryPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Properties {
|
||||||
|
condition: qbs.targetOS.contains("macos") && buildconfig.enableMultiBundle
|
||||||
|
macdeployqt.targetApps: {
|
||||||
|
var apps = [];
|
||||||
|
|
||||||
|
if (pdftops.pdftopsPresent)
|
||||||
|
apps.push("pdftops");
|
||||||
|
|
||||||
|
return apps;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Group {
|
Group {
|
||||||
condition: qbs.targetOS.contains("macos") && qbs.architecture.contains("x86_64") && buildconfig.enableMultiBundle
|
condition: qbs.targetOS.contains("macos") && buildconfig.enableMultiBundle && pdftops.pdftopsPresent
|
||||||
name: "pdftops MacOS"
|
name: "pdftops MacOS"
|
||||||
prefix: project.sourceDirectory + "/dist/macx/bin64/"
|
files: [pdftops.pdftopsPath]
|
||||||
files: ["pdftops"]
|
fileTags: ["pdftops.in"]
|
||||||
fileTags: ["pdftops_dist_macx"]
|
|
||||||
qbs.install: true
|
|
||||||
qbs.installDir: buildconfig.installBinaryPath
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Group {
|
Group {
|
||||||
|
|
|
@ -15,6 +15,7 @@ VToolApp {
|
||||||
Depends { name: "VFormatLib"; }
|
Depends { name: "VFormatLib"; }
|
||||||
Depends { name: "VMiscLib"; }
|
Depends { name: "VMiscLib"; }
|
||||||
Depends { name: "VGAnalyticsLib" }
|
Depends { name: "VGAnalyticsLib" }
|
||||||
|
Depends { name: "pdftops"; condition: qbs.targetOS.contains("macos") }
|
||||||
Depends { name: "Tape"; condition: qbs.targetOS.contains("macos") && buildconfig.enableMultiBundle }
|
Depends { name: "Tape"; condition: qbs.targetOS.contains("macos") && buildconfig.enableMultiBundle }
|
||||||
Depends { name: "Puzzle"; condition: qbs.targetOS.contains("macos") && buildconfig.enableMultiBundle }
|
Depends { name: "Puzzle"; condition: qbs.targetOS.contains("macos") && buildconfig.enableMultiBundle }
|
||||||
|
|
||||||
|
@ -44,7 +45,6 @@ VToolApp {
|
||||||
}
|
}
|
||||||
|
|
||||||
primaryApp: true
|
primaryApp: true
|
||||||
|
|
||||||
name: "Valentina"
|
name: "Valentina"
|
||||||
buildconfig.appTarget: qbs.targetOS.contains("macos") ? "Valentina" : "valentina"
|
buildconfig.appTarget: qbs.targetOS.contains("macos") ? "Valentina" : "valentina"
|
||||||
targetName: buildconfig.appTarget
|
targetName: buildconfig.appTarget
|
||||||
|
@ -258,6 +258,20 @@ VToolApp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Properties {
|
||||||
|
condition: qbs.targetOS.contains("macos")
|
||||||
|
macdeployqt.targetApps: {
|
||||||
|
var apps = [];
|
||||||
|
if (!buildconfig.enableMultiBundle)
|
||||||
|
apps.push("Tape", "Puzzle");
|
||||||
|
|
||||||
|
if (pdftops.pdftopsPresent)
|
||||||
|
apps.push("pdftops");
|
||||||
|
|
||||||
|
return apps;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Group {
|
Group {
|
||||||
condition: qbs.targetOS.contains("windows") && (qbs.architecture.contains("x86_64") || qbs.architecture.contains("x86"))
|
condition: qbs.targetOS.contains("windows") && (qbs.architecture.contains("x86_64") || qbs.architecture.contains("x86"))
|
||||||
name: "pdftops Windows"
|
name: "pdftops Windows"
|
||||||
|
@ -268,12 +282,10 @@ VToolApp {
|
||||||
}
|
}
|
||||||
|
|
||||||
Group {
|
Group {
|
||||||
condition: qbs.targetOS.contains("macos") && qbs.architecture.contains("x86_64")
|
|
||||||
name: "pdftops MacOS"
|
name: "pdftops MacOS"
|
||||||
prefix: project.sourceDirectory + "/dist/macx/bin64/"
|
condition: qbs.targetOS.contains("macos") && pdftops.pdftopsPresent
|
||||||
files: ["pdftops"]
|
files: [pdftops.pdftopsPath]
|
||||||
qbs.install: true
|
fileTags: ["pdftops.in"]
|
||||||
qbs.installDir: buildconfig.installBinaryPath
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Group {
|
Group {
|
||||||
|
|
|
@ -404,22 +404,34 @@ void VLayoutExporter::ExportToHPGL2(const QVector<VLayoutPiece> &details) const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VLayoutExporter::SupportPDFConversion() -> bool
|
auto VLayoutExporter::SupportPDFConversion() -> bool
|
||||||
{
|
{
|
||||||
QProcess proc;
|
auto Test = [](const QString &program)
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_OSX)
|
|
||||||
// Seek pdftops in app bundle or near valentina.exe
|
|
||||||
proc.start(qApp->applicationDirPath() + QLatin1String("/") + *PDFTOPS, QStringList());
|
|
||||||
#else
|
|
||||||
proc.start(*PDFTOPS, QStringList()); // Seek pdftops in standard path
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const int timeout = 15000;
|
|
||||||
if (proc.waitForStarted(timeout) && (proc.waitForFinished(timeout) || proc.state() == QProcess::NotRunning))
|
|
||||||
{
|
{
|
||||||
return true;
|
QProcess proc;
|
||||||
}
|
proc.start(program);
|
||||||
|
|
||||||
qDebug() << *PDFTOPS << "error" << proc.error() << proc.errorString();
|
const int timeout = 15000;
|
||||||
return false;
|
if (proc.waitForStarted(timeout) && (proc.waitForFinished(timeout) || proc.state() == QProcess::NotRunning))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << program << "error" << proc.error() << proc.errorString();
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
#if defined(Q_OS_OSX)
|
||||||
|
// Seek pdftops in app bundle
|
||||||
|
bool found = Test(qApp->applicationDirPath() + QLatin1String("/") + *PDFTOPS);
|
||||||
|
if (not found)
|
||||||
|
{
|
||||||
|
found = Test(*PDFTOPS);
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
#elif defined(Q_OS_WIN)
|
||||||
|
return Test(qApp->applicationDirPath() + QLatin1String("/") + *PDFTOPS);
|
||||||
|
#else
|
||||||
|
return Test(*PDFTOPS);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -436,9 +448,14 @@ void VLayoutExporter::PdfToPs(const QStringList ¶ms)
|
||||||
|
|
||||||
QProcess proc;
|
QProcess proc;
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
// Fix issue #594. Broken export on Mac.
|
if (QFileInfo::exists(qApp->applicationDirPath() + QLatin1String("/") + *PDFTOPS))
|
||||||
proc.setWorkingDirectory(qApp->applicationDirPath());
|
{
|
||||||
proc.start(QLatin1String("./") + *PDFTOPS, params);
|
proc.start(QLatin1String(qApp->applicationDirPath() + QLatin1String("/") + *PDFTOPS, params);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
proc.start(*PDFTOPS, params);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
proc.start(*PDFTOPS, params);
|
proc.start(*PDFTOPS, params);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user