Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HOWTO: swfdec as a Firefox-plugin
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC
View previous topic :: View next topic  
Author Message
trAc3
n00b
n00b


Joined: 20 Jan 2004
Posts: 17
Location: Berlin, Germany

PostPosted: Fri Aug 26, 2005 10:03 am    Post subject: HOWTO: swfdec as a Firefox-plugin Reply with quote

Hello,

this guide describes the necessary steps to run swfdec-0.3.5 as a Firefox plugin to play Macromedia Flash files. Please note, that the plugin can't handle SWF-Documents containing action-scripts! This has to be implemented in swfdec first.

1) Install dependencies

The plugin needs gstreamer installed. So if you haven't emerged it, run
Code:
# emerge gstreamer gst-plugins

Note: You may set the gstreamer use flag in /etc/make.conf so other applications use this lib as well.

2) Getting a firefox-config

To build he plugin, information about some paths of Firefox are needed. They are determined using a special script called firefox-config, which unfortunately is not installed by emerge by default. At the end of this guide you find my firefox-config. However - if you want to make this script on your own, start installing Firefox (even if you already have installed it!). When you see lines starting with "gmake[1]: Entering directory" (meaning when configure finished), you can stop emerge with STRG+C:
Code:
# emerge mozilla-firefox
[i]lots of info-messages[/i]
gmake[1]: Entering directory `...
[STRG+C]

Then you can build the script using the following commands:
Code:
# cd /var/tmp/portage/mozilla-firefox-[your Firefox version]/work/mozilla/build/unix/
unix # make

You should have a file named firefox-config in this directory. If it's not executable, use chmod. Copy it to /usr/bin afterwards:
Code:
unix # chmod 0755 firefox-config
unix # cp -i firefox-config /usr/bin


Unfortunately, the paths in firefox-config are wrong by now, so you have to correct them. Luckily, only the paths returned by "firefox-info --cflags" are used and need to be changed:
line 63 and 64: change
Code:
if test "/usr/include/firefox-1.0.6" != /usr/include ; then
  includes="-I/usr/include/firefox-1.0.6"

to
Code:
if test "/usr/lib/mozilla-firefox/include" != /usr/include ; then
  includes="-I/usr/lib/mozilla-firefox/include"

line 106: change
Code:
nspr_cflags="-I/usr/include/firefox-1.0.6/nspr"

to
Code:
nspr_cflags="-I/usr/lib/mozilla-firefox/include/nspr"

line 108: change
Code:
component_includes="$component_includes -I/usr/include/firefox-1.0.6/$n"

to
Code:
component_includes="$component_includes -I/usr/lib/mozilla-firefox/include/$n"


The changes here work for me - you may have to alter the pathnames to reflect your setup. If the pathnames noted here don't exist on your box, searching for the file "npapi.h" should give you a hint.

When finished, you can remove "/var/tmp/portage/mozilla-firefox-your Firefox version" to save some disk space.

3) Preparing swfdec

I used version 0.3.5 of swfdec for this guide. It may work with older versions - but I haven't checked this so far. To use this version, you may have to add the line "media-libs/swfdec ~ppc" to your /etc/portage/package.keywords.

Install all necessary libraries for swfdec:
Code:
# emerge --onlydeps swfdec


Now the fun part begins :-) Emerge swfdec and terminate it after the configure step - as you have done in step 2:
Code:
# emerge swfdec
[i]lots of info-messages[/i]
config.status: executing depfiles commands
make  all-recursive
make[1]: Entering directory`...
[STRG+C]


To have the plugin installed in the correct path, you need to edit the templates for the Makefile:
Code:
# cd /var/tmp/portage/swfdec-0.3.5/work/swfdec-0.3.5/plugin

Change "mozilla/plugins" to "mozilla-firefox/plugins" in Makefile.am line 2, and Makefile.in line 238.

4) Configuring, Compiling and Installing swfdec

You need to modify the configure step. Since configure already completed one time, the original call can be found in config.log:
Code:
# cd /var/tmp/portage/swfdec-0.3.5/work/swfdec-0.3.5
swfdec-0.3.5 # grep "\./configure" config.log
     $ ./configure --prefix=/usr --host=powerpc-unknown-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --build=powerpc-unknown-linux-gnu --with-x --enable-pixbuf-loader


Your call of configure may look different, depending on your setup. All you have to do now, is re-running configure with the above command followed by "--enable-mozilla-plugin MOZILLA_CONFIG=/usr/bin/firefox-config". So in my case, I would type:
Code:
# ./configure --prefix=/usr --host=powerpc-unknown-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --build=powerpc-unknown-linux-gnu --with-x --enable-pixbuf-loader --enable-mozilla-plugin MOZILLA_CONFIG=/usr/bin/firefox-config


