[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [digikam-software-compilation] project: polish
From:       Gilles Caulier <caulier.gilles () gmail ! com>
Date:       2016-05-26 21:35:27
Message-ID: E1b62wB-00047Z-Gq () scm ! kde ! org
[Download RAW message or body]

Git commit 5aa1ae8aa115af166af0c889b3b3c4537bf09ab7 by Gilles Caulier.
Committed on 26/05/2016 at 21:35.
Pushed by cgilles into branch 'master'.

polish

M  +7    -3    project/macosx/03-build-digikam.sh
A  +33   -0    project/macosx/icon-rcc/CMakeLists.txt
A  +136  -0    project/macosx/icon-rcc/main.cpp     [License: LGPL (v2+)]
M  +5    -4    project/mxe/03-build-digikam.sh

http://commits.kde.org/scratch/mwiesweg/digikam-sc/5aa1ae8aa115af166af0c889b3b3c4537bf09ab7


diff --git a/project/macosx/03-build-digikam.sh b/project/macosx/03-build-digikam.sh
index bc95dbb..037105e 100755
--- a/project/macosx/03-build-digikam.sh
+++ b/project/macosx/03-build-digikam.sh
@@ -74,7 +74,11 @@ fi
 cp -f $ORIG_WD/../../bootstrap.macports $DK_BUILDTEMP/digikam-$DK_VERSION
 
 echo -e "\n\n"
-echo "---------- Configure digiKam"
+echo "---------- Configure digiKam $DK_VERSION"
+
+sed -e "s/DIGIKAMSC_CHECKOUT_PO=OFF/DIGIKAMSC_CHECKOUT_PO=ON/g" ./bootstrap.macports \
> ./tmp.mxe ; mv -f ./tmp.mxe ./bootstrap.macports +sed -e \
> "s/DIGIKAMSC_COMPILE_PO=OFF/DIGIKAMSC_COMPILE_PO=ON/g"   ./bootstrap.macports > \
> ./tmp.mxe ; mv -f ./tmp.mxe ./bootstrap.macports
+chmod +x ./bootstrap.macports
 
 ./bootstrap.macports "$INSTALL_PREFIX" "debugfull" "x86_64"
 
@@ -85,7 +89,7 @@ if [ $? -ne 0 ]; then
 fi
 
 echo -e "\n\n"
-echo "---------- Building digiKam"
+echo "---------- Building digiKam $DK_VERSION"
 
 cd build
 make -j$CPU_CORES
@@ -97,7 +101,7 @@ if [ $? -ne 0 ]; then
 fi
 
 echo -e "\n\n"
-echo "---------- Installing digiKam"
+echo "---------- Installing digiKam $DK_VERSION"
 echo -e "\n\n"
 
 make install/fast && cd "$ORIG_WD" && rm -rf "$DK_BUILDTEMP"
diff --git a/project/macosx/icon-rcc/CMakeLists.txt \
b/project/macosx/icon-rcc/CMakeLists.txt new file mode 100644
index 0000000..2fd2ef8
--- /dev/null
+++ b/project/macosx/icon-rcc/CMakeLists.txt
@@ -0,0 +1,33 @@
+#
+# Copyright (c) 2010-2016 by Gilles Caulier, <caulier dot gilles at gmail dot com>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+if (POLICY CMP0063)
+    cmake_policy(SET CMP0063 NEW)
+endif (POLICY CMP0063)
+
+cmake_minimum_required(VERSION 3.0.0)
+
+find_package(Qt5 NO_MODULE REQUIRED Core)
+
+add_executable(qrcAlias main.cpp)
+target_link_libraries(qrcAlias PUBLIC Qt5::Core)
+
+add_custom_command(OUTPUT breeze.rcc
+    COMMAND rcc -project -o icons.qrc
+
+    COMMAND $<TARGET_FILE_DIR:qrcAlias>/$<TARGET_FILE_NAME:qrcAlias> -i icons.qrc -o \
aliased.qrc +
+    COMMAND rcc -binary -o ${CMAKE_BINARY_DIR}/breeze.rcc -root /icons/breeze \
aliased.qrc +
+    WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/share/icons/breeze
+    DEPENDS qrcAlias
+)
+
+add_custom_target(icons ALL
+    DEPENDS breeze.rcc
+)
+
+install(FILES ${CMAKE_BINARY_DIR}/breeze.rcc DESTINATION \
                ${CMAKE_INSTALL_PREFIX}/bin/)
diff --git a/project/macosx/icon-rcc/main.cpp b/project/macosx/icon-rcc/main.cpp
new file mode 100644
index 0000000..f774117
--- /dev/null
+++ b/project/macosx/icon-rcc/main.cpp
@@ -0,0 +1,136 @@
+/* This file is part of the KDE project
+   Copyright (C) 2015 Christoph Cullmann <cullmann@kde.org>
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public License
+   along with this library; see the file COPYING.LIB.  If not, write to
+   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.
+*/
+
+#include <QCoreApplication>
+#include <QFile>
+#include <QFileInfo>
+#include <QString>
+#include <QRegularExpression>
+#include <QDebug>
+#include <QCommandLineParser>
+
+QString link(const QString& path, const QString& fileName)
+{
+    QFile in(QStringLiteral("%1/%2").arg(path, fileName));
+
+    if (!in.open(QIODevice::ReadOnly))
+    {
+        qDebug() << "failed to read" << path << fileName << in.fileName();
+        return QString();
+    }
+
+    QString firstLine = in.readLine();
+
+    if (firstLine.isEmpty())
+    {
+        qDebug() << in.fileName() << "line could not be read...";
+        return QString();
+    }
+
+    QRegularExpression fNameReg(QStringLiteral("(.*\\.(?:svg|png|gif|ico))"));
+    QRegularExpressionMatch match = fNameReg.match(firstLine);
+
+    if (!match.hasMatch())
+    {
+        return QString();
+    }
+
+    QFileInfo linkInfo(QStringLiteral("%1/%2").arg(path, match.captured(1)));
+    QString aliasLink = link(linkInfo.path(), linkInfo.fileName());
+
+    if (!aliasLink.isEmpty())
+    {
+        //qDebug() <<  fileName << "=" << match.captured(1) << "=" << aliasLink;
+        return aliasLink;
+    }
+
+    return  QStringLiteral("%1/%2").arg(path, match.captured(1));
+}
+
+int parseFile(const QString &infile, const QString &outfile)
+{
+    QFile in(infile);
+    QFile out(outfile);
+    QRegularExpression \
imageReg(QStringLiteral("<file>(.*\\.(?:svg|png|gif|ico))</file>")); +
+    if (!in.open(QIODevice::ReadOnly))
+    {
+        qDebug() << "Failed to open" << infile;
+        return -1;
+    }
+
+    if (!out.open(QIODevice::WriteOnly))
+    {
+        qDebug() << "Failed to create" << outfile;
+        return -2;
+    }
+
+    while (in.bytesAvailable())
+    {
+        QString line = QString::fromLocal8Bit(in.readLine());
+        QRegularExpressionMatch match = imageReg.match(line);
+
+        if (!match.hasMatch())
+        {
+            //qDebug() << "No Match: " << line;
+            out.write(qPrintable(line));
+            continue;
+        }
+
+        QFileInfo info(match.captured(1));
+
+
+        QString aliasLink = link(info.path(), info.fileName());
+
+        if (aliasLink.isEmpty())
+        {
+            //qDebug() << "No alias: " << line;
+            out.write(qPrintable(line));
+            continue;
+        }
+
+        QString newLine = QStringLiteral("<file \
alias=\"%1\">%2</file>\n").arg(match.captured(1), aliasLink); +        //qDebug() << \
newLine; +        out.write(qPrintable(newLine));
+    }
+
+    return 0;
+}
+
+int main(int argc, char* argv[])
+{
+    QCoreApplication app(argc, argv);
+
+    QCommandLineParser parser;
+
+    QCommandLineOption inOption(QStringList()  << QLatin1String("i") << \
QLatin1String("infile"),  QStringLiteral("Input qrc file"),  \
QStringLiteral("infile")); +    QCommandLineOption outOption(QStringList() << \
QLatin1String("o") << QLatin1String("outfile"), QStringLiteral("Output qrc file"), \
QStringLiteral("outfile")); +    parser.addHelpOption();
+    parser.addVersionOption();
+    parser.addOption(inOption);
+    parser.addOption(outOption);
+    parser.process(app);
+
+    const QString inName  = parser.value(inOption);
+    const QString outName = parser.value(outOption);
+
+    qDebug() << inName << outName;
+
+    return parseFile(inName, outName);
+}
diff --git a/project/mxe/03-build-digikam.sh b/project/mxe/03-build-digikam.sh
index bbe5b64..4a64bad 100755
--- a/project/mxe/03-build-digikam.sh
+++ b/project/mxe/03-build-digikam.sh
@@ -70,13 +70,13 @@ else
 fi
 
 echo -e "\n\n"
-echo "---------- Configure digiKam with CXX extra flags : $EXTRA_CXX_FLAGS"
+echo "---------- Configure digiKam $DK_VERSION"
 
 rm -rf build
 mkdir build
 
 sed -e "s/DIGIKAMSC_CHECKOUT_PO=OFF/DIGIKAMSC_CHECKOUT_PO=ON/g" ./bootstrap.mxe > \
                ./tmp.mxe ; mv -f ./tmp.mxe ./bootstrap.mxe
-sed -e "s/DIGIKAMSC_COMPILE_PO=OFF/DIGIKAMSC_COMPILE_PO=ON/g" ./bootstrap.mxe > \
./tmp.mxe ; mv -f ./tmp.mxe ./bootstrap.mxe +sed -e \
"s/DIGIKAMSC_COMPILE_PO=OFF/DIGIKAMSC_COMPILE_PO=ON/g"   ./bootstrap.mxe > ./tmp.mxe \
; mv -f ./tmp.mxe ./bootstrap.mxe  chmod +x ./bootstrap.mxe
 
 ./bootstrap.mxe $MXE_BUILDROOT relwithdebinfo $MXE_BUILD_TARGETS \
-DPng2Ico_EXECUTABLE=${ORIG_WD}/png2ico/png2ico @@ -88,7 +88,7 @@ if [ $? -ne 0 ]; \
then  fi
 
 echo -e "\n\n"
-echo "---------- Building digiKam"
+echo "---------- Building digiKam $DK_VERSION"
 
 cd build
 make -j$CPU_CORES
@@ -100,10 +100,11 @@ if [ $? -ne 0 ]; then
 fi
 
 echo -e "\n\n"
-echo "---------- Installing digiKam"
+echo "---------- Installing digiKam $DK_VERSION"
 echo -e "\n\n"
 
 make install/fast && cd "$ORIG_WD" && rm -rf "$DK_BUILDTEMP"
+
 if [ $? -ne 0 ]; then
     echo "---------- Cannot install digiKam $DK_VERSION."
     echo "---------- Aborting..."


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic