summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 19a6cce215fb7cd6991914352b10657af5ea7a78 (plain)
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Contributor: ABDULLATIF Mouhamadi <bourou01dev@gmail.com>

pkgname=binutils-msp430
pkgver=2.21.1a
pkgrel=1
pkgdesc="A set of programs to assemble and manipulate binary and object files for the MSP430 architecture"
arch=('i686' 'x86_64')
url="http://sourceforge.net/projects/mspgcc/"
license=('GPL')
depends=('zlib')
options=('!emptydirs' '!libtool')

_mspgcc_ver=20120406
_gnu_mirror="http://ftpmirror.gnu.org"
_sf_base="http://sourceforge.net/projects/mspgcc/files"
_patches_base="${_sf_base}/Patches/LTS/${_mspgcc_ver}"

_patches=()

source=("${_sf_base}/mspgcc/mspgcc-${_mspgcc_ver}.tar.bz2"
        "${_gnu_mirror}/binutils/binutils-${pkgver}.tar.bz2"
        "0001_ld_makefile_libdir.patch"
        "0002_binutils-texinfo-5.0-gas-doc.patch"
        "0003-binutils-texinfo-5.0.patch")
sha1sums=('cc96a7233f0b1d2c106eff7db6fc00e4ed9039a8'
          '525255ca6874b872540c9967a1d26acfbc7c8230'
          '7a5d78fd94fd99dd544816db75a14c326c494e68'
          'b92aba28a090f214a650102ad0f0862c37b45e58'
          '417b1cdb35c41a08d3ca967c165c0d79588986e9')

_builddir=build

prepare() {
  cd ${srcdir}/binutils-2.21.1/

  # https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=avr-binutils-atmel
  # https://bugs.archlinux.org/task/34629
  sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure

  _patch_name="msp430-binutils-${pkgver}-${_mspgcc_ver}.patch"
  (cd "${srcdir}/binutils-2.21.1" &&
    patch -p1 < "${srcdir}/mspgcc-${_mspgcc_ver}/${_patch_name}" &&
    patch -p0 < "${srcdir}/0001_ld_makefile_libdir.patch" &&
    patch -p1 < "${srcdir}/0002_binutils-texinfo-5.0-gas-doc.patch" &&
    patch -p1 < "${srcdir}/0003-binutils-texinfo-5.0.patch" &&
    for patch in ${_patches[@]} ; do
      msg "Applying ${patch}"
      patch -p1 < "${srcdir}/${patch}"
    done)

  rm -frv ${_builddir}
  mkdir -p ${_builddir} && cd ${_builddir}

}



build() {
  cd ${srcdir}/binutils-2.21.1/
  cd ${_builddir}
  CFLAGS="-Os -g0" "${srcdir}/binutils-2.21.1/configure" \
      --prefix=/usr \
      --program-prefix="msp430-" \
      --disable-multilib \
      --disable-werror \
      --disable-nls \
      --enable-install-libbfd \
      --infodir=/usr/share/info \
      --libdir=/usr/msp430/lib \
      --mandir=/usr/share/man \
      --target=msp430

  # This checks the host environment and makes sure all the necessary
  # tools are available to compile Binutils.
  make configure-host

  make tooldir=/usr all
}

check() {
  cd ${srcdir}/binutils-2.21.1/${_builddir}

  # do not abort on errors - manually check log files
  make -k -j1 check || true

}

package() {
  cd ${srcdir}/binutils-2.21.1/${_builddir}
  make DESTDIR=${pkgdir} tooldir=/usr install

  rm -f ${pkgdir}/usr/lib/libiberty.a
  rm -f ${pkgdir}/usr/man/man1/{dlltool,nlmconv,windres}*
  rm -f ${pkgdir}/usr/share/info/dir

  cd ${pkgdir}/usr/share/info
  for file in as bfd binutils configure gprof ld standards ; do
    mv ${file}.info "msp430-${file}.info"
  done

  for bin in addr2line ar as c++filt gprof ld nm objcopy \
            objdump ranlib readelf size strings strip
  do
    rm -f ${pkgdir}/usr/bin/${bin}
  done

  install -Dm644 "${srcdir}/binutils-2.21.1/COPYING" \
    "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

# vim:set sts=2 ts=2 sw=2 et: