dev-util/android-studio: keep jre symlink but use JAVA_HOME first
authorJason Zaman <perfinion@gentoo.org>
Fri, 20 Jul 2018 06:33:04 +0000 (14:33 +0800)
committerJason Zaman <perfinion@gentoo.org>
Fri, 20 Jul 2018 06:40:26 +0000 (14:40 +0800)
Closes: https://bugs.gentoo.org/660404
Package-Manager: Portage-2.3.40, Repoman-2.3.9

dev-util/android-studio/android-studio-3.1.3.0.173.4819257-r1.ebuild [moved from dev-util/android-studio/android-studio-3.1.3.0.173.4819257.ebuild with 93% similarity]
dev-util/android-studio/files/0001-use-java-home-before-bundled.patch [new file with mode: 0644]

similarity index 93%
rename from dev-util/android-studio/android-studio-3.1.3.0.173.4819257.ebuild
rename to dev-util/android-studio/android-studio-3.1.3.0.173.4819257-r1.ebuild
index 1ac8561ea03c20b3da1ee6540b05d3006e862cdf..2659a27fd7b7160b4b20c81813afd2818797675f 100644 (file)
@@ -62,11 +62,14 @@ RDEPEND=">=virtual/jdk-1.7
        >=x11-libs/libxcb-1.9.1
        >=x11-libs/libxshmfence-1.1"
 S=${WORKDIR}/${PN}
+PATCHES=( "${FILESDIR}/0001-use-java-home-before-bundled.patch" )
 
 src_prepare() {
+       eapply "${PATCHES[@]}"
        eapply_user
+
        # This is really a bundled jdk not a jre
-       rm -R "${S}/jre" || die "Could not remove bundled jdk"
+       rm -rf "${S}/jre" || die "Could not remove bundled jdk"
 
        # Replace bundled jars with system
        # has problems with newer jdom:0 not updated to jdom:2
@@ -98,6 +101,7 @@ src_install() {
        doins -r *
 
        rm -rf "${D}${dir}/jre" || die
+       dosym "../../etc/java-config-2/current-system-vm" "${dir}/jre"
 
        fperms 755 "${dir}/bin/studio.sh" "${dir}"/bin/fsnotifier{,64}
        chmod 755 "${D}${dir}"/gradle/gradle-*/bin/gradle || die
diff --git a/dev-util/android-studio/files/0001-use-java-home-before-bundled.patch b/dev-util/android-studio/files/0001-use-java-home-before-bundled.patch
new file mode 100644 (file)
index 0000000..6f97c7d
--- /dev/null
@@ -0,0 +1,39 @@
+Use JAVA_HOME before bundled jre
+
+Must keep bundled jre symlink around in case "Use Embedded JDK" is selected
+
+https://bugs.gentoo.org/613868
+https://bugs.gentoo.org/660404
+
+--- android-studio/bin/studio.sh       2018-07-20 13:43:12.339049033 +0800
++++ android-studio/bin/studio.sh       2018-07-20 13:43:38.494932028 +0800
+@@ -73,6 +73,14 @@
+   fi
+ fi
++if [ -z "$JDK" -a -n "$JDK_HOME" -a -x "$JDK_HOME/bin/java" ]; then
++  JDK="$JDK_HOME"
++fi
++
++if [ -z "$JDK" -a  -n "$JAVA_HOME" -a -x "$JAVA_HOME/bin/java" ]; then
++  JDK="$JAVA_HOME"
++fi
++
+ if [ -z "$JDK" -a "$OS_TYPE" = "Linux" ] ; then
+   BUNDLED_JRE="$IDE_HOME/jre64"
+   if [ ! -d "$BUNDLED_JRE" ]; then
+@@ -83,14 +91,6 @@
+   fi
+ fi
+-if [ -z "$JDK" -a -n "$JDK_HOME" -a -x "$JDK_HOME/bin/java" ]; then
+-  JDK="$JDK_HOME"
+-fi
+-
+-if [ -z "$JDK" -a  -n "$JAVA_HOME" -a -x "$JAVA_HOME/bin/java" ]; then
+-  JDK="$JAVA_HOME"
+-fi
+-
+ if [ -z "$JDK" ]; then
+   JDK_PATH=`which java`