File: cross-gcc-gensource

package info (click to toggle)
cross-gcc 14+deb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 224 kB
  • ctags: 51
  • sloc: sh: 523; makefile: 137
file content (93 lines) | stat: -rwxr-xr-x 2,265 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash

absdir_local=$(realpath $(dirname $0))
if [ $absdir_local = "/usr/bin" ]; then
    source /usr/share/cross-gcc/cross-gcc-dev-helpers.sh
else
    localbuild=1
    source ./cross-gcc-dev-helpers.sh
fi



if [[ -n $localbuild ]]; then
    README_source_filename=$(dirname $0)/debian/README.source
else
    README_source_filename=/usr/share/doc/cross-gcc-dev/README.source
fi

usage="Usage: $0 \$gcc_release

Here \$gcc_release is a major gcc release for which the gcc-\$gcc_release-source
package exists. README.source describes the full usage. Here it is:

========================
$(cat $README_source_filename)"






if [[ -z "$@" ]]; then
    echo "Usage error! Need gcc_release on the commandline"
    echo ""
    echo "$usage"
    exit 1
fi
if [[ $1 = "--help" || $1 = "-h" ]]; then
    echo "$usage"
    exit 0
fi

gcc_ver=$1

validate_gcc_source_release $gcc_ver ||
    {
        echo "Usage error! Given version '$gcc_ver' not in the known-version list '${known_gcc_releases[@]}'";
        echo ""
        echo "$usage"
        exit 1
    }


set -x

# if we are running from /usr/bin, use the global templates path. Otherwise use
# the local one
if [[ -n $localbuild ]]; then
    SOURCEDIR=$absdir_local/template
else
    SOURCEDIR=/usr/share/cross-gcc/template
fi


#Set of supported targets
TARGET_LIST=${TARGET_LIST:=$(cat ${SOURCEDIR}/debian/targetlist)}
masterarch=${SRCARCH:=amd64}

builddir=cross-gcc-packages-$masterarch

mkdir -p $builddir

# For each target make a source package configured for that target
# Including adding a target arch line to rules file
for arch in ${TARGET_LIST}; do
  pkgname=cross-gcc-${gcc_ver}-${arch}
  rm -rf $builddir/$pkgname

  mkdir $builddir/${pkgname}
  cp -r ${SOURCEDIR}/debian $builddir/${pkgname}

  # in the tree, template/ is missing the copyright and changelog files, so I
  # copy them. When building cross-gcc-dev, these are copied into it separately
  # as well
  if [[ -n $localbuild ]]; then
      cp $absdir_local/debian/{changelog,copyright} $builddir/${pkgname}/debian
  fi

  ( cd $builddir/${pkgname}; export DEB_TARGET_ARCH=${arch}; debian/rules control;\
  sed -i -e "s/^cross-gcc/${pkgname}/g" debian/changelog;\
  sed -i -e "2 a\
  DEB_TARGET_ARCH=${arch}" debian/rules; )
done