Simply run make afterwards and trick portage to believe, it had compiled swfdec. A call to ebuild finishes the installation and you are done:
Code:
swfdec-0.3.5 # make
[i]lots of compile-messages[/i]
swfdec-0.3.5 # touch ../../.compiled
swfdec-0.3.5 # ebuild /usr/portage/media-libs/swfdec/swfdec-0.3.5.ebuild merge


(Re-)Opening firefox and typing "about:plugins" into the adress-bar should give you the installed plugin.
When finished, you can remove "/var/tmp/portage/swfdec-0.3.5" to save some disk space.

5) Configuring gstreamer

Although the plugin is installed, you may can't view any flash-document. This may be caused by a misconfiguration of gstreamer. I had no default audiosink, which prevented the plugin from working. After calling
Code:
$ gconftool-2 --type string --set /system/gstreamer/0.8/default/audiosink esdsink
$ gconftool-2 --type string --set /system/gstreamer/default/audiosink esdsink

it went fine. You may use osssink, alsasink or any other depending on your sound-system.

Appendix A) My firefox-config

Code:
#!/bin/sh

prefix=/usr
exec_prefix=/usr
exec_prefix_set=no

usage()
{
        cat <<EOF
Usage: $0 [OPTIONS] [LIBRARIES]
Options:
        [--prefix[=DIR]]
        [--exec-prefix[=DIR]]
        [--version]
        [--defines]
        [--libs] [libraries]
        [--cflags] [components]
        [--idlflags]
Components:
    *
Libraries:
    xpcom
    nspr
    js
    jsj
    gfx
EOF
        exit $1
}

if test $# -eq 0; then
        usage 1 1>&2
fi

while test $# -gt 0; do
  case "$1" in
  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  *) optarg= ;;
  esac

  case $1 in
    --prefix=*)
      prefix=$optarg
      if test $exec_prefix_set = no ; then
        exec_prefix=$optarg
      fi
      ;;
    --prefix)
      echo_prefix=yes
      ;;
    --exec-prefix=*)
      exec_prefix=$optarg
      exec_prefix_set=yes
      ;;
    --exec-prefix)
      echo_exec_prefix=yes
      ;;
    --version)
      echo 1.0.6
      exit 0
      ;;
    --cflags)
      if test "/usr/lib/mozilla-firefox/include" != /usr/include ; then
        includes="-I/usr/lib/mozilla-firefox/include"
      fi
      echo_cflags=yes
      ;;
    --defines)
      echo_defines=yes
      ;;
    --libs)
      echo_libs=yes
      ;;
    --idlflags)
      echo_idlflags=yes
      ;;
    xpcom|js|nspr|gfx|jsj)
      echo_components="$echo_components $1"
      echo_libraries="$echo_libraries $1"
      ;;
    xpconnect)
      echo_components="$echo_components $1"
      ;;
    "")
      usage 1 1>&2
      ;;
    *)
      echo_components="$echo_components $1"
      ;;
  esac
  shift
done

if test "$echo_prefix" = "yes"; then
        echo $prefix
fi
if test "$echo_exec_prefix" = "yes"; then
        echo $exec_prefix
fi

