Ticket #51397: Portfile

File Portfile, 3.0 KB (added by denis-fr (Denis), 8 years ago)

Portfile for newlib nano

Line 
1# $Id: $
2
3PortSystem      1.0
4PortGroup       crossgcc 1.0
5PortGroup       compiler_blacklist_versions 1.0
6
7crossgcc.setup      arm-none-eabi 5.1.0
8crossgcc.setup_libc newlib 2.4.0.20160527
9long_description    Add newlib nano to cross development for arm-none-eabi
10
11name            ${crossgcc.target}-newlib-nano
12version         ${crossgcc.libc_version}
13
14
15revision        0
16maintainers     gmail.com:stuartwesterman openmaintainer
17
18checksums       gcc-${crossgcc.version}.tar.bz2 \
19                rmd160  17a9623f384ce10415a603042e0592c9b4956078 \
20                sha256  b7dafdf89cbb0e20333dbf5b5349319ae06e3d1a30bf3515b5488f7e89dca5ad \
21                newlib-${crossgcc.libc_version}.tar.gz \
22                sha1    abc52a5bad9c6decaa569aa32cd0882acd7908ac \
23                rmd160  c86398143803ddb191a27a6fb10920e5b37bb94d
24
25depends_build-append         port:${crossgcc.target}-gcc
26PortGroup active_variants 1.1
27require_active_variants ${crossgcc.target}-gcc libgloss
28
29# specific to ARM
30configure.args-append --enable-interwork --disable-newlib-supplied-syscalls
31# specific to nano
32configure.args-append --enable-newlib-reent-small --disable-newlib-fvwrite-in-streamio --disable-newlib-fseek-optimization --disable-newlib-wide-orient --enable-newlib-nano-malloc --disable-newlib-unbuf-stream-opt --enable-lite-exit --enable-newlib-global-atexit --enable-newlib-nano-formatted-io --disable-nls
33# --enable-target-optspace to avoid compiling with -g
34#configure.args-append --enable-target-optspace
35configure.env-append CFLAGS_FOR_TARGET=-Os CXXFLAGS_FOR_TARGET=-Os
36
37build.target all-target-newlib all-target-libgloss all-target-libstdc++-v3
38
39configure.args-append --with-libgloss
40post-extract {
41    ln -s ${workpath}/newlib-${crossgcc.libc_version}/libgloss ${workpath}/gcc-${crossgcc.version}/
42}
43
44destroot.target install-target-newlib install-target-libgloss install-target-libstdc++-v3
45post-destroot {
46    file delete -force -- ${destroot}${prefix}/lib
47    file delete -force -- ${destroot}${prefix}/share
48    file delete -force -- ${destroot}${prefix}/${crossgcc.target}/include
49    # keep libc.a libg.a librdimon.a librdpmon.a libstdc++.a libsupc+++.a and rename it *_nano.a.
50    foreach fileName [exec find ${destroot}${prefix} -type f -print] {
51        switch -exact -- [file tail ${fileName}] {
52            "libc.a" - "libg.a" - "libm.a" - "librdimon.a" - "librdpmon.a" - "libstdc++.a" - "libsupc++.a" {
53                file rename -force -- ${fileName} [file rootname ${fileName}]_nano.a
54            }
55            default {
56                file delete -force -- ${fileName}
57            }
58        }
59    }
60}
61
62# Failed to build with clang from Xcode 4.5
63# fatal error: error in backend: ran out of registers during register allocation
64compiler.blacklist {clang >= 421 < 422}
65
66# GCC's arm target code contains bracket nesting exceeding clangs's default
67# bracket limit.  (https://llvm.org/bugs/show_bug.cgi?id=19650)
68if {[string match "*clang*" ${configure.compiler}]} {
69    configure.cflags-append -fbracket-depth=512
70    configure.cxxflags-append -fbracket-depth=512
71}