2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub
|
2021-01-17 09:17:16 +00:00
|
|
|
, pkg-config, cmake, autoconf, automake, libtool, makeWrapper
|
2019-03-23 14:59:10 +00:00
|
|
|
, wget, xxd, desktop-file-utils, file
|
|
|
|
, gnupg, glib, zlib, cairo, openssl, fuse, xz, squashfuse, inotify-tools, libarchive
|
2018-08-05 19:49:52 +00:00
|
|
|
, squashfsTools
|
|
|
|
, gtest
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
appimagekit_src = fetchFromGitHub {
|
|
|
|
owner = "AppImage";
|
|
|
|
repo = "AppImageKit";
|
2021-04-06 10:46:54 +00:00
|
|
|
rev = "8bbf694455d00f48d835f56afaa1dabcd9178ba6";
|
|
|
|
sha256 = "sha256-pqg+joomC5CI9WdKP/h/XKPsruMgZEaIOjPLOqnNPZw=";
|
|
|
|
fetchSubmodules = true;
|
2018-08-05 19:49:52 +00:00
|
|
|
};
|
|
|
|
|
2021-04-06 10:46:54 +00:00
|
|
|
# squashfuse adapted to nix from cmake experession in "${appimagekit_src}/lib/libappimage/cmake/dependencies.cmake"
|
2018-08-05 19:49:52 +00:00
|
|
|
appimagekit_squashfuse = squashfuse.overrideAttrs (attrs: rec {
|
2021-04-06 10:46:54 +00:00
|
|
|
pname = "squashfuse";
|
|
|
|
version = "unstable-2016-10-09";
|
2018-08-05 19:49:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "vasi";
|
2021-04-06 10:46:54 +00:00
|
|
|
repo = pname;
|
|
|
|
rev = "1f980303b89c779eabfd0a0fdd36d6a7a311bf92";
|
|
|
|
sha256 = "sha256-BZd1+7sRYZHthULKk3RlgMIy4uCUei45GbSEiZxLPFM=";
|
2018-08-05 19:49:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
2021-04-06 10:46:54 +00:00
|
|
|
"${appimagekit_src}/lib/libappimage/src/patches/squashfuse.patch"
|
|
|
|
"${appimagekit_src}/lib/libappimage/src/patches/squashfuse_dlopen.patch"
|
2018-08-05 19:49:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
2021-04-06 10:46:54 +00:00
|
|
|
cp -v ${appimagekit_src}/lib/libappimage/src/patches/squashfuse_dlopen.[hc] .
|
2018-08-05 19:49:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-06-03 13:14:11 +00:00
|
|
|
# Workaround build failure on -fno-common toolchains:
|
|
|
|
# ld: libsquashfuse_ll.a(libfuseprivate_la-fuseprivate.o):(.bss+0x8):
|
|
|
|
# multiple definition of `have_libloaded'; runtime.4.o:(.bss.have_libloaded+0x0): first defined here
|
|
|
|
NIX_CFLAGS_COMPILE = "-fcommon";
|
|
|
|
|
2018-08-05 19:49:52 +00:00
|
|
|
preConfigure = ''
|
|
|
|
sed -i "/PKG_CHECK_MODULES.*/,/,:./d" configure
|
|
|
|
sed -i "s/typedef off_t sqfs_off_t/typedef int64_t sqfs_off_t/g" common.h
|
|
|
|
'';
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--disable-demo" "--disable-high-level" "--without-lzo" "--without-lz4"
|
|
|
|
];
|
|
|
|
|
|
|
|
postConfigure = ''
|
|
|
|
sed -i "s|XZ_LIBS = -llzma |XZ_LIBS = -Bstatic -llzma/|g" Makefile
|
|
|
|
'';
|
|
|
|
|
|
|
|
# only static libs and header files
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/lib $out/include
|
|
|
|
cp -v ./.libs/*.a $out/lib
|
|
|
|
cp -v ./*.h $out/include
|
|
|
|
'';
|
|
|
|
});
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
2021-04-06 10:46:54 +00:00
|
|
|
pname = "appimagekit";
|
|
|
|
version = "unstable-2020-12-31";
|
2018-08-05 19:49:52 +00:00
|
|
|
|
|
|
|
src = appimagekit_src;
|
|
|
|
|
|
|
|
patches = [ ./nix.patch ];
|
|
|
|
|
2021-04-06 10:46:54 +00:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs src/embed-magic-bytes-in-file.sh
|
|
|
|
'';
|
|
|
|
|
2018-08-05 19:49:52 +00:00
|
|
|
nativeBuildInputs = [
|
2021-01-17 09:17:16 +00:00
|
|
|
pkg-config cmake autoconf automake libtool wget xxd
|
2021-04-06 10:46:54 +00:00
|
|
|
desktop-file-utils makeWrapper
|
2018-08-05 19:49:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2021-04-06 10:46:54 +00:00
|
|
|
glib zlib cairo openssl fuse xz inotify-tools
|
|
|
|
libarchive squashfsTools appimagekit_squashfuse
|
2018-08-05 19:49:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
export HOME=$(pwd)
|
|
|
|
'';
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DUSE_SYSTEM_XZ=ON"
|
|
|
|
"-DUSE_SYSTEM_SQUASHFUSE=ON"
|
|
|
|
"-DSQUASHFUSE=${appimagekit_squashfuse}"
|
|
|
|
"-DUSE_SYSTEM_LIBARCHIVE=ON"
|
|
|
|
"-DUSE_SYSTEM_GTEST=ON"
|
|
|
|
"-DUSE_SYSTEM_MKSQUASHFS=ON"
|
2022-01-06 10:55:53 +00:00
|
|
|
"-DTOOLS_PREFIX=${stdenv.cc.targetPrefix}"
|
2018-08-05 19:49:52 +00:00
|
|
|
];
|
|
|
|
|
2019-03-23 14:59:10 +00:00
|
|
|
postInstall = ''
|
2021-04-06 10:46:54 +00:00
|
|
|
mkdir -p $out/lib/appimagekit
|
2019-03-23 14:59:10 +00:00
|
|
|
cp "${squashfsTools}/bin/mksquashfs" "$out/lib/appimagekit/"
|
|
|
|
cp "${desktop-file-utils}/bin/desktop-file-validate" "$out/bin"
|
|
|
|
|
|
|
|
wrapProgram "$out/bin/appimagetool" \
|
2021-04-06 10:46:54 +00:00
|
|
|
--prefix PATH : "${lib.makeBinPath [ file gnupg ]}" \
|
|
|
|
--unset SOURCE_DATE_EPOCH
|
2019-03-23 14:59:10 +00:00
|
|
|
'';
|
|
|
|
|
2018-08-05 19:49:52 +00:00
|
|
|
checkInputs = [ gtest ];
|
|
|
|
|
|
|
|
# for debugging
|
|
|
|
passthru = {
|
|
|
|
squashfuse = appimagekit_squashfuse;
|
|
|
|
};
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2018-08-05 19:49:52 +00:00
|
|
|
description = "A tool to package desktop applications as AppImages";
|
|
|
|
longDescription = ''
|
|
|
|
AppImageKit is an implementation of the AppImage format that
|
|
|
|
provides tools such as appimagetool and appimaged for handling
|
|
|
|
AppImages.
|
|
|
|
'';
|
|
|
|
license = licenses.mit;
|
2021-04-06 10:46:54 +00:00
|
|
|
maintainers = with maintainers; [ taeer ];
|
2018-08-05 19:49:52 +00:00
|
|
|
homepage = src.meta.homepage;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|