2018-08-05 21:49:52 +02:00
|
|
|
{ stdenv, fetchFromGitHub
|
2019-03-23 15:59:10 +01:00
|
|
|
, pkgconfig, cmake, autoconf, automake, libtool, makeWrapper
|
|
|
|
, wget, xxd, desktop-file-utils, file
|
|
|
|
, gnupg, glib, zlib, cairo, openssl, fuse, xz, squashfuse, inotify-tools, libarchive
|
2018-08-05 21:49:52 +02:00
|
|
|
, squashfsTools
|
|
|
|
, gtest
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
appimagekit_src = fetchFromGitHub {
|
|
|
|
owner = "AppImage";
|
|
|
|
repo = "AppImageKit";
|
|
|
|
rev = "b0859501df61cde198b54a317c03b41dbafc98b1";
|
|
|
|
sha256 = "0qqg79jw9w9rs8c2w3lla4kz62ihafrf7jm370pp1dl8y2i81jzg";
|
|
|
|
};
|
|
|
|
|
|
|
|
# squashfuse adapted to nix from cmake experession in "${appimagekit_src}/cmake/dependencies.cmake"
|
|
|
|
appimagekit_squashfuse = squashfuse.overrideAttrs (attrs: rec {
|
|
|
|
name = "squashfuse-${version}";
|
|
|
|
version = "20161009";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "vasi";
|
|
|
|
repo = "squashfuse";
|
|
|
|
rev = "1f980303b89c779eabfd0a0fdd36d6a7a311bf92";
|
|
|
|
sha256 = "0lrw9ff8k15l34wjwyllw3i35hl0cms97jj2hpnr2q8ipgxpb5q5";
|
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
"${appimagekit_src}/squashfuse.patch"
|
|
|
|
"${appimagekit_src}/squashfuse_dlopen.patch"
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
cp -v ${appimagekit_src}/squashfuse_dlopen.[hc] .
|
|
|
|
'';
|
|
|
|
|
|
|
|
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 {
|
|
|
|
name = "appimagekit-20180727";
|
|
|
|
|
|
|
|
src = appimagekit_src;
|
|
|
|
|
|
|
|
patches = [ ./nix.patch ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
pkgconfig cmake autoconf automake libtool wget xxd
|
|
|
|
desktop-file-utils
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
glib zlib cairo openssl fuse
|
|
|
|
xz inotify-tools libarchive
|
2019-03-23 15:59:10 +01:00
|
|
|
squashfsTools makeWrapper
|
2018-08-05 21:49:52 +02:00
|
|
|
];
|
|
|
|
|
2019-03-23 15:59:10 +01:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace src/appimagetool.c --replace "/usr/bin/file" "${file}/bin/file"
|
|
|
|
'';
|
|
|
|
|
2018-08-05 21:49:52 +02:00
|
|
|
preConfigure = ''
|
|
|
|
export HOME=$(pwd)
|
|
|
|
'';
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DUSE_SYSTEM_XZ=ON"
|
|
|
|
"-DUSE_SYSTEM_SQUASHFUSE=ON"
|
|
|
|
"-DSQUASHFUSE=${appimagekit_squashfuse}"
|
|
|
|
"-DUSE_SYSTEM_INOTIFY_TOOLS=ON"
|
|
|
|
"-DUSE_SYSTEM_LIBARCHIVE=ON"
|
|
|
|
"-DUSE_SYSTEM_GTEST=ON"
|
|
|
|
"-DUSE_SYSTEM_MKSQUASHFS=ON"
|
|
|
|
];
|
|
|
|
|
2019-03-23 15:59:10 +01:00
|
|
|
postInstall = ''
|
|
|
|
cp "${squashfsTools}/bin/mksquashfs" "$out/lib/appimagekit/"
|
|
|
|
cp "${desktop-file-utils}/bin/desktop-file-validate" "$out/bin"
|
|
|
|
|
|
|
|
wrapProgram "$out/bin/appimagetool" \
|
|
|
|
--prefix PATH : "${stdenv.lib.makeBinPath [ file gnupg ]}"
|
|
|
|
'';
|
|
|
|
|
2018-08-05 21:49:52 +02:00
|
|
|
checkInputs = [ gtest ];
|
|
|
|
doCheck = false; # fails 1 out of 4 tests, I'm too lazy to debug why
|
|
|
|
|
|
|
|
# for debugging
|
|
|
|
passthru = {
|
|
|
|
squashfuse = appimagekit_squashfuse;
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
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;
|
|
|
|
homepage = src.meta.homepage;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|