Line 0
Link Here
|
|
|
1 |
# Copyright 1999-2023 Gentoo Authors |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
|
4 |
EAPI=8 |
5 |
|
6 |
inherit cmake java-pkg-2 optfeature xdg |
7 |
|
8 |
HOMEPAGE="https://prismlauncher.org/ https://github.com/PrismLauncher/PrismLauncher" |
9 |
DESCRIPTION="A custom, open source Minecraft launcher" |
10 |
|
11 |
if [[ ${PV} == 9999 ]]; then |
12 |
inherit git-r3 |
13 |
|
14 |
EGIT_REPO_URI=" |
15 |
https://github.com/PrismLauncher/PrismLauncher |
16 |
" |
17 |
|
18 |
# TODO: Add tomlplusplus as a system library, like quazip |
19 |
EGIT_SUBMODULES=( '*' '-libraries/quazip' '-libraries/filesystem' '-libraries/zlib' '-libraries/extra-cmake-modules' '-libraries/cmark' ) |
20 |
else |
21 |
MY_PN="PrismLauncher" |
22 |
|
23 |
# Let's use the vendored tarball to avoid dealing with the submodules directly |
24 |
SRC_URI=" |
25 |
https://github.com/PrismLauncher/PrismLauncher/releases/download/${PV}/${MY_PN}-${PV}.tar.gz -> ${P}.tar.gz |
26 |
" |
27 |
|
28 |
# The Prism's files are unpacked to ${WORKDIR}/PrismLauncher-${PV} |
29 |
S="${WORKDIR}/${MY_PN}-${PV}" |
30 |
|
31 |
KEYWORDS="~amd64 ~arm64" |
32 |
fi |
33 |
|
34 |
# GPL-3 for PolyMC (PrismLauncher is forked from it) and Prism itself |
35 |
# Apache-2.0 for MultiMC (PolyMC is forked from it) |
36 |
# LGPL-3+ for libnbtplusplus |
37 |
# MIT for tomlplusplus |
38 |
# See the rest of PrismLauncher's libraries at https://github.com/PrismLauncher/PrismLauncher/tree/develop/libraries |
39 |
LICENSE="Apache-2.0 BSD BSD-2 GPL-2+ GPL-3 ISC LGPL-2.1+ LGPL-3+ MIT" |
40 |
|
41 |
SLOT="0" |
42 |
|
43 |
IUSE="debug lto qt6 test" |
44 |
REQUIRED_USE=" |
45 |
lto? ( !debug ) |
46 |
" |
47 |
|
48 |
RESTRICT="!test? ( test )" |
49 |
|
50 |
MIN_QT_5_VERSION="5.12.0" |
51 |
MIN_QT_6_VERSION="6.0.0" |
52 |
|
53 |
QT_DEPS=" |
54 |
!qt6? ( |
55 |
>=dev-qt/qtconcurrent-${MIN_QT_5_VERSION}:5 |
56 |
>=dev-qt/qtcore-${MIN_QT_5_VERSION}:5 |
57 |
>=dev-qt/qtgui-${MIN_QT_5_VERSION}:5 |
58 |
>=dev-qt/qtnetwork-${MIN_QT_5_VERSION}:5 |
59 |
>=dev-qt/qttest-${MIN_QT_5_VERSION}:5 |
60 |
>=dev-qt/qtwidgets-${MIN_QT_5_VERSION}:5 |
61 |
>=dev-qt/qtxml-${MIN_QT_5_VERSION}:5 |
62 |
) |
63 |
|
64 |
qt6? ( |
65 |
>=dev-qt/qtbase-${MIN_QT_6_VERSION}:6[concurrent,gui,network,widgets,xml(+)] |
66 |
>=dev-qt/qt5compat-${MIN_QT_6_VERSION}:6 |
67 |
) |
68 |
" |
69 |
|
70 |
# Required at both build-time and run-time |
71 |
COMMON_DEPENDS=" |
72 |
${QT_DEPS} |
73 |
|
74 |
!qt6? ( >=dev-libs/quazip-1.3:=[qt5(+)] ) |
75 |
qt6? ( >=dev-libs/quazip-1.3:=[qt6(-)] ) |
76 |
|
77 |
app-text/cmark |
78 |
sys-libs/zlib |
79 |
" |
80 |
|
81 |
# The gulrak-filesystem dependency is only needed at build time, because we don't actually use it on Linux, |
82 |
# only on legacy macOS. Still, we need it present at build time to appease CMake, and having it like this |
83 |
# makes it easier to maintain than patching the CMakeLists file directly. |
84 |
BDEPEND=" |
85 |
app-text/scdoc |
86 |
dev-cpp/gulrak-filesystem |
87 |
kde-frameworks/extra-cmake-modules:5 |
88 |
" |
89 |
|
90 |
DEPEND=" |
91 |
${COMMON_DEPENDS} |
92 |
media-libs/libglvnd |
93 |
>=virtual/jdk-1.8.0:* |
94 |
" |
95 |
|
96 |
# At run-time we don't depend on JDK, only JRE |
97 |
# And we need more than just the GL headers |
98 |
RDEPEND=" |
99 |
${COMMON_DEPENDS} |
100 |
|
101 |
!qt6? ( >=dev-qt/qtsvg-${MIN_QT_5_VERSION}:5 ) |
102 |
qt6? ( >=dev-qt/qtsvg-${MIN_QT_6_VERSION}:6 ) |
103 |
|
104 |
>=virtual/jre-1.8.0:* |
105 |
virtual/opengl |
106 |
" |
107 |
|
108 |
src_prepare() { |
109 |
cmake_src_prepare |
110 |
|
111 |
# Prevent conflicting with the user's flags |
112 |
# See https://bugs.gentoo.org/848765 for more info |
113 |
sed -i -e 's/-Werror//' -e 's/-D_FORTIFY_SOURCE=2//' CMakeLists.txt || die 'Failed to remove -Werror and -D_FORTIFY_SOURCE via sed' |
114 |
} |
115 |
|
116 |
src_configure(){ |
117 |
local mycmakeargs=( |
118 |
-DCMAKE_INSTALL_PREFIX="/usr" |
119 |
# Resulting binary is named prismlauncher |
120 |
-DLauncher_APP_BINARY_NAME="${PN}" |
121 |
-DLauncher_BUILD_PLATFORM="Gentoo" |
122 |
-DLauncher_QT_VERSION_MAJOR=$(usex qt6 6 5) |
123 |
|
124 |
-DENABLE_LTO=$(usex lto) |
125 |
-DBUILD_TESTING=$(usex test) |
126 |
) |
127 |
|
128 |
if use debug; then |
129 |
CMAKE_BUILD_TYPE=Debug |
130 |
else |
131 |
CMAKE_BUILD_TYPE=Release |
132 |
fi |
133 |
|
134 |
cmake_src_configure |
135 |
} |
136 |
|
137 |
src_compile(){ |
138 |
cmake_src_compile |
139 |
} |
140 |
|
141 |
pkg_postinst() { |
142 |
xdg_pkg_postinst |
143 |
|
144 |
# Original issue: https://github.com/PolyMC/PolyMC/issues/227 |
145 |
optfeature "old Minecraft (<= 1.12.2) support" x11-apps/xrandr |
146 |
|
147 |
optfeature "built-in MangoHud support" games-util/mangohud |
148 |
optfeature "built-in Feral Gamemode support" games-util/gamemode |
149 |
} |