Pagina 1 di 1

Firefox sorgenti

Inviato: gio 28 ago 2008, 10:55
da Yellowhat
Salve a tutti.
Oggi ho deciso di compilare firefox da sorgenti giusto per adattarlo alla mia architettura perciò mi informo e metto a punto questo slackbuild:

Codice: Seleziona tutto

#!/bin/sh
# Root
(( $UID != 0 )) && echo "You must be root." && exit 1;

# Variabili della directory temporanea
CWD=`pwd`
if ["$TMP" = ""]; then
TMP=/tmp/tgz
fi

NAME=mozilla-firefox-it
VERSION=3.0.1
ARCH=x86
BUILD=1
PKG=$TMP/package-$NAME

# Sorgenti
SOURCE=ftp://ftp.mozilla.org/pub/firefox/releases/$VERSION/source/firefox-$VERSION-source.tar.bz2

if [ ! -e firefox-$VERSION-source.tar.bz2 ]; then
wget -c $SOURCE
fi

# Controllo directory temporanee
if [ ! -d $TMP ]; then
 mkdir -p $TMP
fi
if [ ! -d $PKG ]; then
 mkdir -p $PKG
fi

# Estrarre sorgenti
cd $TMP
tar xjvf $CWD/firefox-$VERSION-source.tar.bz2
cd mozilla

# Permessi
chown -R root:root
find . -perm 664 -exec chmod 644 {} \;
find . -perm 775 -exec chmod 755 {} \;

# Mozconfig
export MOZCONFIG=/home/vasco/Desktop/mozilla-firefox-it/mozconfig

# Compiliare
make -f client.mk checkout || exit
make -f client.mk distclean || exit
make -f client.mk build || exit
make install DESTDIR=$PKG

# Lanciatore
mkdir -p $PKG/usr/share/pixmaps
cat $CWD/firefox.png > $PKG/usr/share/pixmaps/firefox.png

# These files/directories are usually created if Firefox is run as root, which on many
# systems might (and possibly should) be never.  Therefore, if we don't see them we'll
# put stubs in place to prevent startup errors.
( cd $PKG/usr/lib/firefox-$VERSION
  if [ -d extensions/talkback\@mozilla.org ]; then
    if [ ! -r extensions/talkback\@mozilla.org/chrome.manifest ]; then
      echo > extensions/talkback\@mozilla.org/chrome.manifest
    fi
  fi
  if [ ! -d updates ]; then
    mkdir -p updates/0
  fi

	# Some icons aren't in the right place
	mkdir -p chrome/icons/default
	cp icons/{default,mozicon50}.xpm chrome/icons/default/
)

# Creare la directory ./install e copiare lo slack-desc e lo SlackBuild
mkdir -p $PKG/install
cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/$NAME.SlackBuild
cat $CWD/slack-desc > $PKG/install/slack-desc

# Costruire il pacchetto
makepkg -l y -c n $CWD/../$NAME-$VERSION-$ARCH-$BUILD.tgz
Utilizzando come mozconfig

Codice: Seleziona tutto

# Firefox is browser
. $topsrcdir/browser/config/mozconfig
mk_add_options BUILD_OFFICIAL=1 
mk_add_options MOZILLA_OFFICIAL=1 
mk_add_options MOZ_CO_PROJECT=browser 
ac_add_options --enable-application=browser 

# Specify the installation prefix
ac_add_options --prefix=/usr

# Specified libraries
ac_add_options --with-system-zlib
# ac_add_options --with-system-png
ac_add_options --with-system-jpeg
# ac_add_options --enable-system-cairo

# Grafica
ac_add_options --enable-default-toolkit=cairo-gtk2 --disable-freetype2 --enable-xft
ac_add_options --enable-libxul

# This option causes the installed binaries to have the official
# Firefox name embedded in them.
ac_add_options --enable-official-branding

# This option specifies to include support for rendering the HTML
# <canvas></canvas> tag in the Firefox browser.
ac_add_options --enable-canvas

# This option is used so that the debugging symbols are removed from
# the installed binaries during the installation process. Comment out
# this option if you may have a need to retain the debugging symbols
# in the installed binaries. Note that this can substantially
# increase the size of the installed binaries.
ac_add_options --enable-strip

