File android-studio.spec of Package android-studio

#
# spec file for package android-studio
#
# Copyright (c) 2025 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
Name:           android-studio
Version:        2025.1.3.5
Release:        0
Summary:        The official Android IDE
Source:         https://redirector.gvt1.com/edgedl/android/studio/ide-zips/%{version}/%{name}-%{version}-linux.tar.gz
License:        Apache-2.0
BuildRequires:  bsdtar
BuildRequires:  zip
Requires:       which
Requires:       libgthread-2_0-0
ExclusiveArch:  x86_64
AutoReqProv:    no
#!BuildIgnore:  rpmlint rpmlint-Factory rpmlint-mini

%description
Android Studio is the official IDE for Android development, and includes everything you need to build Android apps.

%prep
%autosetup -n %{name}

echo '
[Desktop Entry]
Version=1.0
Type=Application
Name=Android Studio (Beta branch)
Exec=android-studio %f
Icon=android-studio
Comment=The Official Android IDE (Beta branch)
Categories=Development;IDE;
Terminal=false
StartupNotify=true
StartupWMClass=jetbrains-studio-beta
MimeType=application/x-extension-iml;
' > %{name}.desktop

# https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=android-studio-beta
# Change the product name to produce a unique WM_CLASS attribute
mkdir -p idea
bsdtar -Oxf lib/resources.jar idea/AndroidStudioApplicationInfo.xml \
| sed "s/\"Studio\"/\"Studio Beta\"/" > idea/AndroidStudioApplicationInfo.xml
zip -r lib/resources.jar idea
rm -r idea

%install
install -Dm644 %{name}.desktop %{buildroot}/%{_datadir}/applications/%{name}.desktop
install -Dm644 bin/studio.png %{buildroot}/%{_datadir}/pixmaps/%{name}.png
mkdir -p %{buildroot}/%{_datadir}/%{name}
cp -a bin/ lib/ jbr/ plugins/ product-info.json %{buildroot}/%{_datadir}/%{name}
mkdir -p %{buildroot}/%{_bindir}
ln -s %{_datadir}/%{name}/bin/studio %{buildroot}/%{_bindir}/%{name}
mkdir -p %{buildroot}/%{_defaultlicensedir}/%{name}
cp license/* %{buildroot}/%{_defaultlicensedir}/%{name}

%files
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/%{name}/
%{_defaultlicensedir}/%{name}

%changelog
openSUSE Build Service is sponsored by