#!/bin/ksh
# $Id: Build.sh 86 2007-06-24 01:57:09Z elkner $
# source: http://download.eclipse.org/eclipse/downloads/
# license: EPL 1.0
VERSION="3.3RC4"
if [ `uname -s` = "SunOS" ]; then
ECLIPSE_OS=solaris
else
ECLIPSE_OS=`uname -s | tr A-Z a-z`
fi
if [ "$ECLIPSE_OS" = "solaris" ]; then
# tbd: use 64bit?, when Solaris provides libgnome* as 64bit as well
if [ `uname -p` = "i386" ]; then
PKG_ARCH=sse
ECLIPSE_ARCH=x86
else
PKG_ARCH=v8plus
ECLIPSE_ARCH=sparc
fi
else
ECLIPSE_ARCH=`uname -m`
case $ECLIPSE_ARCH in
i?86) ECLIPSE_ARCH=x86 ;;
*)
esac
fi
SDIR=`dirname $0`
if [ "$SDIR" == "." ]; then
SDIR=`pwd`
fi
SCRIPTDIR=${SDIR}/../../../etc
. ${SCRIPTDIR}/buildfunctions.sh
SRC=$SOURCE/develop
TMPBUILD=$BUILD/eclipse-$VERSION
# overwrite as long as we have no stable version
#L_CFLAGS="-xarch=$PKG_ARCH -xO2 -I/usr/sfw/include"
#L_LDFLAGS="-xarch=$PKG_ARCH -L/usr/dt/lib${ARCH_DIR} -L/usr/sfw/lib${ARCH_DIR}"
JAVA_HOME=${JAVA_1_6_HOME}
if [ `uname -s` = "SunOS" ]; then
MAKEFILE=make_solaris.mak
else
MAKEFILE=make_linux.mak
fi
fixJavaSource() {
print -u2 "Fixing java source and targets ..."
find . -type f -name '*.xml' | while read f ; do
S1=`ls -al "$f" | awk '{ print $5 }'`
gsed -r -i \
-e 's/("compilerArg" value=")/\1-nowarn /g' \
-e 's:(" \
plugins/org.eclipse.core.filesystem/component.xml
# not sure, whether org.eclipse.core.filesystem_$FS_VERSION needs
# to be the same
VERS=`grep eclipse.versionReplacer ${DST}.x86/build.xml | \
sed -e 's,.*version=.,,' -e 's,".*,,'`
BN=org.eclipse.core.filesystem.solaris.x86
gsed -i \
-e "s,${BN}_.*[0-9]\",${BN}_${VERS}\"," \
-e "s,${BN}_.*\.jar\",${BN}_${VERS}.jar\"," \
assemble.org.eclipse.sdk.solaris.gtk.x86.xml
# fix missing launcher libs
DST=features/org.eclipse.equinox.executable/bin/gtk/solaris
cp -pr $DST/sparc $DST/x86
DST=plugins/org.eclipse.equinox.launcher/fragments/org.eclipse.equinox.launcher.gtk.solaris
cp -pr ${DST}.sparc ${DST}.x86
find ${DST}.x86 -type f -exec gsed -i -e 's,sparc,x86,g' {} +
find ${DST}.x86 -type f -exec gsed -i -e 's,Sparc,Solaris X86,g' {} +
mv ${DST}.x86/launcher.gtk.solaris.sparc.properties \
${DST}.x86/launcher.gtk.solaris.x86.properties
DST=plugins/org.eclipse.equinox.launcher.gtk.solaris
cp -pr ${DST}.sparc ${DST}.x86
find ${DST}.x86 -type f -exec gsed -i -e 's,sparc,x86,g' {} +
find ${DST}.x86 -type f -exec gsed -i -e 's,Sparc,Solaris X86,g' {} +
mv ${DST}.x86/launcher.gtk.solaris.sparc.properties \
${DST}.x86/launcher.gtk.solaris.x86.properties
VERS=`grep eclipse.versionReplacer ${DST}.x86/build.xml | \
sed -e 's,.*version=.,,' -e 's,".*,,'`
BN="org.eclipse.equinox.launcher.gtk.solaris.x86"
gsed -i \
-e "s,${BN}_.*[0-9]\",${BN}_${VERS}\"," \
-e "s,${BN}_.*\.jar\",${BN}_${VERS}.jar\"," \
assemble.org.eclipse.sdk.solaris.gtk.x86.xml
# fix missing source build file
DST=plugins/org.eclipse.platform.source.solaris.gtk.x86
if [ ! -f "$DST/build.xml" ]; then
sed -e 's,sparc,x86,g' \
plugins/org.eclipse.platform.source.solaris.gtk.sparc/build.xml \
>$DST/build.xml
fi
}
debugBuildFiles() {
print -u2 "Fixing build scripts for env emission ..."
find . -type f -name build.sh | while read f ; do
gsed -i -e "/^#!\/bin\/sh/ a\
echo \"====$f====\" >>/tmp/eclipse.mk \\
set | egrep '^(ANT|CC|CXX|BUILD|CDE_HOME|CLASSPATH|JAVA_HOME|LD_LIBRARY_PATH|LD_RUN_PATH|L_|MOZILLA_|PATH|PKG|PROTO|ROOT4BUILD|SOURCE|PROGRAM_|DEFAULT_|OUTPUT_|OS|MODEL)' | sort >> /tmp/eclipse.mk \\
echo \"------------------------------\" >>/tmp/eclipse.mk \\
pwd >>/tmp/eclipse.mk \\
echo \"make -f \$MAKEFILE all \$MAKE_GNOME \$MAKE_CAIRO \$MAKE_AWT \$MAKE_MOZILLA \${1} \${2} \${3} \${4} \${5} \${6} \${7} \${8} \${9}\" >> /tmp/eclipse.mk \\
\\
" \
"$f"
[ $? -eq 0 ] && print -u2 "$f"
done
}
doPrepare() {
SUNPKGS="SUNWcsl SUNWgnome-base-libs SUNWdtbas SUNWxwplt SUNWgnome-vfs SUNWxwinc SUNWhea SUNWgnome-vfs-devel SUNWgnome-libs-devel SUNWdtinc"
REQUIRED=""
. ${SCRIPTDIR}/root4build
cd $TMPBUILD
unzip -U ${SRC}/eclipse-sourceBuild-srcIncluded-${VERSION}.zip >/dev/null
# "make clean" aka sure, the build doesn't inject old broken stuff into
# org.eclipse.swt.gtk.solaris.x86 and/or
# org.eclipse.core.filesystem.solaris.x86
find plugins -name "*.so" -exec rm -f {} +
find plugins -name "*.dll" -exec rm -f {} +
find features -type f -name eclipse -exec rm -f {} +
# remove noise
rm -f plugins/org.eclipse.core.filesystem.solaris.sparc/BUILD_INFO.txt
fixJavaSource
fixMakefiles
if [ "$DEBUG" != "0" ]; then
debugBuildFiles
fi
# reverse engineering support
gsed -i -e 's,ant -q,ant -v,g' build
for p in ${SDIR}/${VERSION}-*.patch ; do
gpatch -p1 -b -z .orig <$p
done
fixMissingParts
cp -p ${SDIR}/ReplaceVersions.java .
javac ReplaceVersions.java
# just to avoid typing
${SDIR}/checkSparcX86diffs.sh ${TMPBUILD} >${TMPBUILD}/diffs.SparcX86
}
doMake() {
cd $TMPBUILD
export PATH=${ANT_HOME}/bin:$PATH
rm -f /tmp/eclipse.mk
echo "make log goes to $MAKELOG"
CDE_HOME=/usr/dt
# do it the solaris way and circumvent window user's shell script bugs
pkginfo -q SUNWfirefox-devel
if [ $? -eq 0 ]; then
MOZILLA_SDK=`pkgparam SUNWfirefox-devel BASEDIR`/include/firefox
MOZILLA_INCLUDES=`pkg-config --cflags firefox-xpcom`
MOZILLA_LIBS=`pkg-config --libs firefox-xpcom`
else
# prevent building it
MOZILLA_INCLUDES=x
MOZILLA_LIBS=x
MOZILLA_SDK=""
fi
L_CFLAGS="$L_CFLAGS -I${JAVA_HOME}/include -I${JAVA_HOME}/include/${ECLIPSE_OS}"
if [ "$DEBUG" != "0" ]; then
L_CFLAGS="-g $L_CFLAGS"
else
L_LDFLAGS="-s $L_LDFLAGS"
fi
echo "CFLAGS=$L_CFLAGS\nLDFLAGS=$L_LDFLAGS"
export L_CFLAGS L_LDFLAGS CDE_HOME JAVA_HOME \
MOZILLA_SDK MOZILLA_INCLUDES MOZILLA_LIBS
./build -os solaris -ws gtk -arch $ECLIPSE_ARCH -compilelibs >$MAKELOG
}
doPackage() {
clean_dst $PROTO
cd $TMPBUILD/result
[ -d eclipse ] && rm -rf eclipse*
unzip -U *.zip >/dev/null
rm -rf eclipse/library
# hmmm - separating source would save ~41 MB of 161 MB. Check later
# if somebody needs a stripped down package - requires feature list tweaks
if [ "a" != "a" ]; then
cd eclipse
mkdir -p ../eclipse.src/plugins
ls -1 plugins | grep '\.source' | while read dir ; do
mv "plugins/$dir" ../eclipse.src/plugins/
done
mkdir ../eclipse.src/features
ls -1 features | grep '\.source' | while read dir ; do
mv "features/$dir" ../eclipse.src/features/
done
cd ..
fi
sed -e "s,@VERSION@,$VERSION," ${SDIR}/eclipse.desktop \
>$TMPBUILD/eclipse.desktop.lnf
pkginfo2arch
cat<${TMPBUILD}/prototype.lnf
!default 0755 bin bin
i pkginfo=${TMPBUILD}/pkginfo.lnf
i depend=${SDIR}/depend
i copyright=${SDIR}/copyright
i i.rename=${SCRIPTDIR}/i.rename
i postinstall=${SDIR}/postinstall
d none share ? ? ?
d none share/applications ? ? ?
f rename share/applications/eclipse-${VERSION}.desktop=${TMPBUILD}/eclipse.desktop.lnf 0644 bin bin
d none share/pixmaps ? ? ?
f none share/pixmaps/eclipse.xpm=${TMPBUILD}/features/org.eclipse.equinox.executable/bin/gtk/linux/x86/icon.xpm 0644 bin bin
EOF
pkgproto $TMPBUILD/result/eclipse=eclipse-gtk-${VERSION} | nawk '{
if ( $1 == "s" )
print
else
print $1, $2, $3, $4, "bin", "bin"
}' >> ${TMPBUILD}/prototype.lnf
echo "calling ${TMPBUILD}/prototype.lnf"
call_pkgmk ${TMPBUILD}/prototype.lnf
}
doBuild "$1"