# This option is added so that test libraries and programs are not
# built. These would only be required for debugging purposes.
ac_add_options --disable-tests

# This option is added so that the Mozilla Installer program is not
# built or installed.
ac_add_options --disable-installer

# This option is used to disable the a11y support in the Firefox binaries
ac_add_options --disable-accessibility

# This option is used to enable support for rendering SVG files
ac_add_options --enable-svg

# Altro
ac_add_options --disable-shared
ac_add_options --prefix=/opt/mozilla 
ac_add_options --with-default-mozilla-five-home=/opt/mozilla/lib/firefox3 
ac_add_options --enable-crypto 
ac_add_options --enable-single-profile 
ac_add_options --disable-profilesharing 
ac_add_options --disable-gnomevfs
ac_add_options --disable-debug

# Ottimizzazioni
ac_add_options --enable-optimize='-march=athlon -O2 -pipe -fomit-frame-pointer -msse3'

# Estensioni
ac_add_options --enable-extensions=default
Però il risultato è un file di circa 100MB invece di 9MB. Qualcuno può darmi una mano?

Re: Firefox sorgenti

Inviato: gio 28 ago 2008, 11:31
da conraid
Questo è quello che usai io ai tempi che feci il pacchetto con il sistema di font diverso

Codice: Seleziona tutto

#!/bin/sh

# Heavily based on the Slackware 12.1 SlackBuild

# Slackware build script for Mozilla Firefox (www.mozilla.org)

# Copyright 2008 Corrado Franco (http://www.conraid.net)
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Based on slackbuild of Pat Volkerding and Daedra

# Exit on most errors
set -e

# Set variables:
CWD=$(pwd)

PRGNAME=${PRGNAME:-firefox}
VERSION=${VERSION:-3.0}
ARCH=${ARCH:-i686}
BUILD=${BUILD:-2}
TAG=${TAG:-cf}
TMP=${TMP:-/tmp/tgz}


PKG=$TMP/package-$PRGNAME
OUTPUT=$CWD
DOCS="$PKG/usr/doc/$PRGNAME-$VERSION"

# Insert document files in this variable
DOCFILES=""


# Set compiling FLAGS
SLKFLAGS="-O3 -march=pentium3 -freorder-blocks -fno-reorder-functions -msse -mmmx -mfpmath=sse -D_FORTIFY_SOURCE=2"

# Extract source and prepare:
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP

if ! [ -d mozilla ]; then
    tar xjvf $CWD/$PRGNAME-$VERSION-source.tar.bz2
fi
cd mozilla


# Make sure ownerships and permissions are sane:
chown -R root:root .
find . \
 \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
 -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
 -exec chmod 644 {} \;

# Configure:

# Fix a long standing bug that's prevented staying current on GTK+.
# Thanks to the BLFS folks.  :-)
cat >> layout/build/Makefile.in << EOF

ifdef MOZ_ENABLE_CANVAS
EXTRA_DSO_LDOPTS += \$(XLDFLAGS) -lX11 -lXrender
endif

EOF

echo "ac_cv_visibility_pragma=no" > .mozconfig

export MOZILLA_OFFICIAL="1" &&
export BUILD_OFFICIAL="1" &&
export MOZ_PHOENIX="1" &&
./configure --prefix=/usr \
        --enable-application=browser \
        --enable-optimize="$SLKCFLAGS" \
        --disable-debug \
        --disable-tests \
        --disable-installer \
        --disable-accessibility \
        --enable-official-branding \
        --with-default-mozilla-five-home=/usr/lib/firefox-$VERSION \
        --with-user-appdir=.firefox \
        --libdir=/usr/lib \
        --enable-static \
        --enable-strip \
        --disable-shared \
        --disable-libxul \
        --enable-default-toolkit=cairo-gtk2 \
        --enable-system-cairo \
        --with-system-zlib \
        --with-system-jpeg \
        --enable-xft \
        --enable-jemalloc \
        --enable-svg \
        --enable-crypto \
        --enable-extensions=default,xforms,schema-validation \
        --with-pthreads \

# Build and install:
make
make install DESTDIR=$PKG

