]> CyberLeo.Net >> Repos - CDN/portage-cdn.git/blob - www-plugins/adobe-flash/adobe-flash-11.0.1.98_beta201108082.ebuild
net-p2p/freenet: in portage
[CDN/portage-cdn.git] / www-plugins / adobe-flash / adobe-flash-11.0.1.98_beta201108082.ebuild
1 # Copyright 1999-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/www-plugins/adobe-flash/adobe-flash-11.0.1.60_beta201107131-r1.ebuild,v 1.1 2011/07/18 18:00:00 lack Exp $
4
5 EAPI=4
6 inherit nsplugins multilib toolchain-funcs versionator
7
8 # Specal version parsing for date-based 'square' releases
9 # For proper date ordering in the ebuild we are using CCYYMMDD,  whereas Adobe
10 # uses MMDDYY in their filename.  Plus we tack on the release number, too.
11 EBUILD_DATE=$(get_version_component_range $(get_version_component_count))
12 DATE_SUFFIX=${EBUILD_DATE: -5:4}${EBUILD_DATE:6:2}
13 REL_SUFFIX=${EBUILD_DATE: -1}
14 MY_64B_URI="http://download.macromedia.com/pub/labs/flashplatformruntimes/flashplayer11/flashplayer11_b${REL_SUFFIX}_install_lin_64_${DATE_SUFFIX}.tar.gz"
15 MY_32B_URI="http://download.macromedia.com/pub/labs/flashplatformruntimes/flashplayer11/flashplayer11_b${REL_SUFFIX}_install_lin_32_${DATE_SUFFIX}.tar.gz"
16
17 DESCRIPTION="Adobe Flash Player"
18 SRC_URI="x86? ( ${MY_32B_URI} )
19 amd64? (
20         multilib? (
21                 32bit? ( ${MY_32B_URI} )
22                 64bit? ( ${MY_64B_URI} )
23         )
24         !multilib? ( ${MY_64B_URI} )
25 )"
26 #HOMEPAGE="http://www.adobe.com/"
27 HOMEPAGE="http://labs.adobe.com/downloads/flashplayer11.html"
28 IUSE="multilib +32bit +64bit vdpau bindist kde"
29 SLOT="0"
30
31 KEYWORDS="-* ~amd64 ~x86"
32 LICENSE="AdobeFlash-11_beta"
33 RESTRICT="strip mirror"
34
35 S="${WORKDIR}"
36
37 NATIVE_DEPS="x11-libs/gtk+:2
38         media-libs/fontconfig
39         dev-libs/nss
40         net-misc/curl
41         vdpau? ( x11-libs/libvdpau )
42         kde? ( kde-base/kcmshell )
43         >=sys-libs/glibc-2.4"
44
45 EMUL_DEPS="vdpau? ( >=app-emulation/emul-linux-x86-xlibs-20110129 )
46         >=app-emulation/emul-linux-x86-gtklibs-20100409-r1
47         app-emulation/emul-linux-x86-soundlibs"
48
49 DEPEND="amd64? ( multilib? ( !64bit? ( www-plugins/nspluginwrapper ) ) )"
50 RDEPEND="x86? ( $NATIVE_DEPS )
51         amd64? (
52                 multilib? (
53                         64bit? ( $NATIVE_DEPS )
54                         32bit? ( $EMUL_DEPS )
55                 )
56                 !multilib? ( $NATIVE_DEPS )
57         )
58         || ( media-fonts/liberation-fonts media-fonts/corefonts )
59         ${DEPEND}"
60
61 # Where should this all go? (Bug #328639)
62 INSTALL_BASE="opt/Adobe/flash-player"
63
64 # Ignore QA warnings in these binary closed-source libraries, since we can't fix
65 # them:
66 QA_TEXTRELS="${INSTALL_BASE}/plugin/libflashplayer.so
67         ${INSTALL_BASE}32/libflashplayer.so"
68
69 pkg_setup() {
70         einfo "Date is $EBUILD_DATE suffix is $DATE_SUFFIX"
71         if use x86; then
72                 export native_install=1
73         elif use amd64; then
74                 # amd64 users may unselect the native 64bit binary, if they choose
75                 if ! use multilib || use 64bit; then
76                         export native_install=1
77                 else
78                         unset native_install
79                 fi
80
81                 if use multilib && use 32bit; then
82                         export amd64_32bit=1
83                 else
84                         unset amd64_32bit
85                 fi
86
87                 if use multilib && ! use 32bit && ! use 64bit; then
88                         eerror "You must select at least one architecture USE flag (32bit or 64bit)"
89                         die "No library version selected [-32bit -64bit]"
90                 fi
91
92                 unset need_lahf_wrapper
93                 if [[ $native_install ]]; then
94                         # 64bit flash requires the 'lahf' instruction (bug #268336)
95                         # Also, check if *any* of the processors are affected (bug #286159)
96                         if grep '^flags' /proc/cpuinfo | grep -qv 'lahf_lm'; then
97                                 export need_lahf_wrapper=1
98                         fi
99                 fi
100         fi
101 }
102
103 src_unpack() {
104         if [[ $amd64_32bit ]]; then
105                 # Since the 32-bit and 64-bit tarballs collide, put the 32-bit one
106                 # elsewhere:
107                 local my_32b_src=${MY_32B_URI##*/}
108                 local my_64b_src=${MY_64B_URI##*/}
109                 unpack $my_64b_src
110                 mkdir 32bit
111                 pushd 32bit >/dev/null
112                 unpack $my_32b_src
113                 popd >/dev/null
114         else
115                 default_src_unpack
116         fi
117 }
118
119 src_compile() {
120         if [[ $need_lahf_wrapper ]]; then
121                 # This experimental wrapper, from Maks Verver via bug #268336 should
122                 # emulate the missing lahf instruction affected platforms.
123                 $(tc-getCC) -fPIC -shared -nostdlib -lc -oflashplugin-lahf-fix.so \
124                         "${FILESDIR}/flashplugin-lahf-fix.c" \
125                         || die "Compile of flashplugin-lahf-fix.so failed"
126         fi
127 }
128
129 src_install() {
130         if [[ $native_install ]]; then
131                 BASE=${INSTALL_BASE}
132
133                 # The plugin itself
134                 exeinto /${BASE}/plugin
135                 doexe libflashplayer.so
136                 inst_plugin /${BASE}/plugin/libflashplayer.so
137
138                 # The optional KDE4 KCM plugin
139                 if use kde; then
140                         exeinto /usr/$(get_libdir)/kde4/
141                         doexe usr/lib/kde4/kcm_adobe_flash_player.so
142                         insinto /usr/share/kde4/services
143                         doins usr/share/kde4/services/kcm_adobe_flash_player.desktop
144                 else
145                         # No KDE applet, so allow the GTK utility to show up in KDE:
146                         sed -i usr/share/applications/flash-player-properties.desktop \
147                                 -e "/^NotShowIn=KDE;/d" || die "sed of .desktop file failed"
148                 fi
149
150                 # The userland 'properties' standalone app:
151                 exeinto /${BASE}/bin
152                 doexe usr/bin/flash-player-properties
153                 for icon in $(find usr/share/icons/ -name '*.png'); do
154                         insinto /$(dirname $icon)
155                         doins $icon
156                 done
157                 insinto usr/share/applications
158                 sed -i usr/share/applications/flash-player-properties.desktop \
159                         -e "s:^Exec=:Exec=/${BASE}/bin/:" || die "sed of .desktop file failed"
160                 doins usr/share/applications/flash-player-properties.desktop
161         fi
162
163         if [[ $need_lahf_wrapper ]]; then
164                 # This experimental wrapper, from Maks Verver via bug #268336 should
165                 # emulate the missing lahf instruction affected platforms.
166                 exeinto /${INSTALL_BASE}
167                 doexe flashplugin-lahf-fix.so
168                 inst_plugin /${INSTALL_BASE}/flashplugin-lahf-fix.so
169         fi
170
171         if [[ $amd64_32bit ]]; then
172                 # Only install the plugin, nothing else for 32-bit.
173                 local oldabi="${ABI}"
174                 ABI="x86"
175
176                 # 32b plugin
177                 pushd "${S}/32bit"
178                         exeinto /${INSTALL_BASE}32
179                         doexe libflashplayer.so
180                         inst_plugin /${INSTALL_BASE}32/libflashplayer.so
181                 popd
182
183                 ABI="${oldabi}"
184         fi
185
186         # The magic config file!
187         insinto "/etc/adobe"
188         doins "${FILESDIR}/mms.cfg"
189 }
190
191 pkg_postinst() {
192         if use amd64; then
193                 if [[ $need_lahf_wrapper ]]; then
194                         ewarn "Your processor does not support the 'lahf' instruction which is used"
195                         ewarn "by Adobe's 64-bit flash binary.  We have installed a wrapper which"
196                         ewarn "should allow this plugin to run.  If you encounter problems, please"
197                         ewarn "adjust your USE flags to install only the 32-bit version and reinstall:"
198                         ewarn "  ${CATEGORY}/$PN[+32bit -64bit]"
199                         elog
200                 fi
201                 if has_version 'www-plugins/nspluginwrapper'; then
202                         if [[ $native_install ]]; then
203                                 # TODO: Perhaps parse the output of 'nspluginwrapper -l'
204                                 #       However, the 64b flash plugin makes
205                                 #       'nspluginwrapper -l' segfault.
206                                 local FLASH_WRAPPER="${ROOT}/usr/lib64/nsbrowser/plugins/npwrapper.libflashplayer.so"
207                                 if [[ -f ${FLASH_WRAPPER} ]]; then
208                                         einfo "Removing duplicate 32-bit plugin wrapper: Native 64-bit plugin installed"
209                                         nspluginwrapper -r "${FLASH_WRAPPER}"
210                                 fi
211                         else
212                                 einfo "nspluginwrapper detected: Installing plugin wrapper"
213                                 local oldabi="${ABI}"
214                                 ABI="x86"
215                                 local FLASH_SOURCE="${ROOT}/${INSTALL_BASE}32/libflashplayer.so"
216                                 nspluginwrapper -i "${FLASH_SOURCE}"
217                                 ABI="${oldabi}"
218                         fi
219                 elif [[ ! $native_install ]]; then
220                         elog "To use the 32-bit flash player in a native 64-bit browser,"
221                         elog "you must install www-plugins/nspluginwrapper"
222                 fi
223         fi
224
225         ewarn "Flash player is closed-source, with a long history of security"
226         ewarn "issues.  Please consider only running flash applets you know to"
227         ewarn "be safe.  The 'flashblock' extension may help for mozilla users:"
228         ewarn "  https://addons.mozilla.org/en-US/firefox/addon/433"
229 }