summaryrefslogtreecommitdiffstats
path: root/rtems/config/tools/rtems-tools-common-1.cfg
blob: dc66783e6cc307824c11d974cf7b4f9415c91602 (plain) (blame)
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
#
# RTEMS Tools Version 2.
#
# This configuration file configure's, builds and install's RTEMS Tools.
#

Name:      rtems-tools-%{rtems_tools_version}-%{release}
Summary:   RTEMS Tools %{rtems_tools_version} for host %{_host}
Version:   %{rtems_tools_version}
Release:   %{release}
URL: 	   http://www.rtems.org/
BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
License:   BSD-2-Clause + GPL-2.0

#
# Prepare the source code.
#
%prep
  # save the build top directory and cd back to it rather than
  # using 'cd ..' because some shells change $PWD to a symlink's
  # target location and 'cd ..' fails.
  build_top=$(pwd)

  %if %{rsb_released}
    rtems_tools_source="rtems-tools-%{rtems_tools_version}"
  %else
    rtems_tools_source="rtems-tools.git"
  %endif
  source_dir_rtems_tools=${rtems_tools_source}

  %source setup rtems-tools -q -n ${rtems_tools_source}
  %patch setup rtems-tools -p1

  cd ${build_top}

%build
  build_top=$(pwd)

  #
  # Provide the host for a Cxc build.
  #
  if test "%{_build}" != "%{_host}" ; then
    RT_HOST="-host=%{_host}"
  else
    RT_HOST=
  fi

  cd ${source_dir_rtems_tools}
  ./waf configure ${RT_HOST} --prefix=%{_prefix}
  ./waf
  cd ${build_top}

%install
  build_top=$(pwd)

  %{__rmdir} $SB_BUILD_ROOT

  #
  # If on Windows we need to add the driver prefix to the built root as waf
  # strips the driver prefix from the prefix path when joining it to the
  # destdir path. Waf is correct in doing this and the RSB is design to match
  # the configure behaviour which treats the whole path including the drive
  # prefix as part of the path as just a path.
  #
  %ifos win32 mingw ming32
   SB_BUILD_ROOT_WAF=$SB_BUILD_ROOT$(echo %{_prefix} | cut -c 1-2)
  %else
   SB_BUILD_ROOT_WAF=$SB_BUILD_ROOT
  %endif

  cd ${source_dir_rtems_tools}
  ./waf --destdir=$SB_BUILD_ROOT_WAF install
  cd ${build_top}