lol

appimagekit: 2018-07-27 -> 2020-12-31 (#116501)

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>

authored by

Taeer Bar-Yam
Sandro
and committed by
GitHub
d9424d21 2fb8be18

+90 -180
+25 -23
pkgs/tools/package-management/appimagekit/default.nix
··· 11 11 appimagekit_src = fetchFromGitHub { 12 12 owner = "AppImage"; 13 13 repo = "AppImageKit"; 14 - rev = "b0859501df61cde198b54a317c03b41dbafc98b1"; 15 - sha256 = "0qqg79jw9w9rs8c2w3lla4kz62ihafrf7jm370pp1dl8y2i81jzg"; 14 + rev = "8bbf694455d00f48d835f56afaa1dabcd9178ba6"; 15 + sha256 = "sha256-pqg+joomC5CI9WdKP/h/XKPsruMgZEaIOjPLOqnNPZw="; 16 + fetchSubmodules = true; 16 17 }; 17 18 18 - # squashfuse adapted to nix from cmake experession in "${appimagekit_src}/cmake/dependencies.cmake" 19 + # squashfuse adapted to nix from cmake experession in "${appimagekit_src}/lib/libappimage/cmake/dependencies.cmake" 19 20 appimagekit_squashfuse = squashfuse.overrideAttrs (attrs: rec { 20 - name = "squashfuse-${version}"; 21 - version = "20161009"; 21 + pname = "squashfuse"; 22 + version = "unstable-2016-10-09"; 22 23 23 24 src = fetchFromGitHub { 24 25 owner = "vasi"; 25 - repo = "squashfuse"; 26 - rev = "1f980303b89c779eabfd0a0fdd36d6a7a311bf92"; 27 - sha256 = "0lrw9ff8k15l34wjwyllw3i35hl0cms97jj2hpnr2q8ipgxpb5q5"; 26 + repo = pname; 27 + rev = "1f980303b89c779eabfd0a0fdd36d6a7a311bf92"; 28 + sha256 = "sha256-BZd1+7sRYZHthULKk3RlgMIy4uCUei45GbSEiZxLPFM="; 28 29 }; 29 30 30 31 patches = [ 31 - "${appimagekit_src}/squashfuse.patch" 32 - "${appimagekit_src}/squashfuse_dlopen.patch" 32 + "${appimagekit_src}/lib/libappimage/src/patches/squashfuse.patch" 33 + "${appimagekit_src}/lib/libappimage/src/patches/squashfuse_dlopen.patch" 33 34 ]; 34 35 35 36 postPatch = '' 36 - cp -v ${appimagekit_src}/squashfuse_dlopen.[hc] . 37 + cp -v ${appimagekit_src}/lib/libappimage/src/patches/squashfuse_dlopen.[hc] . 37 38 ''; 38 39 39 40 preConfigure = '' ··· 58 59 }); 59 60 60 61 in stdenv.mkDerivation rec { 61 - name = "appimagekit-20180727"; 62 + pname = "appimagekit"; 63 + version = "unstable-2020-12-31"; 62 64 63 65 src = appimagekit_src; 64 66 65 67 patches = [ ./nix.patch ]; 68 + 69 + postPatch = '' 70 + patchShebangs src/embed-magic-bytes-in-file.sh 71 + ''; 66 72 67 73 nativeBuildInputs = [ 68 74 pkg-config cmake autoconf automake libtool wget xxd 69 - desktop-file-utils 75 + desktop-file-utils makeWrapper 70 76 ]; 71 77 72 78 buildInputs = [ 73 - glib zlib cairo openssl fuse 74 - xz inotify-tools libarchive 75 - squashfsTools makeWrapper 79 + glib zlib cairo openssl fuse xz inotify-tools 80 + libarchive squashfsTools appimagekit_squashfuse 76 81 ]; 77 - 78 - postPatch = '' 79 - substituteInPlace src/appimagetool.c --replace "/usr/bin/file" "${file}/bin/file" 80 - ''; 81 82 82 83 preConfigure = '' 83 84 export HOME=$(pwd) ··· 87 88 "-DUSE_SYSTEM_XZ=ON" 88 89 "-DUSE_SYSTEM_SQUASHFUSE=ON" 89 90 "-DSQUASHFUSE=${appimagekit_squashfuse}" 90 - "-DUSE_SYSTEM_INOTIFY_TOOLS=ON" 91 91 "-DUSE_SYSTEM_LIBARCHIVE=ON" 92 92 "-DUSE_SYSTEM_GTEST=ON" 93 93 "-DUSE_SYSTEM_MKSQUASHFS=ON" 94 94 ]; 95 95 96 96 postInstall = '' 97 + mkdir -p $out/lib/appimagekit 97 98 cp "${squashfsTools}/bin/mksquashfs" "$out/lib/appimagekit/" 98 99 cp "${desktop-file-utils}/bin/desktop-file-validate" "$out/bin" 99 100 100 101 wrapProgram "$out/bin/appimagetool" \ 101 - --prefix PATH : "${lib.makeBinPath [ file gnupg ]}" 102 + --prefix PATH : "${lib.makeBinPath [ file gnupg ]}" \ 103 + --unset SOURCE_DATE_EPOCH 102 104 ''; 103 105 104 106 checkInputs = [ gtest ]; 105 - doCheck = false; # fails 1 out of 4 tests, I'm too lazy to debug why 106 107 107 108 # for debugging 108 109 passthru = { ··· 117 118 AppImages. 118 119 ''; 119 120 license = licenses.mit; 121 + maintainers = with maintainers; [ taeer ]; 120 122 homepage = src.meta.homepage; 121 123 platforms = platforms.linux; 122 124 };
+65 -157
pkgs/tools/package-management/appimagekit/nix.patch
··· 1 - diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake 2 - index ea133a3..916606c 100644 3 - --- a/cmake/dependencies.cmake 4 - +++ b/cmake/dependencies.cmake 5 - @@ -224,21 +224,23 @@ if(NOT USE_SYSTEM_XZ) 6 - LIBRARY_DIRS <INSTALL_DIR>/lib/ 7 - LIBRARIES "<INSTALL_DIR>/lib/liblzma.a" 8 - INCLUDE_DIRS "<SOURCE_DIR>/src/liblzma/api/" 1 + Submodule lib/libappimage contains modified content 2 + diff --git a/lib/libappimage/cmake/dependencies.cmake b/lib/libappimage/cmake/dependencies.cmake 3 + index 8d96484..c7b17a1 100644 4 + --- a/lib/libappimage/cmake/dependencies.cmake 5 + +++ b/lib/libappimage/cmake/dependencies.cmake 6 + @@ -91,9 +91,18 @@ if(NOT USE_SYSTEM_SQUASHFUSE) 7 + INCLUDE_DIRS "<SOURCE_DIR>" 9 8 ) 10 9 else() 11 - message(STATUS "Using system xz") 12 - 13 - import_pkgconfig_target(TARGET_NAME xz PKGCONFIG_TARGET liblzma STATIC) 14 - endif() 15 - 16 - +set(USE_SYSTEM_SQUASHFUSE OFF CACHE BOOL "Use system squashfuse instead of building our own") 17 - 18 - +if(NOT USE_SYSTEM_SQUASHFUSE) 19 - # as distros don't provide suitable squashfuse and squashfs-tools, those dependencies are bundled in, can, and should 20 - # be used from this repository 21 - # TODO: implement out-of-source builds for squashfuse, as for the other dependencies 22 - configure_file( 23 - ${CMAKE_CURRENT_SOURCE_DIR}/src/patch-squashfuse.sh.in 24 - ${CMAKE_CURRENT_BINARY_DIR}/patch-squashfuse.sh 25 - @ONLY 26 - ) 27 - 28 - ExternalProject_Add(squashfuse-EXTERNAL 29 - @@ -259,20 +261,34 @@ ExternalProject_Add(squashfuse-EXTERNAL 30 - BUILD_IN_SOURCE ON 31 - INSTALL_COMMAND ${MAKE} install 32 - ) 33 - 34 - import_external_project( 35 - TARGET_NAME squashfuse 36 - EXT_PROJECT_NAME squashfuse-EXTERNAL 37 - LIBRARIES "<SOURCE_DIR>/.libs/libsquashfuse.a;<SOURCE_DIR>/.libs/libsquashfuse_ll.a;<SOURCE_DIR>/.libs/libfuseprivate.a" 38 - INCLUDE_DIRS "<SOURCE_DIR>" 39 - ) 40 - +else() 10 + - message(STATUS "Using system squashfuse") 41 11 + message(STATUS "Using system squashfsfuse from ${SQUASHFUSE}") 42 - + 43 - + add_library(squashfuse INTERFACE IMPORTED GLOBAL) 12 + 13 + - import_pkgconfig_target(TARGET_NAME libsquashfuse PKGCONFIG_TARGET squashfuse) 14 + + add_library(libsquashfuse INTERFACE IMPORTED GLOBAL) 44 15 + 45 16 + set(squashfuse_INCLUDE_DIRS "${SQUASHFUSE}/include") 46 17 + set(squashfuse_LIBRARIES "${SQUASHFUSE}/lib/libsquashfuse.a;${SQUASHFUSE}/lib/libsquashfuse_ll.a;${SQUASHFUSE}/lib/libfuseprivate.a") 47 18 + 48 19 + set_property( 49 - + TARGET squashfuse 20 + + TARGET libsquashfuse 50 21 + PROPERTY INTERFACE_LINK_LIBRARIES ${squashfuse_LIBRARIES} 51 22 + ) 52 23 + include_directories(${squashfuse_INCLUDE_DIRS}) 53 - +endif() 54 - 55 - 56 - set(USE_SYSTEM_INOTIFY_TOOLS OFF CACHE BOOL "Use system libinotifytools instead of building our own") 57 - 58 - if(NOT USE_SYSTEM_INOTIFY_TOOLS) 59 - message(STATUS "Downloading and building inotify-tools") 60 - 61 - # TODO: build out of source 62 - ExternalProject_Add(inotify-tools-EXTERNAL 63 - URL https://github.com/downloads/rvoicilas/inotify-tools/inotify-tools-3.14.tar.gz 64 - @@ -345,20 +361,23 @@ if(NOT USE_SYSTEM_GTEST) 65 - INCLUDE_DIRS "<INSTALL_DIR>/include/" 66 - ) 67 - else() 68 - message(STATUS "Using system GTest") 69 - 70 - import_find_pkg_target(gtest GTest GTEST) 71 - endif() 72 24 endif() 73 - 74 - 75 - +set(USE_SYSTEM_MKSQUASHFS OFF CACHE BOOL "Use system mksquashfs instead of downloading and building our own") 76 - + 77 - +if(NOT USE_SYSTEM_MKSQUASHFS) 78 - # TODO: allow using system wide mksquashfs 79 - set(mksquashfs_cflags "-DXZ_SUPPORT ${CFLAGS}") 80 - 81 - if(xz_LIBRARIES MATCHES "\\.a$") 82 - set(mksquashfs_ldflags "${xz_LIBRARIES}") 83 - else() 84 - set(mksquashfs_ldflags "-l${xz_LIBRARIES}") 85 - endif() 86 - 87 - if(xz_INCLUDE_DIRS) 88 - @@ -385,20 +404,25 @@ ExternalProject_Add(mksquashfs 89 - INSTALL_COMMAND ${MAKE} -C squashfs-tools/ install INSTALL_DIR=<INSTALL_DIR> 90 - ) 91 - 92 - ExternalProject_Get_Property(mksquashfs INSTALL_DIR) 93 - set(mksquashfs_INSTALL_DIR "${INSTALL_DIR}") 94 - mark_as_advanced(mksquashfs_INSTALL_DIR) 95 - 96 - # for later use when packaging as an AppImage 97 - set(mksquashfs_BINARY "${mksquashfs_INSTALL_DIR}/mksquashfs") 98 - mark_as_advanced(mksquashfs_BINARY) 99 - +else() 100 - + message(STATUS "Using system mksquashfs") 101 - + 102 - + set(mksquashfs_BINARY "mksquashfs") 103 - +endif() 104 - 105 - 106 - #### build dependency configuration #### 107 - 108 - # only have to build custom xz when not using system libxz 109 - if(TARGET xz-EXTERNAL) 110 - if(TARGET squashfuse-EXTERNAL) 111 - ExternalProject_Add_StepDependencies(squashfuse-EXTERNAL configure xz-EXTERNAL) 112 - endif() 113 - if(TARGET mksquashfs) 114 - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt 115 - index 3f25442..974ed0e 100644 116 - --- a/src/CMakeLists.txt 117 - +++ b/src/CMakeLists.txt 118 - @@ -197,27 +197,27 @@ target_include_directories(digest_md5 119 - 120 - target_link_libraries(digest_md5 121 - PRIVATE 122 - libglib 123 - ) 124 - 125 - 126 - # install binaries 127 - if(AUXILIARY_FILES_DESTINATION) 128 - install( 129 - - PROGRAMS ${mksquashfs_INSTALL_DIR}/mksquashfs ${CMAKE_CURRENT_BINARY_DIR}/runtime 130 - + PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/runtime 131 - DESTINATION ${AUXILIARY_FILES_DESTINATION} 132 - COMPONENT applications 133 - ) 134 - else() 135 - install( 136 - - PROGRAMS ${mksquashfs_INSTALL_DIR}/mksquashfs ${CMAKE_CURRENT_BINARY_DIR}/runtime 137 - + PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/runtime 138 - DESTINATION bin 139 - COMPONENT applications 140 - ) 141 - endif() 142 - 143 - install( 144 - TARGETS AppRun appimagetool digest validate 145 - RUNTIME DESTINATION bin COMPONENT applications 146 - LIBRARY DESTINATION lib COMPONENT applications 147 - ARCHIVE DESTINATION lib/static COMPONENT applications 148 - diff --git a/src/shared.c b/src/shared.c 149 - index cf5fd5c..4f48dbc 100644 150 - --- a/src/shared.c 151 - +++ b/src/shared.c 152 - @@ -34,21 +34,21 @@ 25 + 26 + 27 + diff --git a/src/appimagetool.c b/src/appimagetool.c 28 + index 6b37419..23425e7 100644 29 + --- a/src/appimagetool.c 30 + +++ b/src/appimagetool.c 31 + @@ -38,7 +38,7 @@ 32 + #include <argp.h> 33 + 34 + #include <fcntl.h> 35 + -#include "squashfuse.h" 36 + +#include <squashfuse.h> 37 + 38 + #include <sys/types.h> 153 39 #include <sys/stat.h> 40 + @@ -96,7 +96,7 @@ static void die(const char *msg) { 41 + } 42 + 43 + /* Function that prints the contents of a squashfs file 44 + -* using libsquashfuse (#include "squashfuse.h") */ 45 + +* using libsquashfuse (#include <squashfuse.h>) */ 46 + int sfs_ls(char* image) { 47 + sqfs_err err = SQFS_OK; 48 + sqfs_traverse trv; 49 + diff --git a/src/appimagetoolnoglib.c b/src/appimagetoolnoglib.c 50 + index f900e76..ffa87f8 100644 51 + --- a/src/appimagetoolnoglib.c 52 + +++ b/src/appimagetoolnoglib.c 53 + @@ -3,7 +3,7 @@ 54 + 55 + #include <stdlib.h> 56 + #include <fcntl.h> 57 + -#include "squashfuse.h" 58 + +#include <squashfuse.h> 59 + 154 60 #include <sys/types.h> 155 - #include <dirent.h> 156 - #include <errno.h> 157 - 158 - #include <glib.h> 159 - #include <glib/gprintf.h> 160 - #include <glib/gstdio.h> 161 - #include <gio/gio.h> 162 - 61 + #include <sys/stat.h> 62 + @@ -118,7 +118,7 @@ int is_regular_file(const char *path) 63 + } 64 + 65 + /* Function that prints the contents of a squashfs file 66 + - * using libsquashfuse (#include "squashfuse.h") */ 67 + + * using libsquashfuse (#include <squashfuse.h>) */ 68 + int sfs_ls(char* image) { 69 + sqfs_err err = SQFS_OK; 70 + sqfs_traverse trv; 71 + diff --git a/src/runtime.c b/src/runtime.c 72 + index bada3af..70a642b 100644 73 + --- a/src/runtime.c 74 + +++ b/src/runtime.c 75 + @@ -29,7 +29,7 @@ 76 + 77 + #define _GNU_SOURCE 78 + 163 79 -#include "squashfuse.h" 164 80 +#include <squashfuse.h> 165 81 #include <squashfs_fs.h> 166 - #include "getsection.h" 167 - #include "elf.h" 168 - 169 - #include "xdg-basedir.h" 170 - 171 - // own header 172 - #include "shared.h" 173 - 174 - #if HAVE_LIBARCHIVE3 == 1 // CentOS 82 + #include <nonstd.h>