File discord.spec of Package discord

# spec file for package discord
# Copyright (c) 2017 SUSE LINUX 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

# Require bash for extglob in install section.
%global _buildshell /bin/bash
%global __requires_exclude ^(libffmpeg|libnode).*
%global __provides_exclude ^(libffmpeg|libnode).*
Name:           discord
Version:        0.0.10
Release:        1
Summary:        Voice and Text Chat for Gamers
License:        SUSE-NonFree
Group:          Amusements/Games/Other
Source0:        %{name}-%{version}.tar.gz
Source99:       PERMISSION
ExclusiveArch:  x86_64
BuildRequires:  desktop-file-utils
BuildRequires:  hicolor-icon-theme
BuildRequires:  update-desktop-files
BuildRequires:  unzip
Requires:       libgtk-2_0-0 libnotify4 libasound2 mozilla-nss dbus-1-glib libXtst6 libX11-6 libstdc++6 libc++1 libatomic1
# jap/kr/emote font support
Recommends:		noto-sans-kr-fonts noto-sans-jp-fonts noto-sans-cjk-fonts

Discord is a voice and text chat for gamers. The Text chat supports
inline images and videos. Voice chat includes a jitter buffer,
automatic gain control, noise suppression, echo cancellation.
Server-to-client communications are encrypted.

%setup -n Discord


cd %{_builddir}/Discord
install -Dm644 discord.png %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/%{name}.png
desktop-file-install \
  --dir=%{buildroot}%{_datadir}/applications \
  --set-key=Exec \
  --set-value=%{_bindir}/%{name} \

install -Dm755 chrome-sandbox %{buildroot}%{_libdir}/%{name}/chrome-sandbox
install -Dm755 %{buildroot}%{_libdir}/%{name}/
install -Dm755 %{buildroot}%{_libdir}/%{name}/
install -Dm755 %{buildroot}%{_libdir}/%{name}/

# install share
mkdir -p %{buildroot}%{_libdir}/%{name}
shopt -s extglob
cp -r !(discord*|*.so) %{buildroot}%{_libdir}/%{name}
shopt -u extglob

# fix missing icon in some envoronments
ln -sf %{_datadir}/icons/hicolor/256x256/apps/%{name}.png /%{buildroot}%{_libdir}/%{name}

# Executable checks for resources in its directory so it cannot be in bin.
mkdir -p %{buildroot}%{_bindir}
ln -s %{_libdir}/%{name}/Discord %{buildroot}%{_bindir}/%{name}

%if 0%{?suse_version} < 1500
chmod 0755 %{_libdir}/%{name}/Discord

%if 0%{?suse_version} < 1500