source: rtems-source-builder/source-builder/defaults.mc @ db6d3eb

4.104.114.95
Last change on this file since db6d3eb was 0392c5f, checked in by Chris Johns <chrisj@…>, on 01/18/15 at 00:23:12

Provide flags and include paths for the host when building a Cxc.

  • Property mode set to 100644
File size: 15.6 KB
Line 
1#
2# RTEMS Tools Project (http://www.rtems.org/)
3# Copyright 2010-2013 Chris Johns (chrisj@rtems.org)
4# All rights reserved.
5#
6# This file is part of the RTEMS Tools package in 'rtems-tools'.
7#
8# Permission to use, copy, modify, and/or distribute this software for any
9# purpose with or without fee is hereby granted, provided that the above
10# copyright notice and this permission notice appear in all copies.
11#
12# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
20#
21# All paths in defaults must be Unix format. Do not store any Windows format
22# paths in the defaults.
23#
24# Every entry must describe the type of checking a host must pass.
25#
26# Records:
27#  key: type, attribute, value
28#   type     : none, dir, exe, triplet
29#   attribute: none, required, optional
30#   value    : 'single line', '''multi line'''
31#
32
33#
34# Global defaults
35#
36[global]
37
38# Nothing
39nil:                 none,    none,     ''
40
41# Set to invalid values.
42_bset:               none,    none,     ''
43name:                none,    none,     ''
44version:             none,    none,     ''
45release:             none,    none,     ''
46buildname:           none,    none,     '%{name}'
47
48# GNU triples needed to build packages
49_host:               triplet, required, ''
50_build:              triplet, required, ''
51_target:             none,    optional, ''
52
53# The user
54_uid:                none,    convert,  '%(%{__id_u} -n)'
55
56# Default flags that can be overridded to supply specific host or build
57# flags and include paths to the tools. The host is the final platform
58# the tools will run on and build is the host building the tools.
59host_cflags:         none,    convert,  '-O2 -pipe'
60host_includes:       none,    convert,  ''
61build_cflags:        none,    convert,  '-O2 -pipe'
62build_cxxflags:      none,    convert,  '-O2 -pipe'
63build_includes:      none,    convert,  ''
64
65# Extra path a platform can override.
66_extra_path:         none,    none,     '%{_sbdir}'
67_ld_library_path:    none,    none,     'LD_LIBRARY_PATH'
68
69# Paths
70_host_platform:      none,    none,     '%{_host_cpu}-%{_host_vendor}-%{_host_os}%{?_gnu}'
71_host_cc:            none,    none,     'gcc'
72_host_cxx:           none,    none,     'g++'
73_arch:               none,    none,     '%{_host_arch}'
74_topdir:             dir,     required, '%{_cwd}'
75_configdir:          dir,     optional, '%{_topdir}/config:%{_sbdir}/config:%{_sbtop}/bare/config'
76_tardir:             dir,     optional, '%{_topdir}/tar'
77_sourcedir:          dir,     optional, '%{_topdir}/sources'
78_patchdir:           dir,     optional, '%{_topdir}/patches:%{_sbdir}/patches'
79_builddir:           dir,     optional, '%{_topdir}/build/%{buildname}'
80_buildcxcdir:        dir,     optional, '%{_topdir}/build/%{buildname}-cxc'
81_docdir:             dir,     none,     '%{_defaultdocdir}'
82_tmppath:            dir,     none,     '%{_topdir}/build/tmp'
83_tmproot:            dir,     none,     '%{_tmppath}/sb-%{_uid}/%{_bset}'
84_tmpcxcroot:         dir,     none,     '%{_tmppath}/sb-%{_uid}-cxc/%{_bset}'
85buildroot:           dir,     none,     '%{_tmppath}/%{buildname}-%{_uid}'
86buildcxcroot:        dir,     none,     '%{_tmppath}/%{buildname}-%{_uid}-cxc'
87_datadir:            dir,     none,     '%{_prefix}/share'
88_defaultdocdir:      dir,     none,     '%{_prefix}/share/doc'
89_exeext:             none,    none,     ''
90_exec_prefix:        dir,     none,     '%{_prefix}'
91_bindir:             dir,     none,     '%{_exec_prefix}/bin'
92_sbindir:            dir,     none,     '%{_exec_prefix}/sbin'
93_libexecdir:         dir,     none,     '%{_exec_prefix}/libexec'
94_datarootdir:        dir,     none,     '%{_prefix}/share'
95_datadir:            dir,     none,     '%{_datarootdir}'
96_sysconfdir:         dir,     none,     '%{_prefix}/etc'
97_sharedstatedir:     dir,     none,     '%{_prefix}/com'
98_localstatedir:      dir,     none,     '%{prefix}/var'
99_includedir:         dir,     none,     '%{_prefix}/include'
100_lib:                dir,     none,     'lib'
101_libdir:             dir,     none,     '%{_exec_prefix}/%{_lib}'
102_libexecdir:         dir,     none,     '%{_exec_prefix}/libexec'
103_mandir:             dir,     none,     '%{_datarootdir}/man'
104_infodir:            dir,     none,     '%{_datarootdir}/info'
105_localedir:          dir,     none,     '%{_datarootdir}/locale'
106_localedir:          dir,     none,     '%{_datadir}/locale'
107_localstatedir:      dir,     none,     '%{_prefix}/var'
108_pathprepend:        none,    none,     ''
109_pathpostpend:       none,    none,     ''
110_prefix:             dir,     none,     '%{_usr}'
111_usr:                dir,     none,     '/usr/local'
112_usrsrc:             dir,     none,     '%{_usr}/src'
113_var:                dir,     none,     '/usr/local/var'
114_varrun:             dir,     none,     '%{_var}/run'
115
116# Defaults, override in platform specific modules.
117___setup_shell:      exe,     required, '/bin/sh'
118__aclocal:           exe,     optional, 'aclocal'
119__ar:                exe,     required, 'ar'
120__arch_install_post: exe,     none,     '%{nil}'
121__as:                exe,     required, 'as'
122__autoconf:          exe,     optional, 'autoconf'
123__autoheader:        exe,     optional, 'autoheader'
124__automake:          exe,     optional, 'automake'
125__autoreconf:        exe,     optional, 'autoreconf'
126__awk:               exe,     required, 'awk'
127__bash:              exe,     optional, '/bin/bash'
128__bison:             exe,     required, '/usr/bin/bison'
129__bzip2:             exe,     required, '/usr/bin/bzip2'
130__cat:               exe,     required, '/bin/cat'
131__cc:                exe,     required, '/usr/bin/gcc'
132__chgrp:             exe,     required, '/usr/bin/chgrp'
133__chmod:             exe,     required, '/bin/chmod'
134__chown:             exe,     required, '/usr/sbin/chown'
135__cp:                exe,     required, '/bin/cp'
136__cpp:               exe,     none,     '%{__cc} -E'
137__cvs:               exe,     required, '/usr/bin/cvs'
138__cvs_z:             none,    none,     '%{__cvs} -z 9'
139__cxx:               exe,     required, '/usr/bin/g++'
140__flex:              exe,     required, '/usr/bin/flex'
141__git:               exe,     required, '/usr/bin/git'
142__grep:              exe,     required, '/usr/bin/grep'
143__gzip:              exe,     required, '/usr/bin/gzip'
144__id:                exe,     required, '/usr/bin/id'
145__id_u:              exe,     none,     '%{__id} -u'
146__install:           exe,     required, '/usr/bin/install'
147__install_info:      exe,     optional, '/usr/bin/install-info'
148__ld:                exe,     required, '/usr/bin/ld'
149__ldconfig:          exe,     required, '/sbin/ldconfig'
150__ln_s:              exe,     none,     'ln -s'
151__make:              exe,     required, 'make'
152__makeinfo:          exe,     required, '/usr/bin/makeinfo'
153__mkdir:             exe,     required, '/bin/mkdir'
154__mkdir_p:           exe,     none,     '/bin/mkdir -p'
155__mv:                exe,     required, '/bin/mv'
156__nm:                exe,     required, '/usr/bin/nm'
157__objcopy:           exe,     optional, '/usr/bin/objcopy'
158__objdump:           exe,     optional, '/usr/bin/objdump'
159__patch_bin:         exe,     required, '/usr/bin/patch'
160__patch_opts:        none,    none,     '%{nil}'
161__patch:             exe,     none,     '%{__patch_bin} %{__patch_opts}'
162__perl:              exe,     optional, 'perl'
163__svn:               exe,     optional, '/usr/bin/svn'
164__ranlib:            exe,     required, 'ranlib'
165__rm:                exe,     required, '/bin/rm'
166__rmfile:            exe,     none,     '%{__rm} -f'
167__rmdir:             exe,     none,     '%{__rm} -rf'
168__sed:               exe,     required, '/usr/bin/sed'
169__setup_post:        exe,     none,     '%{__chmod} -R a+rX,g-w,o-w .'
170__sh:                exe,     required, '/bin/sh'
171__tar:               exe,     required, '/usr/bin/tar'
172__tar_extract:       exe,     none,     '%{__tar} -xvvf'
173__touch:             exe,     required, '/usr/bin/touch'
174__unzip:             exe,     required, '/usr/bin/unzip'
175__xz:                exe,     required, '/usr/bin/xz'
176
177# Shell Build Settings.
178___build_args:       none,    none,     '-e'
179___build_cmd:        none,    none,     '%{?_sudo:%{_sudo} }%{?_remsh:%{_remsh} %{_remhost} }%{?_remsudo:%{_remsudo} }%{?_remchroot:%{_remchroot} %{_remroot} }%{___build_shell} %{___build_args}'
180___build_post:       none,    none,     'exit 0'
181
182# Prebuild set up script.
183___build_pre:        none,    none,     '''# ___build_pre in as set up in defaults.py
184# Save the original path away.
185export SB_ORIG_PATH=${PATH}
186# Directories
187%{?_prefix:SB_PREFIX="%{_prefix}"}
188%{?_prefix:SB_PREFIX_CLEAN=$(echo "%{_prefix}" | %{__sed} -e 's/^\///')}
189SB_SOURCE_DIR="%{_sourcedir}"
190SB_BUILD_DIR="%{_builddir}"
191# host == build, use build; host != build , host uses host and build uses build
192SB_HOST_CFLAGS="%{host_cflags} %{host_includes}"
193SB_HOST_LDFLAGS="%{?host_ldflags:%{host_ldflags}}%{?_tmproot:-L%{_tmproot}/${SB_PREFIX_CLEAN}/lib}"
194SB_BUILD_CFLAGS="%{build_cflags} %{?_tmproot:-I%{_tmproot}/${SB_PREFIX_CLEAN}/include}"
195SB_BUILD_CXXFLAGS="%{build_cxxflags} %{?_tmproot:-I%{_tmproot}/${SB_PREFIX_CLEAN}/include}"
196SB_BUILD_LDFLAGS="%{?build_ldflags:%{build_ldflags}}%{?_tmproot:-L%{_tmproot}/${SB_PREFIX_CLEAN}/lib}"
197SB_CFLAGS="${SB_BUILD_CFLAGS} %{build_includes}"
198SB_CXXFLAGS="${SB_BUILD_CXXFLAGS} %{build_includes}"
199SB_ARCH="%{_arch}"
200SB_OS="%{_os}"
201export SB_SOURCE_DIR SB_BUILD_DIR SB_ARCH SB_OS
202export SB_HOST_CFLAGS SB_HOST_LDFLAGS SB_BUILD_CFLAGS SB_BUILD_CXXFLAGS SB_BUILD_LDFLAGS SB_CFLAGS SB_CXXFLAGS
203# Documentation
204SB_DOC_DIR="%{_docdir}"
205export SB_DOC_DIR
206# Packages
207SB_PACKAGE_NAME="%{name}"
208SB_PACKAGE_BUILDNAME="%{buildname}"
209SB_PACKAGE_VERSION="%{version}"
210SB_PACKAGE_RELEASE="%{release}"
211export SB_PACKAGE_NAME SB_PACKAGE_VERSION SB_PACKAGE_RELEASE
212# Build directories
213export SB_PREFIX
214%{?_builddir:SB_BUILD_DIR="%{_builddir}"}
215%{?buildroot:SB_BUILD_ROOT="%{buildroot}"}
216%{?buildroot:%{?_prefix:SB_BUILD_ROOT_BINDIR="%{buildroot}/${SB_PREFIX_CLEAN}/bin"}}
217export SB_BUILD_ROOT SB_BUILD_DIR SB_BUILD_ROOT_BINDIR
218%{?_buildcxcdir:SB_BUILD_CXC_DIR="%{_buildcxcdir}"}
219%{?buildcxcroot:SB_BUILD_CXC_ROOT="%{buildcxcroot}"}
220%{?buildcxcroot:%{?_prefix:SB_BUILD_CXC_ROOT_BINDIR="%{buildcxcroot}/${SB_PREFIX_CLEAN}/bin"}}
221export SB_BUILD_CXC_ROOT SB_BUILD_CXC_DIR SB_BUILD_CXC_ROOT_BINDIR
222%{?_tmproot:SB_TMPROOT="%{_tmproot}"}
223%{?_tmproot:%{?_prefix:SB_TMPPREFIX="%{_tmproot}/${SB_PREFIX_CLEAN}"}}
224%{?_tmproot:%{?_prefix:SB_TMPBINDIR="%{_tmproot}/${SB_PREFIX_CLEAN}/bin"}}
225export SB_TMPROOT SB_TMPPREFIX SB_TMPBINDIR
226%{?_tmpcxcroot:SB_TMPCXCROOT="%{_tmproot}"}
227%{?_tmpcxcroot:%{?_prefix:SB_TMPCXCPREFIX="%{_tmpcxcroot}/${SB_PREFIX_CLEAN}"}}
228%{?_tmpcxcroot:%{?_prefix:SB_TMPCXCBINDIR="%{_tmpcxcroot}/${SB_PREFIX_CLEAN}/bin"}}
229export SB_TMPCXCROOT SB_TMPCXCPREFIX SB_TMPCXCBINDIR
230# Extra path support
231%{?_extra_path:SB_EXTRAPATH="%{_extra_path}"}
232# The compiler flags
233%{?_targetcflags:CFLAGS_FOR_TARGET="%{_targetcflags}"}
234%{?_targetcxxflags:CXXFLAGS_FOR_TARGET="%{_targetcxxflags}"}
235export CFLAGS_FOR_TARGET
236export CXXFLAGS_FOR_TARGET
237# Set up the path. Put the CXC path first.
238if test -n "${SB_TMPBINDIR}" ; then
239 PATH="${SB_TMPBINDIR}:$PATH"
240fi
241if test -n "${SB_TMPCXCBINDIR}" ; then
242 PATH="${SB_TMPCXCBINDIR}:$PATH"
243fi
244if test -n "${SB_EXTRAPATH}" ; then
245 PATH="${SB_EXTRAPATH}:$PATH"
246fi
247%{?_pathprepend:PATH="%{_pathprepend}:$PATH"}
248%{?_pathpostpend:PATH="$PATH:%{_pathpostpend}"}
249export PATH
250# Default environment set up.
251LANG=C
252export LANG
253unset DISPLAY || :
254umask 022
255cd "%{_builddir}"'''
256
257___build_shell:      none,    none,     '%{?_buildshell:%{_buildshell}}%{!?_buildshell:/bin/sh}'
258
259___build_template:   none,    none,     '''#!%{___build_shell}
260%{___build_pre}
261%{nil}'''
262
263# Configure command
264configure:           none,    none,     '''
265CFLAGS="${CFLAGS:-${SB_CFLAGS}" ; export CFLAGS ;
266CXXFLAGS="${CXXFLAGS:-${SB_CFLAGS}}" ; export CXXFLAGS ;
267FFLAGS="${FFLAGS:-${SB_CFLAGS}}" ; export FFLAGS ;
268./configure --build=%{_build} --host=%{_host} \
269      --target=%{_target_platform} \
270      --program-prefix=%{?_program_prefix} \
271      --prefix=%{_prefix} \
272      --exec-prefix=%{_exec_prefix} \
273      --bindir=%{_bindir} \
274      --sbindir=%{_sbindir} \
275      --sysconfdir=%{_sysconfdir} \
276      --datadir=%{_datadir} \
277      --includedir=%{_includedir} \
278      --libdir=%{_libdir} \
279      --libexecdir=%{_libexecdir} \
280      --localstatedir=%{_localstatedir} \
281      --sharedstatedir=%{_sharedstatedir} \
282      --mandir=%{_mandir} \
283      --infodir=%{_infodir}'''
284
285# Build script support.
286build_directory:     none,    none,     '''
287if test "%{_build}" != "%{_host}" ; then
288  if test -z "%{_target}" ; then
289    build_dir="build-xc"
290  else
291    build_dir="build-cxc"
292  fi
293else
294  build_dir="build"
295fi'''
296
297# Host/build flags.
298host_build_flags:    none,    none,     '''
299# Host and build flags, Cross build if host and build are different and
300# Cxc build idf target is deifned and also different.
301# Note, gcc is not ready to be compiled with -std=gnu99 (this needs to be checked).
302if test "%{_build}" != "%{_host}" ; then
303  # Cross build
304  CC=$(echo "%{_host}-%{_host_cc}" | sed -e 's,-std=gnu99 ,,')
305  CXX=$(echo "%{_host}-%{_host_cxx}" | sed -e 's,-std=gnu99 ,,')
306  CFLAGS="${SB_HOST_CFLAGS}"
307  LDFLAGS="${SB_HOST_LDFLAGS}"
308  # Host
309  CFLAGS_FOR_HOST="${SB_HOST_CFLAGS}"
310  CXXFLAGS_FOR_HOST="${SB_HOST_CXXFLAGS}"
311  LDFLAGS_FOR_HOST="${SB_HOST_LDFLAGS}"
312  CXXFLAGS_FOR_HOST="${SB_HOST_CFLAGS}"
313  CC_FOR_HOST=$(echo "%{_host_cc} ${SB_HOST_CFLAGS}" | sed -e 's,-std=gnu99 ,,')
314  CXX_FOR_HOST=$(echo "%{_host_cxx} ${SB_HOST_CXXFLAGS}" | sed -e 's,-std=gnu99 ,,')
315  # Build
316  CFLAGS_FOR_BUILD="${SB_BUILD_CFLAGS}"
317  CXXFLAGS_FOR_BUILD="${SB_BUILD_CXXFLAGS}"
318  LDFLAGS_FOR_BUILD="${SB_BUILD_LDFLAGS}"
319  CXXFLAGS_FOR_BUILD="${SB_BUILD_CFLAGS}"
320  CC_FOR_BUILD=$(echo "%{__cc} ${SB_BUILD_CFLAGS}" | sed -e 's,-std=gnu99 ,,')
321  CXX_FOR_BUILD=$(echo "%{__cxx} ${SB_BUILD_CXXFLAGS}" | sed -e 's,-std=gnu99 ,,')
322else
323  LDFLAGS="${SB_BUILD_LDFLAGS}"
324  CC=$(echo "%{__cc} ${SB_BUILD_CFLAGS}" | sed -e 's,-std=gnu99 ,,')
325  CXX=$(echo "%{__cxx} ${SB_BUILD_CXXFLAGS}" | sed -e 's,-std=gnu99 ,,')
326  CC_FOR_BUILD=${CC}
327  CXX_FOR_BUILD=${CXX}
328fi
329export CC CXX CFLAGS LDFLAGS
330export CC_FOR_HOST CXX_FOR_HOST CFLAGS_FOR_HOST CXXFLAGS_FOR_HOST LDFLAGS_FOR_HOST
331export CC_FOR_BUILD CXX_FOR_BUILD CFLAGS_FOR_BUILD CXXFLAGS_FOR_BUILD LDFLAGS_FOR_BUILD'''
332
333# Build/build flags.
334build_build_flags:    none,    none,     '''
335# Build and build flags means force build == host
336# gcc is not ready to be compiled with -std=gnu99
337LDFLAGS="${SB_HOST_LDFLAGS}"
338CC=$(echo "%{__cc} ${SB_CFLAGS}" | sed -e 's,-std=gnu99 ,,')
339CXX=$(echo "%{__cxx} ${SB_CXXFLAGS}" | sed -e 's,-std=gnu99 ,,')
340CC_FOR_BUILD=${CC}
341CXX_FOR_BUILD=${CXX}
342export CC CXX CC_FOR_BUILD CXX_FOR_BUILD CFLAGS LDFLAGS'''
343
344# Default package settings
345_forced_static:     none,         none, '-Xlinker -Bstatic ${LIBS_STATIC} -Xlinker -Bdynamic'
346__xz:                exe,     required, '/usr/bin/xz'
347
348# Mail Support
349_mail_smtp_host:   none,         none, 'localhost'
350_mail_tools_to:    none,         none, 'rtems-tooltestresults@rtems.org'
351
352# Newlib ICONV encodings
353_newlib_iconv_encodings: none,      none, '''big5,cp775,cp850,cp852,cp855,\
354cp866,euc_jp,euc_kr,euc_tw,iso_8859_1,iso_8859_10,iso_8859_11,\
355iso_8859_13,iso_8859_14,iso_8859_15,iso_8859_2,iso_8859_3,\
356iso_8859_4,iso_8859_5,iso_8859_6,iso_8859_7,iso_8859_8,iso_8859_9,\
357iso_ir_111,koi8_r,koi8_ru,koi8_u,koi8_uni,ucs_2,ucs_2_internal,\
358ucs_2be,ucs_2le,ucs_4,ucs_4_internal,ucs_4be,ucs_4le,us_ascii,\
359utf_16,utf_16be,utf_16le,utf_8,win_1250,win_1251,win_1252,\
360win_1253,win_1254,win_1255,win_1256,win_1257,win_1258'''
Note: See TracBrowser for help on using the repository browser.