configs  Check-in [7666b7ca75]

Overview
Comment:Add cross, to set up cross-compilation environment

This matches a collection of functions I had in zsh locally, but merges
them all into a single command.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7666b7ca75558f1b9031ec190f9adad40de58a1106769daedcc05bc6998f7135
User & Date: js on 2020-02-16 13:32:43
Other Links: manifest | tags
Context
2020-02-16
17:48
cross.fish: Add devkitPro check-in: 01a7f7a67b user: js tags: trunk
13:32
Add cross, to set up cross-compilation environment check-in: 7666b7ca75 user: js tags: trunk
2020-02-15
22:44
Update fish config for 3.1.0 check-in: c4bb3283fb user: js tags: trunk
Changes

Added config/fish/functions/cross.fish version [ae0ce98598].





































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
function cross --description 'Set up cross-compilation environment'
    if test (count $argv) = 0
        echo 'Usage: cross platform [architecture1] [architecture2]'
        return 1
    end

    switch $argv[1]
        case amiga
            if test (count $argv) != 2
                echo 'Usage: cross amiga m68k|ppc'
                return 1
            end

            switch $argv[2]
                case m68k
                    if test -z $amiga_gcc_path
                        echo 'Please set amiga_gcc_path!'
                        return 1
                    end

                    set PATH $amiga_gcc_path/bin $PATH
                    set -g cross_host m68k-amigaos
                case ppc
                    if test -z $adtools_path
                        echo 'Please set adtools_path!'
                        return 1
                    end

                    set PATH $adtools_path/bin $PATH
                    set -g cross_host ppc-amigaos
            end

            if test (count $argv) != 2 -o -z $cross_host
                echo 'Usage: cross amiga m68k|ppc'
                return 1
            end
        case ios iossim
            if ! type -q xcrun
                echo 'Can only cross-compile for iOS on a Mac with Xcode!'
                return 1
            end

            set -l sdk_type
            set -l default_archs
            switch $argv[1]
                case ios
                    set sdk_type iphoneos
                    set default_archs arm64
                case iossim
                    set sdk_type iphonesimulator
                    set default_archs x86_64
            end

            set -l sdk (xcrun --show-sdk-path --sdk $sdk_type)
            set -l archs $argv[2..-1]

            if test (count $archs) = 0
                set archs $default_archs
            end

            set -gx CC clang -isysroot $sdk
            set -gx CPP clang -E -isysroot $sdk
            set -gx CXX clang++ -isysroot $sdk
            set -gx CXXPP clang++ -E -isysroot $sdk

            for arch in $archs
                set -a CC -arch $arch
                set -a CXX -arch $arch
            end
            set -a CPP -arch $archs[1]
            set -a CXXPP -arch $archs[1]

            set -gx OBJC $CC
            set -gx OBJCPP $CPP
            set -gx OBJCXX $CXX
            set -gx OBJCPPXX $CXXPP
            set -gx IPHONEOS_DEPLOYMENT_TARGET 10.0
            set -g cross_host $archs[1]-apple-darwin
        case morphos
            set -l prefix (pkg_info -qp ppc-morphos-gcc-9 |
                           awk '/^@cwd/ { print $2; exit }')

            if test -z $prefix
                echo 'Please install ppc-morphos-gcc-9 from pkgsrc!'
                return 1
            end

            set PATH $prefix/gg/bin $PATH
            set -gx CC ppc-morphos-gcc-9
            set -gx CXX ppc-morphos-g++-9
            set -gx OBJC ppc-morphos-gcc-9
            set -gx OBJCXX ppc-morphos-g++-9
            set -g cross_host ppc-morphos
        case '*'
            echo "Unknown target: $argv[1]"
            return 1
    end
end