blob: d2200231d39580a1097bbbd49f0b2839e28ac060 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit gnome2-utils xdg-utils
DESCRIPTION="A programming environment for creating stories, animations, games, and music."
HOMEPAGE="http://scratch.mit.edu/"
SRC_URI="http://download.scratch.mit.edu/${P}.src.tar.gz"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="+alsa oss pulseaudio nas +v4l"
DEPEND="dev-lang/squeakvm[scratch]
alsa? ( dev-lang/squeakvm[alsa] )
oss? ( dev-lang/squeakvm[oss] )
pulseaudio? ( dev-lang/squeakvm[pulseaudio] )
nas? ( dev-lang/squeakvm[nas] )
v4l? ( dev-lang/squeakvm[v4l] )"
RDEPEND="${DEPEND}"
REQUIRED_USE="?? ( alsa oss pulseaudio nas )"
S="${WORKDIR}/${P}.src"
src_prepare() {
rm -rf src/plugins/*
rm -f Makefile
eapply_user
}
src_configure(){
if use alsa; then squeak_sound_plugin="ALSA"
elif use oss; then squeak_sound_plugin="OSS"
elif use pulseaudio; then squeak_sound_plugin="pulse"
elif use nas; then squeak_sound_plugin="nas"
else squeak_sound_plugin="null"
fi
}
src_install() {
local datadir="/usr/share/${PN}"
local icondir="/usr/share/icons/hicolor"
dodir "${datadir}"
cp -r Help locale Media Projects "${D}${datadir}"
doman src/man/*
dodoc ACKNOWLEDGEMENTS KNOWN-BUGS README NOTICE TRADEMARK_POLICY
insinto /usr/share/mime/packages
doins src/scratch.xml
dolib Scratch.image
dolib Scratch.ini
(
cd src/icons
for res in *; do
insinto "${icondir}/${res}/apps"
doins "${res}"/scratch*.png
insinto "${icondir}/${res}/mimetypes"
if [[ ${res} != "32x32" ]]; then
newins "${res}/gnome-mime-application-x-scratch-project.png" mime-application-x-scratch-project.png
fi
done
)
install_runner
make_desktop_entry scratch Scratch scratch "Education;Development" "MimeType=application/x-scratch-project"
}
install_runner() {
local tmpexe=$(emktemp)
cat << EOF > "${tmpexe}"
#!/bin/sh
cd
exec \
"/usr/bin/squeak" \\
-vm-sound-${squeak_sound_plugin} \\
"/usr/$(get_libdir)/Scratch.image" \\
"${@}"
EOF
chmod go+rx "${tmpexe}"
newbin "${tmpexe}" "${PN}" || die
}
pkg_preinst() {
gnome2_icon_savelist
}
pkg_postinst() {
xdg_mimeinfo_database_update
xdg_desktop_database_update
gnome2_icon_cache_update
}
pkg_postrm() {
xdg_mimeinfo_database_update
xdg_desktop_database_update
gnome2_icon_cache_update
}
|