configs  Check-in [4a2279477c]

Overview
Comment:zshrc: Add cross() command like in fish
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4a2279477c5e7e18c511b84a2f64b01d5619d22e7fe4c6b7536fb5a02d4d85f3
User & Date: js on 2020-06-04 22:01:41
Other Links: manifest | tags
Context
2020-06-07
10:46
fish_prompt.fish: Fix space error check-in: 0b3f585e66 user: js tags: trunk
2020-06-04
22:01
zshrc: Add cross() command like in fish check-in: 4a2279477c user: js tags: trunk
2020-06-02
20:29
vim: Add of_mutable_file_attributes_t to syntax check-in: 6bfe1f0f90 user: js tags: trunk
Changes

Modified fish/functions/cross.fish from [97c9ccae14] to [2f0918b138].

1
2
3
4
5
6
7
8
9
10

11
12
13

14
15
16
17
18
19
20
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 3ds nds
            if test -z "$DEVKITPRO"
                echo 'Please set DEVKITPRO!'

            end
            if test -z "$DEVKITARM"
                echo 'Please set DEVKITARM!'

            end

            set PATH $DEVKITARM/bin $PATH
            set -g cross_host arm-none-eabi
            set -g objfw_configure_flags --with-$argv[1]
        case amiga
            switch $argv[2]










>



>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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 3ds nds
            if test -z "$DEVKITPRO"
                echo 'Please set DEVKITPRO!'
                return 1
            end
            if test -z "$DEVKITARM"
                echo 'Please set DEVKITARM!'
                return 1
            end

            set PATH $DEVKITARM/bin $PATH
            set -g cross_host arm-none-eabi
            set -g objfw_configure_flags --with-$argv[1]
        case amiga
            switch $argv[2]
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
            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 mingw32
            set -l pkg
            switch $argv[2]
                case i686 x86_64
                    set pkg mingw-w64-$argv[2]-gcc
                    set -g cross_host $argv[2]-w64-mingw32
            end








|
|
|
|














|







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
            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 --sysroot $sdk
            set -gx CPP clang -E --sysroot $sdk
            set -gx CXX clang++ --sysroot $sdk
            set -gx CXXPP clang++ -E --sysroot $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 mingw
            set -l pkg
            switch $argv[2]
                case i686 x86_64
                    set pkg mingw-w64-$argv[2]-gcc
                    set -g cross_host $argv[2]-w64-mingw32
            end

117
118
119
120
121
122
123

124
125
126

127
128
129
130
131
132
133
134

135
136
137

138
139
140
141
142
143
144
145
146
147
148
149
            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 switch
            if test -z "$DEVKITPRO"
                echo 'Please set DEVKITPRO!'

            end
            if test -z "$DEVKITA64"
                echo 'Please set DEVKITA64!'

            end

            set PATH $DEVKITA64/bin $PATH
            set -g cross_host aarch64-none-elf
            set -g objfw_configure_flags --with-switch
        case wii wii-u
            if test -z "$DEVKITPRO"
                echo 'Please set DEVKITPRO!'

            end
            if test -z "$DEVKITPPC"
                echo 'Please set DEVKITPPC!'

            end

            set PATH $DEVKITPPC/bin $PATH
            set -g cross_host powerpc-eabi
            set -g objfw_configure_flags --with-$argv[1]
        case '*'
            echo "Unknown target: $argv[1]"
            return 1
    end

    set -g objfw_configure_flags --host=$cross_host $objfw_configure_flags
end







>



>








>



>












119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
            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 switch
            if test -z "$DEVKITPRO"
                echo 'Please set DEVKITPRO!'
                return 1
            end
            if test -z "$DEVKITA64"
                echo 'Please set DEVKITA64!'
                return 1
            end

            set PATH $DEVKITA64/bin $PATH
            set -g cross_host aarch64-none-elf
            set -g objfw_configure_flags --with-switch
        case wii wii-u
            if test -z "$DEVKITPRO"
                echo 'Please set DEVKITPRO!'
                return 1
            end
            if test -z "$DEVKITPPC"
                echo 'Please set DEVKITPPC!'
                return 1
            end

            set PATH $DEVKITPPC/bin $PATH
            set -g cross_host powerpc-eabi
            set -g objfw_configure_flags --with-$argv[1]
        case '*'
            echo "Unknown target: $argv[1]"
            return 1
    end

    set -g objfw_configure_flags --host=$cross_host $objfw_configure_flags
end

Modified zshrc from [d11721ccb4] to [dffe1ca736].

303
304
305
306
307
308
309
310













































































































































































311
312
	cryptopassphrase $@ | tr -d '\n' | $clipboard
}
alias pw="pwnk -k ~/.cryptopassphrase.key"
alias pws="pwnk -k ~/.cryptopassphrase-server.key"

ixio() { curl -F 'f:1=<-' ix.io }
0x0st() { curl -F'file=@-' https://0x0.st }














































































































































































unset fgrep grep grep_color ls ls_color ls_on_cd ls_on_init simple_prompt
unset HISTFILE








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
	cryptopassphrase $@ | tr -d '\n' | $clipboard
}
alias pw="pwnk -k ~/.cryptopassphrase.key"
alias pws="pwnk -k ~/.cryptopassphrase-server.key"

