Krzysztof Daniel 48b3c87
#! /bin/sh
Krzysztof Daniel 48b3c87
Krzysztof Daniel 48b3c87
# We need to make our own copy of the eclipse platform in order to
Krzysztof Daniel 48b3c87
# build against it.  We do this since the build root might already
Krzysztof Daniel 48b3c87
# contain a copy of the plugin we are building -- and the eclipse
Krzysztof Daniel 48b3c87
# releng scripts fail in this situation.  We put this script in the
Krzysztof Daniel 48b3c87
# eclipse core so that it is easy to use from other spec files.
Krzysztof Daniel 48b3c87
Krzysztof Daniel 48b3c87
# Arguments are:
Krzysztof Daniel 48b3c87
# * directory where results should end up (script will make it)
Krzysztof Daniel 48b3c87
# * base location of eclipse platform install
Krzysztof Daniel 48b3c87
# * an optional string that is used to select non-platform
Krzysztof Daniel 48b3c87
#   plugins and features.  At present if a plugin or feature has
Krzysztof Daniel 48b3c87
#   this as a substring, it will be included.  You need only run
Krzysztof Daniel 48b3c87
#   this script once, it will link both the platform and the other
Krzysztof Daniel 48b3c87
#   optionally-selected parts in a single invocation.
Krzysztof Daniel 48b3c87
Krzysztof Daniel 48b3c87
# Test to see if the minimum arguments
Krzysztof Daniel 48b3c87
# are specified
Krzysztof Daniel 48b3c87
Krzysztof Daniel 48b3c87
if [ $# -lt 2 ]; then
Krzysztof Daniel 48b3c87
  echo "Usage: copy-platform where eclipse_base optional_directories"
Krzysztof Daniel 48b3c87
  echo "For example: copy-plaform ~/SDK /usr/lib/eclipse cdt pydev jdt"
Krzysztof Daniel 48b3c87
  exit 1
Krzysztof Daniel 48b3c87
fi
Krzysztof Daniel 48b3c87
Krzysztof Daniel 48b3c87
where=$1; shift
Krzysztof Daniel 48b3c87
eclipse=$1; shift
Krzysztof Daniel 48b3c87
Krzysztof Daniel 48b3c87
datadir=/usr/share/eclipse
Krzysztof Daniel 48b3c87
Krzysztof Daniel 48b3c87
mkdir -p $where/plugins $where/features
Krzysztof Daniel 48b3c87
cd $where
Krzysztof Daniel 48b3c87
Krzysztof Daniel 48b3c87
# Are there any optional arguments left?
Krzysztof Daniel 48b3c87
if [ $# -gt 0 ]; then
Krzysztof Daniel 48b3c87
   for optional in "$@"; do
Krzysztof Daniel 48b3c87
      (cd $eclipse;
Krzysztof Daniel 48b3c87
	ls -d plugins/*"$optional"* features/*"$optional"* 2>/dev/null) |
Krzysztof Daniel 48b3c87
      while read f; do
Krzysztof Daniel 48b3c87
         [ ! -e $f ] && ln -s $eclipse/$f $f
Krzysztof Daniel 48b3c87
      done
Krzysztof Daniel 48b3c87
      (cd $eclipse/dropins; ls -d "$optional" 2>/dev/null) |
Krzysztof Daniel 48b3c87
      while read f; do
Krzysztof Daniel 48b3c87
	  if [ -e $eclipse/dropins/$f/eclipse ]; then
Krzysztof Daniel 48b3c87
	      (cd $eclipse/dropins/$f/eclipse;
Krzysztof Daniel 48b3c87
				ls -d plugins/* features/* 2>/dev/null) |
Krzysztof Daniel 48b3c87
	      while read g; do
Krzysztof Daniel 48b3c87
		  [ ! -e $g ] && \
Krzysztof Daniel 48b3c87
		    ln -s $eclipse/dropins/$f/eclipse/$g $g
Krzysztof Daniel 48b3c87
	      done
Krzysztof Daniel 48b3c87
          else
Krzysztof Daniel 48b3c87
	      (cd $eclipse/dropins/$f;
Krzysztof Daniel 48b3c87
				ls -d plugins/* features/* 2>/dev/null) |
Krzysztof Daniel 48b3c87
	      while read g; do
Krzysztof Daniel 48b3c87
	          [ ! -e $g ] && \
Krzysztof Daniel 48b3c87
		    ln -s $eclipse/dropins/$f/$g $g
Krzysztof Daniel 48b3c87
	      done
Krzysztof Daniel 48b3c87
          fi
Krzysztof Daniel 48b3c87
      done
Krzysztof Daniel 48b3c87
      (cd $datadir/dropins; ls -d "$optional" 2>/dev/null) |
Krzysztof Daniel 48b3c87
      while read f; do
Krzysztof Daniel 48b3c87
	  if [ -e $datadir/dropins/$f/eclipse ]; then
Krzysztof Daniel 48b3c87
	      (cd $datadir/dropins/$f/eclipse;
Krzysztof Daniel 48b3c87
				ls -d plugins/* features/* 2>/dev/null) |
Krzysztof Daniel 48b3c87
	      while read g; do
Krzysztof Daniel 48b3c87
		  [ ! -e $g ] && \
Krzysztof Daniel 48b3c87
		    ln -s $datadir/dropins/$f/eclipse/$g $g
Krzysztof Daniel 48b3c87
	      done
Krzysztof Daniel 48b3c87
          else
Krzysztof Daniel 48b3c87
	      (cd $datadir/dropins/$f;
Krzysztof Daniel 48b3c87
				ls -d plugins/* features/* 2>/dev/null) |
Krzysztof Daniel 48b3c87
	      while read g; do
Krzysztof Daniel 48b3c87
	          [ ! -e $g ] && \
Krzysztof Daniel 48b3c87
		    ln -s $datadir/dropins/$g $g
Krzysztof Daniel 48b3c87
	      done
Krzysztof Daniel 48b3c87
          fi
Krzysztof Daniel 48b3c87
      done
Krzysztof Daniel 48b3c87
   done
Krzysztof Daniel 48b3c87
fi
Krzysztof Daniel 48b3c87
for p in $(ls -d $eclipse/dropins/jdt/plugins/*); do
Krzysztof Daniel 48b3c87
    plugin=$(basename $p)
Krzysztof Daniel 48b3c87
    [ ! -e plugins/$plugin ] && ln -s $eclipse/dropins/jdt/plugins/$plugin plugins/$plugin
Krzysztof Daniel 48b3c87
done
Krzysztof Daniel 48b3c87
for f in $(ls -d $eclipse/dropins/jdt/features/*); do
Krzysztof Daniel 48b3c87
    feature=$(basename $f)
Krzysztof Daniel 48b3c87
    [ ! -e features/$feature ] && ln -s $eclipse/dropins/jdt/features/$feature features/$feature
Krzysztof Daniel 48b3c87
done
Krzysztof Daniel 48b3c87
for p in $(ls -d $eclipse/dropins/sdk/plugins/*); do
Krzysztof Daniel 48b3c87
    plugin=$(basename $p)
Krzysztof Daniel 48b3c87
    [ ! -e plugins/$plugin ] && ln -s $eclipse/dropins/sdk/plugins/$plugin plugins/$plugin
Krzysztof Daniel 48b3c87
done
Krzysztof Daniel 48b3c87
for f in $(ls -d $eclipse/dropins/sdk/features/*); do
Krzysztof Daniel 48b3c87
    feature=$(basename $f)
Krzysztof Daniel 48b3c87
    [ ! -e features/$feature ] && ln -s $eclipse/dropins/sdk/features/$feature features/$feature
Krzysztof Daniel 48b3c87
done
Krzysztof Daniel 48b3c87
for p in $(ls -d $eclipse/plugins/*); do
Krzysztof Daniel 48b3c87
    plugin=$(basename $p)
Krzysztof Daniel 48b3c87
    [ ! -e plugins/$plugin ] && ln -s $eclipse/plugins/$plugin plugins/$plugin
Krzysztof Daniel 48b3c87
done
Krzysztof Daniel 48b3c87
for f in $(ls -d $eclipse/features/*); do
Krzysztof Daniel 48b3c87
    feature=$(basename $f)
Krzysztof Daniel 48b3c87
    [ ! -e features/$feature ] && ln -s $eclipse/features/$feature features/$feature
Krzysztof Daniel 48b3c87
done