if test "$echo_defines" = "yes"; then
    echo -DMOZILLA_VERSION=\"1.7.10\" -DD_INO=d_ino -DSTDC_HEADERS=1 -DHAVE_ST_BLKSIZE=1 -DHAVE_SIGINFO_T=1 -DHAVE_INT16_T=1 -DHAVE_INT32_T=1 -DHAVE_INT64_T=1 -DHAVE_UINT=1 -DHAVE_UNAME_DOMAINNAME_FIELD=1 -DHAVE_VISIBILITY_ATTRIBUTE=1 -DHAVE_DIRENT_H=1 -DHAVE_GETOPT_H=1 -DHAVE_SYS_BITYPES_H=1 -DHAVE_MEMORY_H=1 -DHAVE_UNISTD_H=1 -DHAVE_GNU_LIBC_VERSION_H=1 -DHAVE_NL_TYPES_H=1 -DHAVE_MALLOC_H=1 -DHAVE_X11_XKBLIB_H=1 -DHAVE_SYS_STATVFS_H=1 -DHAVE_SYS_STATFS_H=1 -DHAVE_SYS_CDEFS_H=1 -DHAVE_LIBM=1 -DHAVE_LIBDL=1 -DFUNCPROTO=15 -DHAVE_XSHM=1 -D_REENTRANT=1 -DHAVE_RANDOM=1 -DHAVE_STRERROR=1 -DHAVE_LCHOWN=1 -DHAVE_FCHMOD=1 -DHAVE_SNPRINTF=1 -DHAVE_MEMMOVE=1 -DHAVE_RINT=1 -DHAVE_FLOCKFILE=1 -DHAVE_LOCALTIME_R=1 -DHAVE_STRTOK_R=1 -DHAVE_RES_NINIT=1 -DHAVE_GNU_GET_LIBC_VERSION=1 -DHAVE_LANGINFO_CODESET=1 -DVA_COPY=va_copy -DHAVE_VA_COPY=1 -DHAVE_VA_LIST_AS_ARRAY=1 -DHAVE_I18N_LC_MESSAGES=1 -DMOZ_DEFAULT_TOOLKIT=\"gtk2\" -DMOZ_WIDGET_GTK2=1 -DMOZ_ENABLE_XREMOTE=1 -DMOZ_X11=1 -DMOZ_DISTRIBUTION_ID_UNQUOTED=org.mozilla -DMOZ_DISTRIBUTION_ID=\"org.mozilla\" -DMOZ_PHOENIX=1 -DMOZ_XUL_APP=1 -DMOZ_APP_NAME=\"firefox\" -DMOZ_ENABLE_XFT=1 -DMOZ_ENABLE_COREXFONTS=1 -DMOZ_EXTRA_X11CONVERTERS=1 -DOJI=1 -DIBMBIDI=1 -DMOZ_VIEW_SOURCE=1 -DACCESSIBILITY=1 -DMOZ_XPINSTALL=1 -DMOZ_JSLOADER=1 -DMOZ_MATHML=1 -DMOZ_SVG=1 -DMOZ_SVG_RENDERER_CAIRO=1 -DMOZ_LOGGING=1 -DMOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1 -DHAVE___CXA_DEMANGLE=1 -DMOZ_DEFAULT_MOZILLA_FIVE_HOME=\"/usr/lib/mozilla-firefox\" -DMOZ_USER_DIR=\".mozilla\" -DMOZ_XUL=1 -DMOZ_PROFILELOCKING=1 -DMOZ_DLL_SUFFIX=\".so\" -DXP_UNIX=1 -DUNIX_ASYNC_DNS=1 -DJS_THREADSAFE=1 -DNS_PRINT_PREVIEW=1 -DNS_PRINTING=1 -DMOZ_ACCESSIBILITY_ATK=1 -DMOZILLA_LOCALE_VERSION=\"1.7\" -DMOZILLA_REGION_VERSION=\"1.7\" -DMOZILLA_SKIN_VERSION=\"1.5\"
fi

if test "$echo_cflags" = "yes"; then
    nspr_cflags="-I/usr/lib/mozilla-firefox/include/nspr"
    for n in $echo_components; do
        component_includes="$component_includes -I/usr/lib/mozilla-firefox/include/$n"
    done
    echo $component_includes $includes $nspr_cflags
fi

if test "$echo_idlflags" = "yes"; then
    echo "-I%{idldir}"
fi

_nspr_libs="-L/usr/lib/firefox-1.0.6 -lplds4 -lplc4 -lnspr4 -lpthread -ldl"
_xpcom_libs="-lxpcom $_nspr_libs"
_js_libs="-ljs"

if test "$echo_libs" = "yes"; then
    for l in $echo_libraries; do
        case "$l" in
        gfx)
            libs="$libs -lgkgfx $_xpcom_libs"
            ;;
        xpcom)
            libs="$libs $_xpcom_libs"
            ;;
        nspr)
            libs="$libs $_nspr_libs"
            ;;
        js)
            libs="$libs $_js_libs"
            ;;
        jsj)
            libs="$libs -ljsj $_js_libs $_xpcom_libs"
            ;;
        esac
    done
    echo -L/usr/lib/firefox-1.0.6 $libs
fi


Chris
Back to top
View user's profile Send private message
Maril
n00b
n00b


Joined: 01 Sep 2005
Posts: 3

PostPosted: Fri Sep 02, 2005 12:01 am    Post subject: Reply with quote

Awesome!!

But way too complicated for a fix that cant even handle actionscripts...all of my creations are heavy in the actionscript department, and I'm a flash noob.


Thanks, it is what I was looking for though.
Back to top
View user's profile Send private message
Massimo B.
Veteran
Veteran


Joined: 09 Feb 2005
Posts: 1556
Location: Germany

PostPosted: Mon Oct 10, 2005 3:33 am    Post subject: Reply with quote

Where are the changes in your HOWTO for using swfdec with Konqueror? I just emerged swfdec, gstreamer, gst-plugins and gst-plugin-sfwdec.
Or should I reemerge kde again with the gstreamer useflag?
_________________
ppc:PowerBook5,8 15"(1440)-G4/1.67,2G|amd64:HP EliteBook 8560w,i7-2620M,16G|Acer Z5610 (Core2QuadQ8200),8G|amd64-prefix:OpenSuse|HP EliteDesk 800G1 i7-4790|HP Compaq Pro 6300 i7-3770
Lila-Theme
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum