8 Commits

Author SHA1 Message Date
Alexis Lopez Zubieta 18f2d94241 Print the subprocess output directly to stdout and stderr. 2018-08-04 12:33:41 -05:00
TheAssassin 9743988c80 No longer bundle Qt plugin
It's almost always outdated, users will be better off downloading the
upstream AppImage.
2018-08-03 23:34:50 +02:00
TheAssassin 84b614c1ea Fix plugin finding 2018-08-03 23:31:25 +02:00
TheAssassin 1035ef726d Fix include path 2018-08-03 01:22:59 +02:00
TheAssassin 1c7e768b86 Provide interface to linuxdeploy_util 2018-08-03 00:56:16 +02:00
TheAssassin a28181d98c Fix CMake minimum required version 2018-07-31 21:35:06 +02:00
TheAssassin fcd3ad49db Link against shared libmagic library
This allows distro maintainers to build linuxdeploy more easily

CC @adrianschroeter
2018-07-31 16:21:46 +02:00
TheAssassin cc6310cbbd Allow icons with extension 2018-07-31 15:21:38 +02:00
12 changed files with 36 additions and 76 deletions
+4 -7
View File
@@ -3,10 +3,10 @@ cmake_minimum_required(VERSION 3.3)
message(STATUS "Searching for libmagic")
find_library(LIBMAGIC_A libmagic.a)
find_library(LIBMAGIC_LIBRARIES magic)
if(NOT LIBMAGIC_A)
message(FATAL_ERROR "libmagic.a not found")
if(NOT LIBMAGIC_LIBRARIES)
message(FATAL_ERROR "libmagic not found")
endif()
find_path(LIBMAGIC_MAGIC_H_DIR
@@ -19,9 +19,6 @@ if(NOT LIBMAGIC_MAGIC_H_DIR)
message(FATAL_ERROR "magic.h not found")
endif()
# on Debian-ish systems, libmagic depends on zlib
find_package(ZLIB REQUIRED)
add_library(libmagic_static INTERFACE IMPORTED)
set_property(TARGET libmagic_static PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${LIBMAGIC_MAGIC_H_DIR})
set_property(TARGET libmagic_static PROPERTY INTERFACE_LINK_LIBRARIES ${LIBMAGIC_A};ZLIB::ZLIB)
set_property(TARGET libmagic_static PROPERTY INTERFACE_LINK_LIBRARIES ${LIBMAGIC_LIBRARIES})
+2 -48
View File
@@ -134,54 +134,8 @@ namespace linuxdeploy {
}
log << std::endl;
auto process = subprocess::Popen(args, subprocess::output{subprocess::PIPE}, subprocess::error{subprocess::PIPE});
std::vector<pollfd> pfds(2);
auto* opfd = &pfds[0];
auto* epfd = &pfds[1];
opfd->fd = fileno(process.output());
opfd->events = POLLIN;
epfd->fd = fileno(process.error());
epfd->events = POLLIN;
auto printOutput = [&pfds, opfd, epfd, this, &process]() {
poll(pfds.data(), pfds.size(), -1);
if (opfd->revents & POLLIN) {
std::ostringstream oss;
std::vector<char> buf(4096);
auto* lineptr = buf.data();
auto n = buf.size();
while (getline(&lineptr, &n, process.output()) != -1) {
oss << "[" << d->name << "/stdout] " << buf.data();
}
linuxdeploy::core::log::ldLog() << oss.str();
}
if (epfd->revents & POLLIN) {
std::ostringstream oss;
std::vector<char> buf(4096);
auto* lineptr = buf.data();
auto n = buf.size();
while (getline(&lineptr, &n, process.error()) != -1) {
oss << "[" << d->name << "/stderr] " << buf.data();
}
linuxdeploy::core::log::ldLog() << oss.str();
}
};
do {
printOutput();
} while (process.poll() < 0);
printOutput();
auto process = subprocess::Popen(args, subprocess::output{stdout}, subprocess::error{stderr});
process.wait();
return process.retcode();
}
+3
View File
@@ -1,3 +1,6 @@
# 3.5 is required for imported boost targets
cmake_minimum_required(VERSION 3.5)
# globally include own includes
include_directories(${PROJECT_SOURCE_DIR}/include)
+1 -3
View File
@@ -1,6 +1,4 @@
# 3.5 is required for imported boost targets
# 3.6 is required for the PkgConfig module's IMPORTED_TARGET library feature
cmake_minimum_required(VERSION 3.6)
cmake_minimum_required(VERSION 2.8)
# include headers to make CLion happy
file(GLOB HEADERS ${PROJECT_SOURCE_DIR}/include/linuxdeploy/core/*.h)
+8 -2
View File
@@ -13,7 +13,7 @@
#include "linuxdeploy/core/appdir.h"
#include "linuxdeploy/core/elf.h"
#include "linuxdeploy/core/log.h"
#include "util.h"
#include "linuxdeploy/util/util.h"
#include "excludelist.h"
using namespace linuxdeploy::core;
@@ -701,7 +701,13 @@ namespace linuxdeploy {
for (const auto& iconPath : foundIconPaths) {
ldLog() << LD_DEBUG << "Icon found:" << iconPath << std::endl;
if (iconPath.stem() == iconName) {
const bool matchesFilenameWithExtension = iconPath.filename() == iconName;
if (iconPath.stem() == iconName || matchesFilenameWithExtension) {
if (matchesFilenameWithExtension) {
ldLog() << LD_WARNING << "Icon= entry filename contains extension" << std::endl;
}
ldLog() << "Deploying icon to AppDir root:" << iconPath << std::endl;
if (!d->symlinkFile(iconPath, path())) {
+1 -1
View File
@@ -8,7 +8,7 @@
// local headers
#include "linuxdeploy/core/elf.h"
#include "linuxdeploy/core/log.h"
#include "util.h"
#include "linuxdeploy/util/util.h"
using namespace linuxdeploy::core::log;
+1 -1
View File
@@ -11,7 +11,7 @@
#include "linuxdeploy/core/elf.h"
#include "linuxdeploy/core/log.h"
#include "linuxdeploy/plugin/plugin.h"
#include "util.h"
#include "linuxdeploy/util/util.h"
using namespace linuxdeploy::core;
using namespace linuxdeploy::core::log;
+9 -3
View File
@@ -13,7 +13,7 @@
#include "linuxdeploy/core/log.h"
#include "linuxdeploy/plugin/base.h"
#include "linuxdeploy/plugin/plugin.h"
#include "util.h"
#include "linuxdeploy/util/util.h"
#include "plugin_type0.h"
using namespace linuxdeploy::core;
@@ -46,7 +46,8 @@ namespace linuxdeploy {
auto currentExeDir = bf::path(util::getOwnExecutablePath()).parent_path();
paths.insert(paths.begin(), currentExeDir.string());
// if shipping as an AppImage, search for plugins in AppImage's location, too
// if shipping as an AppImage, search for plugins in AppImage's location first
// this way, plugins in the AppImage's directory take precedence over bundled ones
if (getenv("APPIMAGE") != nullptr) {
auto appImageDir = bf::path(getenv("APPIMAGE")).parent_path();
paths.insert(paths.begin(), appImageDir.string());
@@ -71,7 +72,12 @@ namespace linuxdeploy {
ldLog() << LD_DEBUG << "Failed to create instance for plugin" << i->path();
} else {
ldLog() << LD_DEBUG << "Found plugin '" << LD_NO_SPACE << name << LD_NO_SPACE << "':" << plugin->path() << std::endl;
foundPlugins[name] = plugin;
if (foundPlugins.find(name) != foundPlugins.end()) {
ldLog() << LD_DEBUG << "Already found" << name << "plugin in" << foundPlugins[name]->path() << std::endl;
} else {
foundPlugins[name] = plugin;
}
}
} catch (const PluginError& e) {
ldLog() << LD_WARNING << "Could not load plugin" << i->path() << LD_NO_SPACE << ": " << e.what();
+7 -2
View File
@@ -1,2 +1,7 @@
add_library(linuxdeploy_util STATIC magicwrapper.cpp magicwrapper.h util.h misc.h)
target_include_directories(linuxdeploy_util PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
add_library(linuxdeploy_util STATIC
magicwrapper.cpp
magicwrapper.h
${PROJECT_SOURCE_DIR}/include/linuxdeploy/util/util.h
${PROJECT_SOURCE_DIR}/include/linuxdeploy/util/misc.h
)
target_include_directories(linuxdeploy_util PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include)
-9
View File
@@ -55,15 +55,6 @@ mv squashfs-root/ AppDir/plugins/linuxdeploy-plugin-appimage
ln -s ../../plugins/linuxdeploy-plugin-appimage/AppRun AppDir/usr/bin/linuxdeploy-plugin-appimage
# bundle Qt plugin
wget https://github.com/TheAssassin/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-"$ARCH".AppImage
chmod +x linuxdeploy-plugin-qt-"$ARCH".AppImage
./linuxdeploy-plugin-qt-"$ARCH".AppImage --appimage-extract
mv squashfs-root/ AppDir/plugins/linuxdeploy-plugin-qt
ln -s ../../plugins/linuxdeploy-plugin-qt/AppRun AppDir/usr/bin/linuxdeploy-plugin-qt
# build AppImage using plugin
AppDir/usr/bin/linuxdeploy-plugin-appimage --appdir AppDir/