ixio() { curl -F 'f:1=<-' ix.io }
0x0st() { curl -F'file=@-' https://0x0.st }

cross() {
	if [ $# = 0 ]; then
		echo 'Usage: cross platform [architecture1] [architecture2]' \
		     1>&2
		return 1
	fi

	case "$1" in
		3ds | nds)
			if [ -z "$DEVKITPRO" ]; then
				echo "Please set DEVKITPRO!" 1>&2
				return 1
			fi
			if [ -z "$DEVKITARM" ]; then
				echo "Please set DEVKITARM!" 1>&2
				return 1
			fi

			export PATH="$DEVKITARM/bin:$PATH"
			export cross_host="arm-none-eabi"
			export objfw_configure_flags="--with-$1"
			;;
		amiga)
			case "$2" in
				m68k)
					if [ -z "$amiga_gcc_path" ]; then
						echo -n "Please set " 1>&2
						echo "amiga_gcc_path!" 1>&2
						return 1
					fi

					export PATH="$amiga_gcc_path/bin:$PATH"
					export cross_host="m68k-amigaos"
					;;
				ppc)
					if [ -z "$adtools_path" ]; then
						echo -n "Please set " 1>&2
						echo "adtools_path!" 1>&2
						return 1
					fi

					export PATH="$adtools_path/bin:$PATH"
					export cross_host="ppc-amigaos"
					;;
			esac

			if [ $# != 2 -o -z "$cross_host" ]; then
				echo "Usage: cross amiga m68k|ppc" 1>&2
				return 1
			fi
			;;
		ios | iossim)
			if ! which xcrun &>/dev/null; then
				echo -n "Can only cross-compile for iOS " 1>&2
				echo "on a Mac with Xcode!" 1>&2
				return 1
			fi

			case "$1" in
				ios)
					local sdk_type=iphoneos
					local default_archs="arm64"
					;;
				iossim)
					local sdk_type=iphonesimulator
					local default_archs="x86_64"
					;;
			esac

			local sdk="$(xcrun --show-sdk-path --sdk $sdk_type)"
			local archs="${@:2}"

			if [ ${(w)#archs} = 0 ]; then
				archs="$default_archs"
			fi

			export CC="clang --sysroot $sdk"
			export CPP="clang -E --sysroot $sdk"
			export CXX="clang++ --sysroot $sdk"
			export CXXPP="clang++ -E -=sysroot $sdk"

			for arch in $=archs; do
				export CC="$CC -arch $arch"
				export CXX="$CXX -arch $arch"
			done
			export CPP="$CPP -arch $archs[(w)1]"
			export CXXPP="$CXXPP -arch $archs[(w)1]"

			export OBJC="$CC"
			export OBJCPP="$CPP"
			export OBJCXX="$CXX"
			export OBJCPPXX="$CXXPP"
			export IPHONEOS_DEPLOYMENT_TARGET="10.0"
			export cross_host="$archs[(w)1]-apple-darwin"
			;;
		mingw)
			case "$2" in
				i686 | x86_64)
					local pkg="mingw-w64-$2-gcc"
					export cross_host="$2-w64-mingw32"
					;;
			esac

			if [ $# != 2 -o -z "$cross_host" ]; then
				echo "Usage: cross mingw i686|x86_64" 1>&2
				return 1
			fi

			local prefix="$(pkg_info -qp $pkg 2>/dev/null |
			                awk '/^@cwd/ { print $2; exit }')"
			if [ -z "$prefix" ]; then
				echo "Please install $pkg from pkgsrc!" 1>&2
				return 1
			fi

			export PATH="$prefix/cross/$cross_host/bin:$PATH"
			;;
		morphos)
			local pkg="ppc-morphos-gcc-9"
			local prefix="$(pkg_info -qp $pkg 2>/dev/null |
			                awk '/^@cwd/ { print $2; exit }')"
			if [ -z "$prefix" ]; then
				echo "Please install $pkg from pkgsrc!" 1>&2
				return 1
			fi

			export PATH="$prefix/gg/bin:$PATH"
			export CC="ppc-morphos-gcc-9"
			export CXX="ppc-morphos-g++-9"
			export OBJC="$CC"
			export OBJCXX="$CXX"
			export cross_host="ppc-morphos"
			;;
		switch)
			if [ -z "$DEVKITPRO" ]; then
				echo "Please set DEVKITPRO!"
				return 1
			fi
			if [ -z $"DEVKITA64" ]; then
				echo "Please set DEVKITA64!"
				return 1
			fi

			export PATH="$DEVKITA64/bin:$PATH"
			export cross_host="aarch64-none-elf"
			export objfw_configure_flags="--with-$1"
			;;
		wii | wii-u)
			if [ -z "$DEVKITPRO" ]; then
				echo "Please set DEVKITPRO!"
				return 1
			fi
			if [ -z "$DEVKITPPC" ]; then
				echo "Please set DEVKITPPC!"
				return 1
			fi

			export PATH="$DEVKITPPC/bin:$PATH"
			export cross_host="powerpc-eabi"
			export objfw_configure_flags="--with-$1"
			;;
		*)
			echo "Unknown target: $1" 1>&2
			return 1
			;;
	esac

	export objfw_configure_flags=(
		--host=$cross_host
		$=objfw_configure_flags
	)
}

unset fgrep grep grep_color ls ls_color ls_on_cd ls_on_init simple_prompt
unset HISTFILE