Advertisement
Guest User

Untitled

a guest
Jul 14th, 2011
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.16 KB | None | 0 0
  1. # Copyright 1999-2011 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # $Header: $
  4.  
  5. EAPI=3
  6. inherit nsplugins multilib toolchain-funcs versionator
  7.  
  8. EBUILD_DATE=$(get_version_component_range $(get_version_component_count))
  9. DATE_SUFFIX=${EBUILD_DATE: -4:4}${EBUILD_DATE:3:2}
  10.  
  11. MY_32B_URI="http://download.macromedia.com/pub/labs/flashplatformruntimes/flashplayer11/flashplayer11_b1_install_lin_32_$DATE_SUFFIX.tar.gz"
  12. MY_64B_URI="http://download.macromedia.com/pub/labs/flashplatformruntimes/flashplayer11/flashplayer11_b1_install_lin_64_$DATE_SUFFIX.tar.gz"
  13.  
  14. DESCRIPTION="Adobe Flash Player"
  15. SRC_URI="x86? ( ${MY_32B_URI} )
  16. amd64? (
  17.     multilib? (
  18.         32bit? ( ${MY_32B_URI} )
  19.         64bit? ( ${MY_64B_URI} )
  20.     )
  21.     !multilib? ( ${MY_64B_URI} )
  22. )"
  23.  
  24. HOMEPAGE="http://labs.adobe.com/downloads/flashplayer11.html"
  25. IUSE="multilib +32bit +64bit vdpau bindist"
  26. SLOT="0"
  27.  
  28. KEYWORDS="-* ~amd64 ~x86"
  29. LICENSE="AdobeFlash-11"
  30. RESTRICT="strip mirror"
  31.  
  32. S="${WORKDIR}"
  33.  
  34. NATIVE_DEPS="x11-libs/gtk+:2
  35.     media-libs/fontconfig
  36.     dev-libs/nss
  37.     net-misc/curl
  38.     32bit? ( vdpau? ( x11-libs/libvdpau ) )
  39.     >=sys-libs/glibc-2.4"
  40.  
  41. EMUL_DEPS="vdpau? ( >=app-emulation/emul-linux-x86-xlibs-20110129 )
  42.     >=app-emulation/emul-linux-x86-gtklibs-20100409-r1
  43.     app-emulation/emul-linux-x86-soundlibs"
  44.  
  45. DEPEND="amd64? ( multilib? ( !64bit? ( www-plugins/nspluginwrapper ) ) )"
  46. RDEPEND="x86? ( $NATIVE_DEPS )
  47.     amd64? (
  48.         multilib? (
  49.             64bit? ( $NATIVE_DEPS )
  50.             32bit? ( $EMUL_DEPS )
  51.         )
  52.         !multilib? ( $NATIVE_DEPS )
  53.     )
  54.     || ( media-fonts/liberation-fonts media-fonts/corefonts )
  55.     ${DEPEND}"
  56.  
  57. # Where should this all go? (Bug #328639)
  58. INSTALL_BASE="opt/Adobe/flash-player"
  59.  
  60. # Ignore QA warnings in these binary closed-source libraries, since we can't fix
  61. # them:
  62.  
  63. QA_DT_HASH="${INSTALL_BASE}32/libflashplayer.so
  64.     ${INSTALL_BASE}/libflashplayer.so"
  65.  
  66. QA_TEXTRELS="${INSTALL_BASE}32/libflashplayer.so"
  67.  
  68. pkg_setup() {
  69.     einfo "Date is $EBUILD_DATE suffix is $DATE_SUFFIX"
  70.     if use x86; then
  71.         export native_install=1
  72.     elif use amd64; then
  73.         # amd64 users may unselect the native 64bit binary, if they choose
  74.         if ! use multilib || use 64bit; then
  75.             export native_install=1
  76.         else
  77.             unset native_install
  78.         fi
  79.  
  80.         if use multilib && use 32bit; then
  81.             export amd64_32bit=1
  82.         else
  83.             unset amd64_32bit
  84.         fi
  85.  
  86.         if use multilib && ! use 32bit && ! use 64bit; then
  87.             eerror "You must select at least one architecture USE flag (32bit or 64bit)"
  88.             die "No library version selected [-32bit -64bit]"
  89.         fi
  90.  
  91.         unset need_lahf_wrapper
  92.         if [[ $native_install ]]; then
  93.             # 64bit flash requires the 'lahf' instruction (bug #268336)
  94.             # Also, check if *any* of the processors are affected (bug #286159)
  95.             if grep '^flags' /proc/cpuinfo | grep -qv 'lahf_lm'; then
  96.                 export need_lahf_wrapper=1
  97.             fi
  98.  
  99.             if use vdpau; then
  100.                 ewarn "You have tried to enable VDPAU acceleration, but this is only"
  101.                 ewarn "available for the 32-bit flash plugin at this time."
  102.                 ewarn "Continuing with an unaccelerated 64-bit plugin."
  103.                 if [[ $amd64_32bit ]]; then
  104.                     ewarn "The 32-bit plugin will be accelerated."
  105.                 fi
  106.             fi
  107.         fi
  108.     fi
  109. }
  110.  
  111. src_unpack() {
  112.     for x in 32 64; do
  113.         mkdir "${WORKDIR}/${PN}${x}"
  114.         cd "${WORKDIR}/${PN}${x}"
  115.         use "${x}bit" && unpack "flashplayer11_b1_install_lin_${x}_${DATE_SUFFIX}.tar.gz"
  116.     done
  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.         use x86 && cd "${S}/${PN}32" || cd "${S}/${PN}64"
  132.  
  133.         exeinto /${INSTALL_BASE}
  134.         doexe libflashplayer.so
  135.         inst_plugin /${INSTALL_BASE}/libflashplayer.so
  136.     fi
  137.  
  138.     if [[ $need_lahf_wrapper ]]; then
  139.         # This experimental wrapper, from Maks Verver via bug #268336 should
  140.         # emulate the missing lahf instruction affected platforms.
  141.         exeinto /${INSTALL_BASE}
  142.         doexe flashplugin-lahf-fix.so
  143.         inst_plugin /${INSTALL_BASE}/flashplugin-lahf-fix.so
  144.     fi
  145.  
  146.     if [[ $amd64_32bit ]]; then
  147.         local oldabi="${ABI}"
  148.         ABI="x86"
  149.  
  150.         # 32b plugin
  151.         cd "${S}/${PN}32"
  152.             exeinto /${INSTALL_BASE}32
  153.             doexe libflashplayer.so
  154.             inst_plugin /${INSTALL_BASE}32/libflashplayer.so
  155.  
  156.         ABI="${oldabi}"
  157.     fi
  158.  
  159.     # The magic config file!
  160.     insinto "/etc/adobe"
  161.     doins "${FILESDIR}/mms.cfg"
  162. }
  163.  
  164. pkg_postinst() {
  165.     if use amd64; then
  166.         if [[ $need_lahf_wrapper ]]; then
  167.             ewarn "Your processor does not support the 'lahf' instruction which is used"
  168.             ewarn "by Adobe's 64-bit flash binary.  We have installed a wrapper which"
  169.             ewarn "should allow this plugin to run.  If you encounter problems, please"
  170.             ewarn "adjust your USE flags to install only the 32-bit version and reinstall:"
  171.             ewarn "  ${CATEGORY}/$PN[+32bit -64bit]"
  172.             elog
  173.         fi
  174.         if has_version 'www-plugins/nspluginwrapper'; then
  175.             if [[ $native_install ]]; then
  176.                 # TODO: Perhaps parse the output of 'nspluginwrapper -l'
  177.                 #       However, the 64b flash plugin makes
  178.                 #       'nspluginwrapper -l' segfault.
  179.                 local FLASH_WRAPPER="${ROOT}/usr/lib64/nsbrowser/plugins/npwrapper.libflashplayer.so"
  180.                 if [[ -f ${FLASH_WRAPPER} ]]; then
  181.                     einfo "Removing duplicate 32-bit plugin wrapper: Native 64-bit plugin installed"
  182.                     nspluginwrapper -r "${FLASH_WRAPPER}"
  183.                 fi
  184.             else
  185.                 einfo "nspluginwrapper detected: Installing plugin wrapper"
  186.                 local oldabi="${ABI}"
  187.                 ABI="x86"
  188.                 local FLASH_SOURCE="${ROOT}/${INSTALL_BASE}32/libflashplayer.so"
  189.                 nspluginwrapper -i "${FLASH_SOURCE}"
  190.                 ABI="${oldabi}"
  191.             fi
  192.         elif [[ ! $native_install ]]; then
  193.             elog "To use the 32-bit flash player in a native 64-bit browser,"
  194.             elog "you must install www-plugins/nspluginwrapper"
  195.         fi
  196.     fi
  197.  
  198.     ewarn "Flash player is closed-source, with a long history of security"
  199.     ewarn "issues.  Please consider only running flash applets you know to"
  200.     ewarn "be safe.  The 'flashblock' extension may help for mozilla users:"
  201.     ewarn "  https://addons.mozilla.org/en-US/firefox/addon/433"
  202. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement