1 # Copyright 1999-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit desktop wrapper
8 RESTRICT
="bindist mirror strip"
14 opt/${PN}/jbr/lib/jli/*
15 opt/${PN}/jbr/lib/server/*
16 opt/${PN}/lib/pty4j/linux/*/*
17 opt/${PN}/lib/native/*/*
19 opt/${PN}/plugins/android/resources/installer/*/*
20 opt/${PN}/plugins/android/resources/native/*
21 opt/${PN}/plugins/android/resources/perfetto/*/*
22 opt/${PN}/plugins/android/resources/screen-sharing-agent/*/*
23 opt/${PN}/plugins/android/resources/simpleperf/*/*
24 opt/${PN}/plugins/android/resources/trace_processor_daemon/*
25 opt/${PN}/plugins/android/resources/transport/*/*
26 opt/${PN}/plugins/android/resources/transport/native/agent/*/*
27 opt/${PN}/plugins/android-ndk/resources/lldb/android/*/*
28 opt/${PN}/plugins/android-ndk/resources/lldb/bin/*
29 opt/${PN}/plugins/android-ndk/resources/lldb/lib/python*/lib-dynload/*
30 opt/${PN}/plugins/android-ndk/resources/lldb/lib/*
31 opt/${PN}/plugins/android-ndk/resources/lldb/lib64/*
32 opt/${PN}/plugins/design-tools/resources/layoutlib/data/linux/lib64/*
33 opt/${PN}/plugins/c-clangd-plugin/bin/clang/linux/*/*
34 opt/${PN}/plugins/webp/lib/libwebp/linux/*
37 DESCRIPTION
="Android development environment based on IntelliJ IDEA"
38 HOMEPAGE
="https://developer.android.com/studio"
39 SRC_URI
="https://redirector.gvt1.com/edgedl/android/studio/ide-zips/${PV}/${P}-linux.tar.gz"
41 LICENSE
="Apache-2.0 android BSD BSD-2 CDDL-1.1 CPL-0.5
42 EPL-1.0 GPL-2 GPL-2+ JDOM IJG LGPL-2.1 MIT
43 MPL-1.1 MPL-2.0 NPL-1.1 OFL ZLIB"
49 selinux? ( sec-policy/selinux-android )
50 >=app-arch/bzip2-1.0.8-r4
51 >=dev-libs/expat-2.5.0
52 >=dev-libs/libffi-3.4.4
53 >=media-libs/fontconfig-2.14.0-r1
54 >=media-libs/freetype-2.12.1-r1
55 >=media-libs/libpng-1.6.39
56 >=media-libs/mesa-22.2.5[X(+)]
57 || ( gnome-extra/zenity kde-apps/kdialog x11-apps/xmessage x11-libs/libnotify )
58 sys-libs/ncurses-compat:5[tinfo]
59 >=sys-libs/zlib-1.2.13-r1
60 >=x11-libs/libX11-1.8.1
61 >=x11-libs/libXau-1.0.11
62 >=x11-libs/libXdamage-1.1.6
63 >=x11-libs/libXdmcp-1.1.4-r2
64 >=x11-libs/libXext-1.3.5
65 >=x11-libs/libXfixes-6.0.0
66 >=x11-libs/libXrender-0.9.11
67 >=x11-libs/libXxf86vm-1.1.5
68 >=x11-libs/libdrm-2.4.114
69 >=x11-libs/libxcb-1.15-r1
70 >=x11-libs/libxshmfence-1.3.2
81 local dir
="/opt/${PN}"
85 fperms
-R 755 "${dir}"/plugins
/android-ndk
/resources
/lldb
/bin
86 fperms
755 "${dir}"/plugins
/android-ndk
/resources
/lldb
/android
/{arm64-v8a
,armeabi
,x86
,x86_64
}/lldb-server
87 fperms
755 "${dir}"/plugins
/c-clangd-plugin
/bin
/clang
/linux
/x64
/clangd
88 fperms
-R 755 "${dir}"/plugins
/android
/resources
/trace_processor_daemon
89 fperms
-R 755 "${dir}"/plugins
/android
/resources
/perfetto
90 fperms
-R 755 "${dir}"/plugins
/android
/resources
/simpleperf
91 fperms
-R 755 "${dir}"/jbr
/bin
92 fperms
755 "${dir}"/jbr
/lib
/{jexec
,jspawnhelper
}
93 fperms
-R 755 "${dir}"/bin
95 newicon
"bin/studio.png" "${PN}.png"
96 make_wrapper
"${PN}" "${dir}/bin/studio.sh"
97 make_desktop_entry
"${PN}" "Android Studio" "${PN}" "Development;IDE" "StartupWMClass=jetbrains-studio"
99 # https://developer.android.com/studio/command-line/variables
100 newenvd
- 99android-studio
<<-EOF
101 # Configuration file android-studio
102 STUDIO_JDK="${dir}/jbr"
105 # recommended by: https://confluence.jetbrains.com/display/IDEADEV/Inotify+Watches+Limit
106 mkdir
-p "${D}/etc/sysctl.d/" || die
107 echo "fs.inotify.max_user_watches = 524288" > "${D}/etc/sysctl.d/30-android-studio-inotify-watches.conf" || die
111 elog
"Android Studio data files were not removed."
112 elog
"If there will be no other programs using them anymore"
113 elog
"(especially another flavor of Android Studio)"
114 elog
"remove manually following folders:"
117 elog
" ~/.config/Google/AndroidStudio*/"
118 elog
" ~/.local/share/Google/AndroidStudio*/"
121 elog
"Also, if there are no other programs using Gradle, remove:"