Remove macdeploycheck

This commit is contained in:
Jonas Kvinge 2024-09-13 19:44:16 +02:00
parent b60ca9f6fa
commit 4b36beec40
5 changed files with 13 additions and 172 deletions

View File

@ -275,7 +275,6 @@ if(APPLE)
add_subdirectory(3rdparty/SPMediaKeyTap) add_subdirectory(3rdparty/SPMediaKeyTap)
set(SPMEDIAKEYTAP_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/SPMediaKeyTap) set(SPMEDIAKEYTAP_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/SPMediaKeyTap)
set(SPMEDIAKEYTAP_LIBRARIES SPMediaKeyTap) set(SPMEDIAKEYTAP_LIBRARIES SPMediaKeyTap)
add_subdirectory(ext/macdeploycheck)
endif() endif()
if(WIN32) if(WIN32)

View File

@ -1,10 +1,17 @@
find_program(MACDEPLOYQT_EXECUTABLE NAMES macdeployqt PATHS /usr/bin /usr/local/bin /opt/local/bin /usr/local/opt/qt6/bin /usr/local/opt/qt5/bin REQUIRED) find_program(MACDEPLOYQT_EXECUTABLE NAMES macdeployqt PATHS /usr/bin /usr/local/bin /opt/local/bin /usr/local/opt/qt6/bin REQUIRED)
if(MACDEPLOYQT_EXECUTABLE) if(MACDEPLOYQT_EXECUTABLE)
message(STATUS "Found macdeployqt: ${MACDEPLOYQT_EXECUTABLE}") message(STATUS "Found macdeployqt: ${MACDEPLOYQT_EXECUTABLE}")
else() else()
message(WARNING "Missing macdeployqt executable.") message(WARNING "Missing macdeployqt executable.")
endif() endif()
find_program(MACDEPLOYCHECK_EXECUTABLE NAMES macdeploycheck PATHS /usr/bin /usr/local/bin /opt/local/bin /usr/local/opt/qt6/bin REQUIRED)
if(MACDEPLOYCHECK_EXECUTABLE)
message(STATUS "Found macdeploycheck: ${MACDEPLOYCHECK_EXECUTABLE}")
else()
message(WARNING "Missing macdeploycheck executable.")
endif()
find_program(CREATEDMG_EXECUTABLE NAMES create-dmg REQUIRED) find_program(CREATEDMG_EXECUTABLE NAMES create-dmg REQUIRED)
if(CREATEDMG_EXECUTABLE) if(CREATEDMG_EXECUTABLE)
message(STATUS "Found create-dmg: ${CREATEDMG_EXECUTABLE}") message(STATUS "Found create-dmg: ${CREATEDMG_EXECUTABLE}")
@ -31,10 +38,11 @@ if(MACDEPLOYQT_EXECUTABLE)
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DEPENDS strawberry strawberry-tagreader DEPENDS strawberry strawberry-tagreader
) )
if(MACDEPLOYCHECK_EXECUTABLE)
add_custom_target(deploycheck add_custom_target(deploycheck
COMMAND ${CMAKE_BINARY_DIR}/ext/macdeploycheck/macdeploycheck strawberry.app COMMAND ${MACDEPLOYCHECK_EXECUTABLE} strawberry.app
DEPENDS macdeploycheck
) )
endif()
if(CREATEDMG_EXECUTABLE) if(CREATEDMG_EXECUTABLE)
add_custom_target(dmg add_custom_target(dmg
COMMAND ${CREATEDMG_EXECUTABLE} --volname strawberry --background "${CMAKE_SOURCE_DIR}/dist/macos/dmg_background.png" --app-drop-link 450 218 --icon strawberry.app 150 218 --window-size 600 450 ${CREATEDMG_CODESIGN} ${CREATEDMG_SKIP_JENKINS_ARG} strawberry-${STRAWBERRY_VERSION_PACKAGE}-${CMAKE_HOST_SYSTEM_PROCESSOR}.dmg strawberry.app COMMAND ${CREATEDMG_EXECUTABLE} --volname strawberry --background "${CMAKE_SOURCE_DIR}/dist/macos/dmg_background.png" --app-drop-link 450 218 --icon strawberry.app 150 218 --window-size 600 450 ${CREATEDMG_CODESIGN} ${CREATEDMG_SKIP_JENKINS_ARG} strawberry-${STRAWBERRY_VERSION_PACKAGE}-${CMAKE_HOST_SYSTEM_PROCESSOR}.dmg strawberry.app

1
debian/copyright vendored
View File

@ -95,7 +95,6 @@ Files: src/core/main.h
src/transcoder/transcoderoptionswavpack.h src/transcoder/transcoderoptionswavpack.h
ext/libstrawberry-tagreader/tagreadertagparser.cpp ext/libstrawberry-tagreader/tagreadertagparser.cpp
ext/libstrawberry-tagreader/tagreadertagparser.h ext/libstrawberry-tagreader/tagreadertagparser.h
ext/macdeploycheck/*
src/widgets/resizabletextedit.cpp src/widgets/resizabletextedit.cpp
src/widgets/resizabletextedit.h src/widgets/resizabletextedit.h
Copyright: 2012-2014, 2017-2023, Jonas Kvinge <jonas@jkvinge.net> Copyright: 2012-2014, 2017-2023, Jonas Kvinge <jonas@jkvinge.net>

View File

@ -1,18 +0,0 @@
cmake_minimum_required(VERSION 3.13)
qt_wrap_cpp(MACDEPLOYCHECK_MOC ${CMAKE_SOURCE_DIR}/ext/libstrawberry-common/core/logging.h)
add_executable(macdeploycheck macdeploycheck.cpp ${CMAKE_SOURCE_DIR}/ext/libstrawberry-common/core/logging.cpp ${MACDEPLOYCHECK_MOC})
target_include_directories(macdeploycheck PUBLIC SYSTEM
${GLIB_INCLUDE_DIRS}
)
target_include_directories(macdeploycheck PUBLIC
${CMAKE_SOURCE_DIR}/ext/libstrawberry-common
${CMAKE_BINARY_DIR}/src
)
target_link_directories(macdeploycheck PUBLIC ${GLIB_LIBRARY_DIRS})
target_link_libraries(macdeploycheck PUBLIC
"-framework AppKit"
${GLIB_LIBRARIES}
Qt${QT_VERSION_MAJOR}::Core
)

View File

@ -1,147 +0,0 @@
/* This file is part of Strawberry.
Copyright 2021, Jonas Kvinge <jonas@jkvinge.net>
Strawberry is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Strawberry 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QCoreApplication>
#include <QString>
#include <QStringList>
#include <QFile>
#include <QFileInfo>
#include <QDir>
#include <QDirIterator>
#include <QProcess>
#include <QRegularExpression>
#include <QRegularExpressionMatch>
#include "core/logging.h"
int main(int argc, char **argv);
int main(int argc, char **argv) {
QCoreApplication app(argc, argv);
logging::Init();
qLog(Info) << "Running macdeploycheck";
if (argc < 1) {
qLog(Error) << "Usage: macdeploycheck <bundledir>";
return 1;
}
QString bundle_path = QString::fromLocal8Bit(argv[1]);
bool success = true;
QDirIterator iter(bundle_path, QDir::Files | QDir::NoSymLinks, QDirIterator::Subdirectories);
while (iter.hasNext()) {
iter.next();
QString filepath = iter.fileInfo().filePath();
// Ignore these files.
if (filepath.endsWith(".plist") ||
filepath.endsWith(".icns") ||
filepath.endsWith(".prl") ||
filepath.endsWith(".conf") ||
filepath.endsWith(".h") ||
filepath.endsWith(".nib") ||
filepath.endsWith(".strings") ||
filepath.endsWith(".css") ||
filepath.endsWith("CodeResources") ||
filepath.endsWith("PkgInfo") ||
filepath.endsWith(".modulemap")) {
continue;
}
QProcess otool;
otool.start("otool", QStringList() << "-L" << filepath);
otool.waitForFinished();
if (otool.exitStatus() != QProcess::NormalExit || otool.exitCode() != 0) {
qLog(Error) << "otool failed for" << filepath << ":" << otool.readAllStandardError();
success = false;
continue;
}
QString output = otool.readAllStandardOutput();
QStringList output_lines = output.split("\n", Qt::SkipEmptyParts);
if (output_lines.size() < 2) {
qLog(Error) << "Could not parse otool output:" << output;
success = false;
continue;
}
QString first_line = output_lines.first();
if (first_line.endsWith(':')) first_line.chop(1);
if (first_line == filepath) {
output_lines.removeFirst();
}
else {
qLog(Error) << "First line" << first_line << "does not match" << filepath;
success = false;
}
QRegularExpression regexp(QStringLiteral("^\\t(.+) \\(compatibility version (\\d+\\.\\d+\\.\\d+), current version (\\d+\\.\\d+\\.\\d+)(, weak|, reexport)?\\)$"));
for (const QString &output_line : output_lines) {
//qDebug() << "Final check on" << filepath << output_line;
QRegularExpressionMatch match = regexp.match(output_line);
if (match.hasMatch()) {
QString library = match.captured(1);
if (QFileInfo(library).fileName() == QFileInfo(filepath).fileName()) { // It's this.
continue;
}
else if (library.startsWith("@executable_path")) {
QString real_path = library;
real_path = real_path.replace("@executable_path", bundle_path + "/Contents/MacOS");
if (!QFile::exists(real_path)) {
qLog(Error) << real_path << "does not exist for" << filepath;
success = false;
}
}
else if (library.startsWith("@rpath")) {
QString real_path = library;
real_path = real_path.replace("@rpath", bundle_path + "/Contents/Frameworks");
if (!QFile::exists(real_path) && !real_path.endsWith("QtSvg")) { // FIXME: Ignore broken svg image plugin.
qLog(Error) << real_path << "does not exist for" << filepath;
success = false;
}
}
else if (library.startsWith("@loader_path")) {
QString loader_path = QFileInfo(filepath).path();
QString real_path = library;
real_path = real_path.replace("@loader_path", loader_path);
if (!QFile::exists(real_path)) {
qLog(Error) << real_path << "does not exist for" << filepath;
success = false;
}
}
else if (library.startsWith("/System/Library/") || library.startsWith("/usr/lib/")) { // System library
continue;
}
else {
qLog(Error) << "File" << filepath << "points to" << library;
success = false;
}
}
else {
qLog(Error) << "Could not parse otool output line:" << output_line;
success = false;
}
}
}
return success ? 0 : 1;
}