# Apply patch
( cd $PKG/usr/lib/firefox-$VERSION
  zcat $CWD/mozilla-firefox-thunderbird.diff.gz | patch -p1 --verbose || exit 1
  if [ ! $? = 0 ]; then
    exit 1
  fi

  cd $PKG/usr/lib/firefox-$VERSION
  zcat $CWD/firefox.moz_plugin_path.diff.gz | patch -p0 --verbose || exit 1
  if [ ! $? = 0 ]; then
    exit 1
  fi

  cd $PKG/usr/lib/firefox-$VERSION/defaults/pref
  zcat $CWD/mozilla-firefox-ua.diff.gz | patch -p0 --verbose || exit 1
 if [ ! $? = 0 ]; then
   exit 1
 fi
)

# Strip binaries:
( cd $PKG
  find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)

# Compress and link manpages, if any:
if [ -d $PKG/usr/man ]; then
( cd $PKG/usr/man
  find . -type f -exec gzip -9 {} \;
  for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
)
fi

# Compress info files, if any:
if [ -d $PKG/usr/info ]; then
rm -f $PKG/usr/info/dir
gzip -9 $PKG/usr/info/*.info*
fi


# Add a documentation directory:
mkdir -p ${DOCS}
for i in ${DOCFILES}; do
    if [ -e ${i} ]; then
        if ! [ -L ${i} ]; then
            cp -a ${i} ${DOCS}
        else
            cp -LRp ${i} ${DOCS}
        fi
    fi;
done

mkdir -p $PKG/usr/lib/mozilla/plugins
mkdir -p $PKG/usr/share/applications
cat $CWD/mozilla-firefox.desktop > $PKG/usr/share/applications/mozilla-firefox.desktop
mkdir -p $PKG/usr/share/pixmaps
cat $CWD/firefox.png > $PKG/usr/share/pixmaps/firefox.png

# These files/directories are usually created if Firefox is run as root, which on many
# systems might (and possibly should) be never.  Therefore, if we don't see them we'll
# put stubs in place to prevent startup errors.
( cd $PKG/usr/lib/firefox-$VERSION
  if [ -d extensions/talkback\@mozilla.org ]; then
    if [ ! -r extensions/talkback\@mozilla.org/chrome.manifest ]; then
      echo > extensions/talkback\@mozilla.org/chrome.manifest
    fi
  fi
  if [ ! -d updates ]; then
    mkdir -p updates/0
  fi
# We make sure that the default icons are in the right place ;)
mkdir -p chrome/icons/default
#cp icons/default.xpm chrome/icons/default/default.xpm
cp icons/mozicon50.xpm chrome/icons/default/main-window.xpm
)

rm -rf $PKG/usr/lib/firefox-devel-3.0


# Add a slackbuild script:
cat $CWD/$PRGNAME.SlackBuild > $PKG/usr/doc/$PRGNAME-$VERSION/$PRGNAME.SlackBuild

# Add slack-desc and doinst.sh, if any
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
if [ -f $CWD/doinst.sh.gz ]; then
        zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
else
    if [ -f $CWD/doinst.sh ]; then
        cat $CWD/doinst.sh > $PKG/install/doinst.sh
    fi
fi


# Create slack-required file:
if [ -x /usr/bin/requiredbuilder ]; then
    requiredbuilder -v -y -s $CWD $PKG
fi

# Create package:
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAME-$VERSION-$ARCH-$BUILD$TAG.tgz

# Clean file, if option is set:
if [ "$1" = "--cleanup" ]; then
  rm -rf $TMP
fi

Niente mozconfig
Questo slackbuild nacque per delle discussioni qui sul forum e dei consigli presi su LQ e dallo slackbuild di Pat per seamonkey
ftp://ftp.slackware.com/pub/slackware/s ... seamonkey/


Tu probabilmente hai compilato "tutto" e non solo il browser

Re: Firefox sorgenti

Inviato: gio 28 ago 2008, 11:55
da Yellowhat
Scusa se approfitto della tua gentilezza, ma come si aggiugne la lingua italiana?

Grazie

Re: Firefox sorgenti

Inviato: gio 28 ago 2008, 12:28
da conraid
Yellowhat ha scritto:Scusa se approfitto della tua gentilezza, ma come si aggiugne la lingua italiana?

Grazie
con --enable-ui-locale=it
la lista dei locale la trovi in /browser/locales/all-locale

ma prima devi metterla nel ramo dei sorgenti immagino, mai fatto
Dovresti prenderli da cvs forse

Codice: Seleziona tutto

cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/l10n co l10n/it
e poi copi la directory, ma non saprei dirti dove, ma come ti ho detto mai fatto, e farlo in uno slackbuild ancora più complicato (anche se non impossibile)
Si tratta di scaricare un CVS nella dir giusta dopo che hai decompresso i sorgenti

comunque parti da qui
http://developer.mozilla.org/en/Build_Documentation

Re: Firefox sorgenti

Inviato: gio 28 ago 2008, 13:55
da Yellowhat
Per la lingua forse sono riuscito a risolvere con

Codice: Seleziona tutto

cd $TMP
cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/l10n co l10n/it
cp -r $TMP/l10n/it $TMP/mozilla/browser/locales/
ed aggiungendo --enable-ui-locale=it

Ma ogni volta durante ./configure mi dice

Codice: Seleziona tutto

configure: warning: Recreating autoconf.mk with updated nspr-config output
mozilla-firefox.SlackBuild: line 106: --enable-xft: command not found
prima con --enable-system-cairo, commento, poi --with-system-zlib, commento, poi --with-system-jpeg, commento e poi --enable-xft.
Insomma tutte le opzioni messe una dietro l'altro dopo cario.

Re: Firefox sorgenti

Inviato: gio 28 ago 2008, 14:04
da conraid
Ad occhio sembra che ti sei scordato un \ dopo qualche opzione del configure
Se non lo metti lui non lo prendi come una stessa riga, e pensa a quelle opzioni del configure come dei comandi

Re: Firefox sorgenti

Inviato: gio 28 ago 2008, 14:08
da Yellowhat
Provando con:

Codice: Seleziona tutto

export MOZILLA_OFFICIAL="1" &&
export BUILD_OFFICIAL="1" &&
export MOZ_PHOENIX="1" &&
./configure --prefix=/usr --prefix=/opt/mozilla --libdir=/usr/$SLKLIBDIR \
	--with-default-mozilla-five-home=/usr/lib/firefox-$VERSION \
	--enable-ui-locale=it \
	--enable-application=browser \
	--enable-system-cairo \
	--with-system-zlib \
	--with-system-jpeg \
	--enable-optimize="$SLKCFLAGS" \
	--enable-default-toolkit=cairo-gtk2 --disable-freetype2 --enable-xft \
	--enable-libxul \
	--enable-official-branding \
	--enable-canvas \
	--enable-strip \
	--disable-debug \
	--disable-tests \
	--disable-installer \
	--disable-accessibility \
	--enable-official-branding \
	--with-user-appdir=.firefox \
	--enable-static \
	--disable-shared \
	--disable-libxul \
	--enable-jemalloc \
	--enable-svg \
	--enable-crypto \
	--enable-single-profile \
	--disable-profilesharing 
	--disable-gnomevfs \
	--enable-extensions=default,xforms,schema-validation \
	--with-pthreads \
Mi dice:

Codice: Seleziona tutto

checking for cairo >= 1.6.0 freetype2 fontconfig... Requested 'cairo >= 1.6.0' but version of cairo is 1.4.14
configure: error: Library requirements (cairo >= 1.6.0 freetype2 fontconfig) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.

Re: Firefox sorgenti

Inviato: gio 28 ago 2008, 14:10
da conraid
Yellowhat ha scritto: Mi dice:

Codice: Seleziona tutto

checking for cairo >= 1.6.0 freetype2 fontconfig... Requested 'cairo >= 1.6.0' but version of cairo is 1.4.14
configure: error: Library requirements (cairo >= 1.6.0 freetype2 fontconfig) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.
Te l'ho detto che era uno slackbuild per il sistema dei font in firefox, hai bisogno di alcuni pacchetti aggiornati.
Cerca la discussione, se la trovo te la posto

Re: Firefox sorgenti

Inviato: gio 28 ago 2008, 14:15
da conraid
viewtopic.php?f=1&t=25069

Leggi tutta la discussione ed anche tutti i link che ci sono, così capisci sia come sono arrivato a quello slackbuild (che puoi e forse devi adattare alle tue esigenze) sia cosa serve a firefox per compilarsi