File macros.mingw64-installer of Package mingw64-installer-base
# Windows installer support for mingw64
#
# @author Ralf Habacker <ralf.habacker@freenet.de>
#
# Example:
# ...
#
# %_mingw64_installer_package -n mingw64-dbus-1 -p DBus-1 -P "DBus-1, a message bus system"
#
# %prep
# %_mingw64_installer_prep
#
# %build
# %_mingw64_installer_build -p dbus-1 -P DBus-1 -l $license_file -r mingw64-dbus-1 -s %{SOURCE0}
#
# %install
# %_mingw64_installer_install
#
# Template for portable and installer packages.
#
# -n <name> rpm package name prefix e.g mingw64-kmymoney
# -p <name> package name in summary
# -P <name> Package name in description
#
%_mingw64_installer_package(n:p:P:) \
BuildRequires: cmake >= 2.8.12 \
BuildRequires: mingw64-cross-nsis \
BuildRequires: mingw64-filesystem \
BuildRequires: p7zip \
\
%package %{-n:-n %{-n*}-}portable \
Summary: %{-p*} portable image \
License: %{license} \
Group: %{group} \
BuildArch: noarch \
\
%description %{-n:-n %{-n*}-}portable \
This package contains a 7z compressed portable installation \
image of %{-P}. \
\
%package %{-n:-n %{-n*}-}setup \
Summary: %{-p*} setup installer \
License: %{license} \
Group: %{group} \
BuildArch: noarch \
\
%description %{-n:-n %{-n*}-}setup \
This package contains a setup installer of %{-P}. \
\
%package %{-n:-n %{-n*}-}debugpackage \
Summary: %{-p*} debug package \
License: %{license} \
Group: %{group} \
BuildArch: noarch \
\
%description %{-n:-n %{-n*}-}debugpackage \
This package contains debug informations for the portable package and the installer of %{-P*}. \
\
%package %{-n:-n %{-n*}-}src \
Summary: %{-p*} source package \
License: %{license} \
Group: %{group} \
BuildArch: noarch \
\
%description %{-n:-n %{-n*}-}src \
This package contains the source files of %{-P*} \
\
%files %{-n:-n %{-n*}-}setup\
%defattr(-,root,root) \
/*.exe \
\
%files %{-n:-n %{-n*}-}portable \
%defattr(-,root,root) \
/*-bin.7z \
\
%files %{-n:-n %{-n*}-}debugpackage \
%defattr(-,root,root) \
/*-debug.7z \
\
%files %{-n:-n %{-n*}-}src \
%defattr(-,root,root) \
/*-src.7z
#
# %prep template for creating installer and portable packages
#
%_mingw64_installer_prep %setup -q -c -T
#
# %build template for creating installer and portable packages
#
# This template creates setup installer, portable package,
# 7z compressed source and debug symbol package
#
# -e <executable> Application for which a start menu entry is to be added (e.g kmymoney)
# -g <generator> Specify supported output formats (optional, default is NSIS;7Z)
# -h <url> help link for installer (optional, uses global spec variable Url: if not specified)
# -l <file> license file to be included in the installer
# -p <name> short package name in installer e.g. kmymoney
# -P <name> full package name in installer e.g. KMyMoney
# -r <name> package name to get version from e.g. mingw64-kmymoney
# -s <source tar ball> source tar ball e.g. %{SOURCE0} (optional)
# -u <url> url info for installer (optional, uses global spec variable Url: if not specified)
#
# KDE auto shutdown support (optional, requires mingw64-kdebase4-runtime)
# -a <application> application name for auto shutdown support
# -t <timeout> timeout for auto shutdown support (default 5 seconds)
#
%_mingw64_installer_build(a:e:g:h:l:p:P:r:s:t:u:) \
pkgname=%{-r:%{-r*}}%{!-r:%{name}} \
tarball=%{-s:%{-s*}} \
name=%{-p:%{-p*}} \
display_name=%{-P:%{-P*}}%{!-P:%{-p*}} \
shutdown_app=%{-a:%{-a*}} \
executable=%{-e:%{-e*}} \
generator=%{-g:%{-g*}}%{!-g:"NSIS;7Z"} \
timeout=%{-t:%{-t*}}%{!-t:5} \
help_link=%{-h:%{-h*}}%{!-h:%{url}} \
url_info=%{-u:%{-u*}}%{!-u:%{url}} \
cp /etc/rpm/macros.mingw64-installer.CMakeLists.txt CMakeLists.txt \
if test -n "$shutdown_app"; then \
local_install_dir=$PWD/tmp/share \
mkdir -p $local_install_dir/autostart \
sed "s,@APPLICATION@,$shutdown_app,g;s,@TIMEOUT@,$timeout,g" /etc/rpm/macros.mingw64-installer.kwinshutdown.desktop.in > $local_install_dir/autostart/kwinshutdown.desktop \
local_install_opt="-DPACKAGE_LOCAL_INSTALL_DIR=$local_install_dir" \
fi \
suffix=mingw64 \
source_version=$(rpm -q $pkgname | sed "s,^$pkgname-,,g;s,.noarch,,g;s,\-.*,,g") \
binary_version=$(rpm -q $pkgname | sed "s,^$pkgname-,,g;s,.noarch,,g") \
license_file=%{-l:%{-l*}}%{!-l:/usr/share/doc/packages/$pkgname/COPYING} \
if test -f $license_file; then \
license_opt=-DPACKAGE_LICENSE_FILE=$license_file \
fi \
\
cmake -DPACKAGE_NAME=$name \\\
-DPACKAGE_DISPLAY_NAME="$display_name $source_version" \\\
-DPACKAGE_INSTALLED_ICON_NAME=bin/$executable\.exe \\\
-DPACKAGE_FINISH_RUN=$executable\.exe \\\
-DPACKAGE_VERSION=$source_version \\\
-DPACKAGE_INSTALL_DIR=%{_mingw64_prefix}/ \\\
-DPACKAGE_HELP_LINK=$help_link \\\
-DPACKAGE_URL_INFO=$url_info \\\
-DCPACK_GENERATOR="$generator" \\\
$license_opt \\\
$local_install_opt \\\
. \
echo "show symlinks in installation root, which may lead to left over files after uninstalling" \
find -type l -ls \
cpack --verbose --debug \
case "$generator" in \
*NSIS*) \
mv *.exe $name-$suffix-$binary_version-setup.exe \
;; \
esac \
case "$generator" in \
*7Z*) \
mv *.7z $name-$suffix-$binary_version-bin.7z \
;; \
esac \
\
mkdir dbgtmp \
cd dbgtmp \
cp -av %{_mingw64_prefix}/src %{_mingw64_prefix}/symbols . \
for i in $(cd %{_mingw64_prefix}; find -name '*.debug'); do \
d=$(dirname $i) \
install -d $d \
install %{_mingw64_prefix}/$i $d \
done \
7za a ../$name-$suffix-$binary_version-debug.7z . \
cd .. \
\
mkdir srctmp \
cd srctmp \
case $tarball in \
*.tar.xz) tar -xJf $tarball ;; \
*.tar.bz2) tar -xjf $tarball ;; \
*.tar.gz) tar -xzf $tarball ;; \
*) echo "unsupported tarball format";; \
esac \
if test -f $tarball; then \
7za a ../$name-$source_version-src.7z * \
fi
#
# %install template for creating installer and portable packages
#
%_mingw64_installer_install \
mkdir -p %{buildroot} \
executables=$(ls *.exe 2> /dev/null | wc -l) \
if test $executables -ne 0; then \
install -m 644 *.exe %{buildroot} \
fi \
install -m 644 *.7z %{buildroot}