File appimagetool.spec of Package AppImageKit

#
# spec file for package 
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

Name:           appimagetool
Version:        13
Release:        0
# preload.c is under GPL
License:        MIT, GPLv3
Summary:        To Build AppImage Containers
Url:            https://code.google.com/p/googletest
Group:          Definition/Libraries/C and C++
Source0:        AppImageKit-%version.tar.xz
Source2:        mkappimagedir.in
Source3:        preload.c
Patch2: fix-linking.patch
BuildRequires:  cmake
BuildRequires:  desktop-file-utils
BuildRequires:  gcc-c++
BuildRequires:  glibc-devel
BuildRequires:  xz-static-devel
BuildRequires:  glib2-devel fuse-devel zlib-devel libpng-devel
BuildRequires:  libtool
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  wget
# for xxd
BuildRequires:  vim
BuildRequires:  openssl-devel
BuildRequires:  libarchive-devel
BuildRequires:  squashfuse-devel
BuildRequires:  cairo-devel

BuildRequires:  fuse-devel
BuildRequires:  fuse-devel-static
BuildRequires:  squashfuse
BuildRequires:  squashfs-tools
BuildRequires:  libtool
BuildRequires:  libattr-devel
BuildRequires:  zlib-devel-static
BuildRequires:  xz-static-devel
BuildRequires:  lzo-devel-static

Requires: squashfs-tools
Requires: zsync

%description
Using AppImageKit, you can package desktop applications as AppImages
that run on common Linux-based operating systems.

The AppImage format is a format for packaging applications in a way
that allows them to run on a variety of different target systems 
(base operating systems, distributions) without further modification.

AppImageKit is a concrete implementation of the AppImage format and
provides tools for conveniently handling AppImages.

appimagetool uses a next-generation AppImage format based on squashfs
and embeds a runtime for it.

%prep
%setup -q -n AppImageKit-%version
%patch2 -p1
mkdir bin
# catch wget errors in build
ln -s /usr/bin/false bin/wget

%build
sed -e 's|SNAPPY|UNION|g' -e 's|SNAPP|UNION|g' -e 's|SNAP|UNION|g' -e 's|snappy|union|g' %{S:3} > libunionpreload.c
gcc -shared -fPIC libunionpreload.c -o libunionpreload.so -ldl -DUNION_LIBNAME=\"libunionpreload.so\"

mkdir mybuild
cd mybuild
cmake -DUSE_SYSTEM_XZ=ON \
      -DUSE_SYSTEM_LIBARCHIVE=ON \
      -DUSE_SYSTEM_SQUASHFUSE=ON \
      -DUSE_SYSTEM_MKSQUASHFS=ON \
      -DAUXILIARY_FILES_DESTINATION=lib/appimagetool \
      ..
make

%install
mkdir -p %{buildroot}%{_bindir}
install -m 0755 mybuild/src/appimagetool %{buildroot}%{_bindir}

# required for build-pkg2appimage:
mkdir -p %{buildroot}/usr/lib/appimagetool
install -m 0644 libunionpreload.so %{buildroot}/usr/lib/appimagetool
install -m 0755 %{SOURCE2} %{buildroot}%{_bindir}/mkappimagedir
install -m 0755 mybuild/src/{AppRun,runtime,digest,validate} %{buildroot}/usr/lib/appimagetool/

ln -sf /usr/bin/mksquashfs %buildroot/usr/lib/appimagetool/mksquashfs

%files
%license LICENSE
%doc README.md
%{_bindir}/appimagetool
/usr/lib/appimagetool
%{_bindir}/mkappimagedir

openSUSE Build Service is sponsored by