-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Expand file tree
/
Copy pathproperties.sh
More file actions
2566 lines (2096 loc) · 90.3 KB
/
properties.sh
File metadata and controls
2566 lines (2096 loc) · 90.3 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
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
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# shellcheck shell=bash
# shellcheck disable=SC2034
# XXX: This file is sourced by repology-updater script
# So avoid doing things like executing commands except of those available in
# coreutils and are clearly not a default part of most Linux installations,
# or sourcing any other script in our build directories.
if [ -z "${BASH_VERSION:-}" ]; then
echo "The 'properties.sh' script must be run from a 'bash' shell."; return 64 2>/dev/null|| exit 64 # EX__USAGE
fi
###
# Variables for validation of Termux properties variables.
# Validation is done to ensure packages are not compiled for invalid
# values that are not supported, and values are as per Termux file
# path limits.
#
# Additionally, the Termux packages build system is an unsafe mess of
# unquoted variables in shell scripts, and so validation is necessary
# for important variables, especially specific path variables against
# `TERMUX_REGEX__SAFE_*_PATH` regexes to reduce any potential damage.
#
# - https://github.com/termux/termux-packages/wiki/Termux-file-system-layout#file-path-limits
###
##
# The map of variable names to their space separated list of validator
# actions to perform.
#
# Following are the supported validator actions.
# - `allow_unset_value`: Allow variable to be defined but unset, and
# skip other validations.
# - `app_package_name`: Variable must match `TERMUX_REGEX__APP_PACKAGE_NAME`.
# - `invalid_termux_rootfs_paths`: Path variable must not match
# `TERMUX_REGEX__INVALID_TERMUX_ROOTFS_PATHS`.
# - `invalid_termux_home_paths`: Path variable must not match
# `TERMUX_REGEX__INVALID_TERMUX_HOME_PATHS`.
# - `invalid_termux_prefix_paths`: Path variable must not match
# `TERMUX_REGEX__INVALID_TERMUX_PREFIX_PATHS`.
# - `path_equal_to_or_under_termux_rootfs`: Path variable must be equal
# to or be under `TERMUX__ROOTFS`.
# - `path_under_termux_rootfs`:Path variable must be under `TERMUX__ROOTFS`.
# - `safe_absolute_path`: Path variable must match
# `TERMUX_REGEX__SAFE_ABSOLUTE_PATH` and must not match
# `TERMUX_REGEX__SINGLE_OR_DOUBLE_DOT_CONTAINING_PATH`.
# - `safe_relative_path`: Path variable must match
# `TERMUX_REGEX__SAFE_RELATIVE_PATH` and must not match
# `TERMUX_REGEX__SINGLE_OR_DOUBLE_DOT_CONTAINING_PATH`.
# - `safe_rootfs_or_absolute_path`: Path variable must match
# `TERMUX_REGEX__SAFE_ROOTFS_OR_ABSOLUTE_PATH` and must not match
# `TERMUX_REGEX__SINGLE_OR_DOUBLE_DOT_CONTAINING_PATH`.
# - `apps_api_socket__server_parent_dir`: Path variable must have max
# length `<= TERMUX__APPS_API_SOCKET__SERVER_PARENT_DIR___MAX_LEN`
# including the null `\0` terminator.
# - `unix_path_max`: Path variable must have max length `<= TERMUX__UNIX_PATH_MAX`
# including the null `\0` terminator.
# - `unsigned_int`: Variable must match `TERMUX_REGEX__UNSIGNED_INT`.
##
unset __TERMUX_BUILD_PROPS__VARIABLES_VALIDATOR_ACTIONS_MAP; declare -A __TERMUX_BUILD_PROPS__VARIABLES_VALIDATOR_ACTIONS_MAP=()
##
# The list of variable names added to `__TERMUX_BUILD_PROPS__VARIABLES_VALIDATOR_ACTIONS_MAP`
# that maintains insertion order.
##
unset __TERMUX_BUILD_PROPS__VARIABLES_VALIDATOR_ACTIONS_VARIABLE_NAMES; declare -a __TERMUX_BUILD_PROPS__VARIABLES_VALIDATOR_ACTIONS_VARIABLE_NAMES=()
##
# Whether to validate max lengths of Termux paths. Set to `false` to skip validation.
##
__TERMUX_BUILD_PROPS__VALIDATE_PATHS_MAX_LEN="true"
##
# Whether to validate `usr` merge format for `TERMUX__PREFIX`. Set to `false` to skip validation.
# Check `TERMUX__PREFIX` variable docs for more info.
##
__TERMUX_BUILD_PROPS__VALIDATE_TERMUX_PREFIX_USR_MERGE_FORMAT="true"
##
# `__termux_build_props__add_variables_validator_actions` `<variable_name>` `<validator_actions>`
##
__termux_build_props__add_variables_validator_actions() {
if [ $# -ne 2 ]; then
echo "Invalid argument count '$#' to '__termux_build_props__add_variables_validator_actions'." 1>&2
return 1
fi
local variable_name="$1"
local validator_actions="$2"
if [[ ! "$variable_name" =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]]; then
echo "The variable_name '$variable_name' passed to '__termux_build_props__add_variables_validator_actions' is not a valid shell variable name." 1>&2
return 1
fi
if [[ " ${__TERMUX_BUILD_PROPS__VARIABLES_VALIDATOR_ACTIONS_VARIABLE_NAMES[*]} " != *" $variable_name "* ]]; then
__TERMUX_BUILD_PROPS__VARIABLES_VALIDATOR_ACTIONS_VARIABLE_NAMES+=("$variable_name")
fi
__TERMUX_BUILD_PROPS__VARIABLES_VALIDATOR_ACTIONS_MAP["$variable_name"]+="$validator_actions"
}
####
# Variables for validating Termux variables.
####
##
# Regex that matches an absolute path that starts with a `/` with at
# least one characters under rootfs `/`. Duplicate or trailing path
# separators `/` are not allowed.
##
TERMUX_REGEX__ABSOLUTE_PATH='^(/[^/]+)+$'
##
# Regex that matches a relative path that does not start with a `/`.
# Duplicate or trailing path separators `/` are not allowed.
##
TERMUX_REGEX__RELATIVE_PATH='^[^/]+(/[^/]+)*$'
##
# Regex that matches (rootfs `/`) or (an absolute path that starts
# with a `/`). Duplicate or trailing path separators `/` are not
# allowed.
##
TERMUX_REGEX__ROOTFS_OR_ABSOLUTE_PATH='^((/)|((/[^/]+)+))$'
##
# Regex that matches a safe absolute path that starts with a `/` with
# at least one characters under rootfs `/`. Duplicate or trailing path
# separators `/` are not allowed. The path component characters must
# be in the range `[a-zA-Z0-9+,.=_-]`.
#
# The path must also be validated against
# `TERMUX_REGEX__SINGLE_OR_DOUBLE_DOT_CONTAINING_PATH`.
##
TERMUX_REGEX__SAFE_ABSOLUTE_PATH='^(/[a-zA-Z0-9+,.=_-]+)+$'
##
# Regex that matches a safe relative path that does not start with a
# `/`. Duplicate or trailing path separators `/` are not allowed. The
# path component characters must be in the range `[a-zA-Z0-9+,.=_-]`.
#
# The path must also be validated against
# `TERMUX_REGEX__SINGLE_OR_DOUBLE_DOT_CONTAINING_PATH`.
##
TERMUX_REGEX__SAFE_RELATIVE_PATH='^[a-zA-Z0-9+,.=_-]+(/[a-zA-Z0-9+,.=_-]+)*$'
##
# Regex that matches (rootfs `/`) or (a safe absolute path that starts
# with a `/`). Duplicate or trailing path separators `/` are not
# allowed. The path component characters must be in the range
# `[a-zA-Z0-9+,.=_-]`.
#
# The path must also be validated against
# `TERMUX_REGEX__SINGLE_OR_DOUBLE_DOT_CONTAINING_PATH`.
##
TERMUX_REGEX__SAFE_ROOTFS_OR_ABSOLUTE_PATH='^((/)|((/[a-zA-Z0-9+,.=_-]+)+))$'
##
# Regex that matches a path containing single `/./` or double `/../` dot components.
##
TERMUX_REGEX__SINGLE_OR_DOUBLE_DOT_CONTAINING_PATH='((^\./)|(^\.\./)|(/\.$)|(/\.\.$)|(/\./)|(/\.\./))'
##
# Regex that matches invalid Termux rootfs paths.
#
# The Termux rootfs or prefix paths must not be equal to or be under
# specific Filesystem Hierarchy Standard paths or paths used by Termux
# docker image/host OS for its own files, as Termux packages files
# must be kept separate from the build host. The Termux app data/prefix
# directories are also wiped by `clean.sh` when not running on-device,
# which wouldn't be possible if Termux and host directories are shared.
#
# The invalid paths list does not include the `/data` and `/mnt/expand`
# paths under which private app data directories are assigned to
# Android apps, or the `/data/local/tmp` directory assigned to `adb`
# `shell` user, or the `/system` directory for the Android system.
#
# - https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.html
# - https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard
# - https://github.com/termux/termux-packages/wiki/Termux-file-system-layout#termux-private-app-data-directory
##
TERMUX_REGEX__INVALID_TERMUX_ROOTFS_PATHS='^((/bin(/.*)?)|(/boot(/.*)?)|(/dev(/.*)?)|(/etc(/.*)?)|(/home)|(/lib(/.*)?)|(/lib[^/]+(/.*)?)|(/media)|(/mnt)|(/opt)|(/proc(/.*)?)|(/root)|(/run(/.*)?)|(/sbin(/.*)?)|(/srv(/.*)?)|(/sys(/.*)?)|(/tmp(/.*)?)|(/usr)|(/usr/local)|(((/usr/)|(/usr/local/))((bin)|(games)|(include)|(lib)|(libexec)|(lib[^/]+)|(sbin)|(share)|(src)|(X11R6))(/.*)?)|(/var(/.*)?)|(/bin.usr-is-merged)|(/lib.usr-is-merged)|(/sbin.usr-is-merged)|(/.dockerinit)|(/.dockerenv))$'
##
# Regex that matches invalid Termux home paths.
#
# Same reasoning as `TERMUX_REGEX__INVALID_TERMUX_ROOTFS_PATHS`,
# and invalid paths are the same as well except that `/home` is
# allowed, and `/` and all paths under `/usr` are not allowed.
#
# `/home` is allowed as package data files are not packaged from there.
##
TERMUX_REGEX__INVALID_TERMUX_HOME_PATHS='^((/)|(/bin(/.*)?)|(/boot(/.*)?)|(/dev(/.*)?)|(/etc(/.*)?)|(/lib(/.*)?)|(/lib[^/]+(/.*)?)|(/media)|(/mnt)|(/opt)|(/proc(/.*)?)|(/root)|(/run(/.*)?)|(/sbin(/.*)?)|(/srv(/.*)?)|(/sys(/.*)?)|(/tmp(/.*)?)|(/usr(/.*)?)|(/var(/.*)?)|(/bin.usr-is-merged)|(/lib.usr-is-merged)|(/sbin.usr-is-merged)|(/.dockerinit)|(/.dockerenv))$'
##
# Regex that matches invalid Termux prefix paths.
#
# Same reasoning as `TERMUX_REGEX__INVALID_TERMUX_ROOTFS_PATHS`,
# and invalid paths are the same as well except that `/` is not
# allowed.
##
TERMUX_REGEX__INVALID_TERMUX_PREFIX_PATHS='^((/)|(/bin(/.*)?)|(/boot(/.*)?)|(/dev(/.*)?)|(/etc(/.*)?)|(/home)|(/lib(/.*)?)|(/lib[^/]+(/.*)?)|(/media)|(/mnt)|(/opt)|(/proc(/.*)?)|(/root)|(/run(/.*)?)|(/sbin(/.*)?)|(/srv(/.*)?)|(/sys(/.*)?)|(/tmp(/.*)?)|(/usr)|(/usr/local)|(((/usr/)|(/usr/local/))((bin)|(games)|(include)|(lib)|(libexec)|(lib[^/]+)|(sbin)|(share)|(src)|(X11R6))(/.*)?)|(/var(/.*)?)|(/bin.usr-is-merged)|(/lib.usr-is-merged)|(/sbin.usr-is-merged)|(/.dockerinit)|(/.dockerenv))$'
##
# Regex that matches an unsigned integer `>= 0`.
##
TERMUX_REGEX__UNSIGNED_INT='^[0-9]+$'
##
# Regex to match an android app package name.
#
# The package name must have at least two segments separated by a dot
# `.`, where each segment must start with at least one character in
# the range `[a-zA-Z]`, followed by zero or more characters in the
# range `[a-zA-Z0-9_]`. The package name length must also be
# `<= 255` (`NAME_MAX` for ext4 partitions). The length is not checked
# by this regex and it must be checked with `TERMUX__NAME_MAX`, as
# `bash` `=~` regex conditional does not support lookaround.
#
# Unlike Android, the Termux app package name max length is not `255`
# as its limited by `TERMUX__APPS_DIR___MAX_LEN` and `TERMUX__ROOTFS_DIR___MAX_LEN`.
#
# - https://developer.android.com/build/configure-app-module#set-application-id
# - https://cs.android.com/android/platform/superproject/+/android-14.0.0_r1:frameworks/base/core/java/android/content/pm/parsing/ApkLiteParseUtils.java;l=669-677
# - https://cs.android.com/android/platform/superproject/+/android-14.0.0_r1:frameworks/base/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java;l=63-103
# - https://cs.android.com/android/platform/superproject/+/android-14.0.0_r1:frameworks/base/core/java/android/os/FileUtils.java;l=954-994
# - https://cs.android.com/android/platform/superproject/+/android-14.0.0_r1:frameworks/base/core/java/android/content/pm/PackageManager.java;l=2147-2155
##
TERMUX_REGEX__APP_PACKAGE_NAME="^[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z][a-zA-Z0-9_]*)+$"
##
# Regex to match an android app data path.
#
# The supported formats are:
# - `/data/data/<package_name>` (for primary user `0`) if app is to be
# installed on internal sd.
# - `/data/user/<user_id>/<package_name>` (for all users) if app is to
# be installed on internal sd.
# `/mnt/expand/<volume_uuid>/user/<user_id>/<package_name>` if app is
# to be installed on a removable/portable volume/sd card being used as
# adoptable storage.
#
# - https://github.com/termux/termux-packages/wiki/Termux-file-system-layout#termux-private-app-data-directory
##
TERMUX_REGEX__APP_DATA_DIR_PATH='^(((/data/data)|(/data/user/[0-9]+)|(/mnt/expand/[^/]+/user/[0-9]+))/[^/]+)$'
###
# Variables for the Termux build tools.
###
##
# The path to the `termux-packages` repo root directory.
##
TERMUX_PKGS__BUILD__REPO_ROOT_DIR="${TERMUX_PKGS__BUILD__REPO_ROOT_DIR:-}"
__termux_build_props__set_termux_builder__repo_root_dir() {
local relative_path="${1:-}"
local return_value=0
if [[ -z "${TERMUX_PKGS__BUILD__REPO_ROOT_DIR:-}" ]]; then
if [[ "$(readlink --help 2>&1 || true)" =~ [\ ]-f[,\ ] ]]; then
TERMUX_PKGS__BUILD__REPO_ROOT_DIR="$(file="$(readlink -f -- "${BASH_SOURCE[0]}")" && \
parent="$(dirname -- "$file")" && \
readlink -f -- "${parent}${relative_path}")" || return_value=$?
else
TERMUX_PKGS__BUILD__REPO_ROOT_DIR="$(pwd)" || return_value=$? # macOS `< 12.3` compatibility.
fi
fi
if [ $return_value -ne 0 ] || [[ ! "$TERMUX_PKGS__BUILD__REPO_ROOT_DIR" =~ ^(/[a-zA-Z0-9+,.=_-]+)+$ ]] || \
[[ ! -f "$TERMUX_PKGS__BUILD__REPO_ROOT_DIR/scripts/properties.sh" ]]; then
echo "The TERMUX_PKGS__BUILD__REPO_ROOT_DIR '$TERMUX_PKGS__BUILD__REPO_ROOT_DIR' not found or is not valid." 1>&2
return 1;
fi
}
__termux_build_props__set_termux_builder__repo_root_dir "/.." || exit $?
unset __termux_build_props__set_termux_builder__repo_root_dir
TERMUX_SCRIPTDIR="${TERMUX_SCRIPTDIR:-TERMUX_PKGS__BUILD__REPO_ROOT_DIR}" # Deprecated alternative variable for `TERMUX_PKGS__BUILD__REPO_ROOT_DIR`
TERMUX_SDK_REVISION=9123335
TERMUX_ANDROID_BUILD_TOOLS_VERSION=33.0.1
# when changing the above:
# change TERMUX_PKG_VERSION (and remove TERMUX_PKG_REVISION if necessary) in:
# apksigner, d8
# and trigger rebuild of them
: "${TERMUX_NDK_VERSION_NUM:="29"}"
: "${TERMUX_NDK_REVISION:=""}"
TERMUX_NDK_VERSION="${TERMUX_NDK_VERSION_NUM}${TERMUX_NDK_REVISION}"
# when changing the above:
# update version and hashsum in packages
# libandroid-stub, libc++, ndk-multilib, ndk-sysroot, vulkan-loader-android
# and update SHA256 sums in scripts/setup-android-sdk.sh
# check all packages build and run correctly and bump if needed
: "${TERMUX_HOST_LLVM_MAJOR_VERSION:="20"}"
: "${TERMUX_HOST_LLVM_BASE_DIR:="/usr/lib/llvm-${TERMUX_HOST_LLVM_MAJOR_VERSION}"}"
: "${TERMUX_JAVA_HOME:=/usr/lib/jvm/java-17-openjdk-amd64}"
export JAVA_HOME="${TERMUX_JAVA_HOME}"
if [[ "${TERMUX_PACKAGES_OFFLINE-false}" == "true" ]]; then
export ANDROID_HOME="${TERMUX_PKGS__BUILD__REPO_ROOT_DIR}/build-tools/android-sdk-${TERMUX_SDK_REVISION}"
export NDK="${TERMUX_PKGS__BUILD__REPO_ROOT_DIR}/build-tools/android-ndk-r${TERMUX_NDK_VERSION}"
else
: "${ANDROID_HOME:="${HOME}/lib/android-sdk-$TERMUX_SDK_REVISION"}"
: "${NDK:="${HOME}/lib/android-ndk-r${TERMUX_NDK_VERSION}"}"
fi
###
# Variables for the Termux apps and packages for which to compile packages.
#
# Variables defined in this file need to be in sync with `termux-app`
# (`TermuxConstants` and `TermuxCoreConstants`), termux site and `termux-exec`.
# - https://github.com/termux/termux-app/blob/master/termux-shared/src/main/java/com/termux/shared/termux/TermuxConstants.java
# - https://github.com/termux/termux-app/blob/master/termux-shared/src/main/java/com/termux/shared/termux/core/TermuxCoreConstants.java
#
# Following is a list of `TERMUX_` variables that are safe to modify when forking.
# **DO NOT MODIFY ANY OTHER VARIABLE UNLESS YOU KNOW WHAT YOU ARE DOING.**
#
# - `TERMUX__NAME`, `TERMUX__LNAME` and `TERMUX__UNAME`.
# - `TERMUX__REPOS_HOST_ORG_NAME` and `TERMUX__REPOS_HOST_ORG_URL`.
# - `TERMUX_*__REPO_NAME` and `TERMUX_*__REPO_URL`.
# - `TERMUX_APP__PACKAGE_NAME`.
# - `TERMUX_APP__DATA_DIR`.
# - `TERMUX__PROJECT_SUBDIR`.
# - `TERMUX__ROOTFS_SUBDIR`.
# - `TERMUX__ROOTFS` and alternates.
# - `TERMUX__PREFIX` and alternates.
# - `TERMUX_ANDROID_HOME` and alternates.
# - `TERMUX_APP__NAME` and `TERMUX_APP__LNAME`.
# - `TERMUX_APP__APP_IDENTIFIER`.
# - `TERMUX_APP__NAMESPACE`.
# - `TERMUX_APP__SHELL_API__SHELL_API_ACTIVITY__*`.
# - `TERMUX_APP__SHELL_API__SHELL_API_SERVICE__*`.
# - `TERMUX_APP__RUN_COMMAND_API__RUN_COMMAND_API_SERVICE__*`.
# - `TERMUX_APP__DATA_SENDER_API__DATA_SENDER_API_RECEIVER__*`.
# - `TERMUX_API_APP__PACKAGE_NAME`.
# - `TERMUX_API_APP__NAME`.
# - `TERMUX_API_APP__APP_IDENTIFIER`.
# - `TERMUX_API_APP__NAMESPACE`.
# - `TERMUX_API_APP__ANDROID_API__ANDROID_API_RECEIVER__*`.
# - `TERMUX_AM_APP__NAMESPACE`.
###
##
# Termux project name.
#
# Default value: `Termux`
##
TERMUX__NAME="Termux"
##
# The lower case value for `TERMUX__NAME`.
#
# Default value: `termux`
##
TERMUX__LNAME="${TERMUX__NAME,,}"
##
# The upper case value for `TERMUX__NAME`.
#
# Default value: `TERMUX`
##
TERMUX__UNAME="${TERMUX__NAME^^}"
##
# Termux internal project name.
#
# This is used internally for paths, filenames, and other internal use
# cases and must match the `TERMUX__INTERNAL_NAME_REGEX` regex and
# have max length `TERMUX__INTERNAL_NAME___MAX_LEN`.
#
# **This must not be changed unless doing a full fork of Termux where
# all Termux references are changed instead of just changing the
# `TERMUX__NAME`, `TERMUX_APP__PACKAGE_NAME` and urls.**
#
# Default value: `termux`
##
TERMUX__INTERNAL_NAME="termux"
##
# The regex to validate `TERMUX__INTERNAL_NAME`.
#
# The internal name must start with characters in the range
# `[a-z0-9]`, followed by at least one character in the range
# `[a-z0-9_-]`, and end with characters in the range `[a-z0-9]`. The
# min length is `3`. The max length `7` as per
# `TERMUX__INTERNAL_NAME___MAX_LEN` is not checked by this regex and
# must be checked separately.
#
#
# Constant value: `^[a-z0-9][a-z0-9_-]+[a-z0-9]$`
##
TERMUX__INTERNAL_NAME_REGEX="^[a-z0-9][a-z0-9_-]+[a-z0-9]$"
##
# The max length for the `TERMUX__INTERNAL_NAME`.
#
# Check https://github.com/termux/termux-packages/wiki/Termux-file-system-layout#file-path-limits
# for why the value `7` is chosen.
#
# Constant value: `7`
##
TERMUX__INTERNAL_NAME___MAX_LEN=7
##
# Termux repositories host organization name.
#
# Default value: `termux`
##
TERMUX__REPOS_HOST_ORG_NAME="termux"
##
# Termux repositories host organization url.
#
# Default value: `https://github.com/termux`
##
TERMUX__REPOS_HOST_ORG_URL="https://github.com/$TERMUX__REPOS_HOST_ORG_NAME"
##
# Termux app package name used for `TERMUX_APP__DATA_DIR` and
# `TERMUX_APP__*_(ACTIVITY|RECEIVER|SERVICE)__*` variables.
#
# Ideally package name should be `<= 21` characters and max `33`
# characters. If package name has not yet been chosen, then it would
# be best to keep it to `<= 10` characters. Check
# https://github.com/termux/termux-packages/wiki/Termux-file-system-layout#file-path-limits
# for why.
#
# **See Also:**
# - `TERMUX_APP__NAMESPACE`.
# - https://developer.android.com/build/configure-app-module#set-application-id
# - https://github.com/termux/termux-packages/wiki/Termux-file-system-layout#termux-private-app-data-directory
#
# Default value: `com.termux`
##
TERMUX_APP__PACKAGE_NAME="com.termux"
TERMUX_APP_PACKAGE="$TERMUX_APP__PACKAGE_NAME" # Deprecated alternative variable for `TERMUX_APP__PACKAGE_NAME`
__termux_build_props__add_variables_validator_actions "TERMUX_APP__PACKAGE_NAME" "app_package_name"
##
# Termux app data directory path that is expected to be assigned by
# Android to the Termux app with `TERMUX_APP__PACKAGE_NAME` for all
# its app data, that will contain the Termux project directory
# (`TERMUX__PROJECT_DIR`), and optionally the Termux rootfs directory
# (`TERMUX__ROOTFS`).
#
# The path must match `TERMUX_REGEX__APP_DATA_DIR_PATH`.
#
# The directory set will be deleted by `clean.sh` if `TERMUX__PREFIX`
# is under `TERMUX_APP__DATA_DIR` and not running on-device, so make
# sure a safe path is set if running `clean.sh` in Termux docker or
# host OS build environment.
#
# Default value: `/data/data/com.termux`
##
TERMUX_APP__DATA_DIR="/data/data/$TERMUX_APP__PACKAGE_NAME"
__termux_build_props__add_variables_validator_actions "TERMUX_APP__DATA_DIR" "safe_absolute_path"
##
# The max length for the `TERMUX_APP__DATA_DIR` including the null '\0'
# terminator.
#
# Check https://github.com/termux/termux-packages/wiki/Termux-file-system-layout#file-path-limits
# for why the value `69` is chosen.
#
# Constant value: `69`
##
TERMUX_APP__DATA_DIR___MAX_LEN=69
##
# Termux subdirectory path for `TERMUX__PROJECT_DIR`.
#
# Default value: `termux`
##
TERMUX__PROJECT_SUBDIR="$TERMUX__INTERNAL_NAME"
__termux_build_props__add_variables_validator_actions "TERMUX__PROJECT_SUBDIR" "safe_relative_path"
##
# Termux project directory path under `TERMUX_APP__DATA_DIR`.
#
# This is an exclusive directory for all Termux files that includes
# Termux core directory (`TERMUX__CORE_DIR`), Termux apps directory
# (`TERMUX__APPS_DIR`), and optionally the Termux rootfs directory
# (`TERMUX__ROOTFS`).
#
# Currently, the default Termux rootfs directory is not under it and
# is at the `/files` subdirectory but there are plans to move it to
# `termux/rootfs/II` in future where `II` refers to rootfs id starting
# at `0` for multi-rootfs support.
#
# An exclusive directory is required so that all Termux files exist
# under a single directory, especially for when Termux is provided as
# a library, so that Termux files do not interfere with other files
# of Termux app forks or apps that may use the Termux library.
#
# - https://github.com/termux/termux-packages/wiki/Termux-file-system-layout#termux-project-directory
#
# Default value: `/data/data/com.termux/termux`
##
TERMUX__PROJECT_DIR="$TERMUX_APP__DATA_DIR/$TERMUX__PROJECT_SUBDIR"
__termux_build_props__add_variables_validator_actions "TERMUX__PROJECT_DIR" "safe_absolute_path"
##
# Termux subdirectory path for `TERMUX__CORE_DIR`.
#
# Constant value: `core`
##
TERMUX__CORE_SUBDIR="core"
##
# Termux core directory path under `TERMUX__PROJECT_DIR`.
#
# This contains Termux core files for the Termux app, like user settings and configs for the app,
# which and are independent of any specific rootfs.
#
# - https://github.com/termux/termux-packages/wiki/Termux-file-system-layout#termux-core-directory
#
# Default value: `/data/data/com.termux/termux/core`
##
TERMUX__CORE_DIR="$TERMUX__PROJECT_DIR/$TERMUX__CORE_SUBDIR"
__termux_build_props__add_variables_validator_actions "TERMUX__CORE_DIR" "safe_absolute_path"
##
# Termux subdirectory path for `TERMUX__APPS_DIR`.
#
# Constant value: `app`
##
TERMUX__APPS_SUBDIR="app"
##
# Termux apps directory path under `TERMUX__PROJECT_DIR`.
#
# This contains app specific files for the Termux app, its plugin
# apps, and third party apps, like used for app APIs and
# filesystem/pathname socket files of servers created by the apps.
# - https://man7.org/linux/man-pages/man7/unix.7.html
#
# - https://github.com/termux/termux-packages/wiki/Termux-file-system-layout#termux-apps-directory
#
# Default value: `/data/data/com.termux/termux/app`
##
TERMUX__APPS_DIR="$TERMUX__PROJECT_DIR/$TERMUX__APPS_SUBDIR"
__termux_build_props__add_variables_validator_actions "TERMUX__APPS_DIR" "safe_absolute_path"
##
# The max length for the `TERMUX__APPS_DIR` including the null '\0'
# terminator.
#
# Check https://github.com/termux/termux-packages/wiki/Termux-file-system-layout#file-path-limits
# for why the value `84` is chosen.
#
# Constant value: `84`
##
TERMUX__APPS_DIR___MAX_LEN=84
##
# The max length for the Termux apps api socket server parent directory
# including the null '\0' terminator.
#
# Check https://github.com/termux/termux-packages/wiki/Termux-file-system-layout#file-path-limits
# for why the value `98` is chosen.
#
# Constant value: `98`
##
TERMUX__APPS_API_SOCKET__SERVER_PARENT_DIR___MAX_LEN=98
##
# Termux subdirectory path for `TERMUX__APPS_DIR_BY_IDENTIFIER`.
#
# Constant value: `i`
##
TERMUX__APPS_DIR_BY_IDENTIFIER_SUBDIR="i"
##
# Termux apps directory path by app identifier under `TERMUX__APPS_DIR`.
#
# Default value: `/data/data/com.termux/termux/app/i`
##
TERMUX__APPS_DIR_BY_IDENTIFIER="$TERMUX__APPS_DIR/$TERMUX__APPS_DIR_BY_IDENTIFIER_SUBDIR"
##
# The regex to validate a subdirectory name under the
# `TERMUX__APPS_DIR_BY_IDENTIFIER` excluding the null '\0' terminator
# that represents an app identifier.
#
# The app identifier must only contain characters in the range
# `[a-zA-Z0-9]` as segments, with `[._-]` as separators between
# segments, and with the first segment containing at least `3`
# characters. The max length `10` as per
# `TERMUX__APPS_APP_IDENTIFIER___MAX_LEN` is not checked by this regex
# and must be checked separately.
#
# Constant value: `^[a-zA-Z0-9]{3,}([._-][a-zA-Z0-9]+)*$`
##
TERMUX__APPS_APP_IDENTIFIER_REGEX="^[a-zA-Z0-9]{3,}([._-][a-zA-Z0-9]+)*$"
##
# The max length for a subdirectory name under the
# `TERMUX__APPS_DIR_BY_IDENTIFIER` excluding the null '\0' terminator
# that represents an app identifier.
#
# Check https://github.com/termux/termux-packages/wiki/Termux-file-system-layout#file-path-limits
# for why the value `10` is chosen.
#
# Constant value: `10`
##
TERMUX__APPS_APP_IDENTIFIER___MAX_LEN=10
##
# Termux subdirectory path for `TERMUX__APPS_DIR_BY_UID`.
#
# Constant value: `u`
##
TERMUX__APPS_DIR_BY_UID_SUBDIR="u"
##
# Termux apps directory path by app uid (user_id + app_id) under
# `TERMUX__APPS_DIR`.
#
# Default value: `/data/data/com.termux/termux/app/u`
##
TERMUX__APPS_DIR_BY_UID="$TERMUX__APPS_DIR/$TERMUX__APPS_DIR_BY_UID_SUBDIR"
##
# The regex to validate a subdirectory name under the
# `TERMUX__APPS_DIR_BY_UID` excluding the null '\0' terminator that
# represents an app uid.
#
# The app uid must only contains `5` to `9` characters that are
# numbers and must not start with a `0`.
#
# Constant value: `^[1-9][0-9]{4,8}$`
##
TERMUX__APPS_APP_UID_REGEX="^[1-9][0-9]{4,8}$"
##
# The max length for a subdirectory name under the
# `TERMUX__APPS_DIR_BY_UID` excluding the null '\0' terminator that
# represents an app uid.
#
# Check https://github.com/termux/termux-packages/wiki/Termux-file-system-layout#file-path-limits
# for why the value `9` is chosen.
#
# Constant value: `9`
##
TERMUX__APPS_APP_UID___MAX_LEN=9
##
# Termux apps info environment subfile path under an app directory of
# `TERMUX__APPS_DIR_BY_IDENTIFIER`.
#
# Default value: `termux-apps-info.env`
##
TERMUX_CORE__APPS_INFO_ENV_SUBFILE="$TERMUX__INTERNAL_NAME-apps-info.env"
##
# Termux apps info json subfile path under an app directory of
# `TERMUX__APPS_DIR_BY_IDENTIFIER`.
#
# Default value: `termux-apps-info.json`
##
TERMUX_CORE__APPS_INFO_JSON_SUBFILE="$TERMUX__INTERNAL_NAME-apps-info.json"
##
# `termux-am-socket` server subfile path under an app directory of
# `TERMUX__APPS_DIR_BY_IDENTIFIER`.
#
# Default value: `termux-am`
##
TERMUX_AM_SOCKET__SERVER_SOCKET_SUBFILE="$TERMUX__INTERNAL_NAME-am"
##
# Termux `TERMUX__ROOTFS` id.
#
# Default value: `0`
##
TERMUX__ROOTFS_ID="0"
__termux_build_props__add_variables_validator_actions "TERMUX__ROOTFS_ID" "unsigned_int"
##
# Termux subdirectory path for `TERMUX__ROOTFS`.
#
# Default value: `files`
##
TERMUX__ROOTFS_SUBDIR="files"
__termux_build_props__add_variables_validator_actions "TERMUX__ROOTFS_SUBDIR" "allow_unset_value safe_relative_path"
###########
# Uncomment if to place `TERMUX__ROOTFS` under `TERMUX__PROJECT_DIR`
# instead of at `files`. This may be used for future multi-rootfs
# design. Make sure to update `TERMUX__CACHE_SUBDIR` above as well.
##
# Termux subdirectory path for parent directory of all Termux rootfses
# including `TERMUX__ROOTFS`.
#
# Default value: `termux/rootfs`
##
#TERMUX__ROOTFSES_SUBDIR="$TERMUX__PROJECT_SUBDIR/rootfs"
###########
##
# Termux subdirectory path for `TERMUX__ROOTFS`.
#
# Default value: `termux/rootfs/0`
##
#TERMUX__ROOTFS_SUBDIR="$TERMUX__ROOTFSES_SUBDIR/$TERMUX__ROOTFS_ID"
###########
##
# Termux rootfs directory path under `TERMUX_APP__DATA_DIR` that
# contains the Linux environment rootfs provided by Termux.
#
# - https://github.com/termux/termux-packages/wiki/Termux-file-system-layout#termux-rootfs-directory
# - https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03.html
#
# The Termux rootfs must not be set to path in
# `TERMUX_REGEX__INVALID_TERMUX_ROOTFS_PATHS`. It can exist outside
# the `TERMUX_APP__DATA_DIR` if compiling packages for the Android
# system or `adb` `shell` user.
#
# Default value: `/data/data/com.termux/files`
##
TERMUX__ROOTFS="$TERMUX_APP__DATA_DIR/$TERMUX__ROOTFS_SUBDIR"
TERMUX_BASE_DIR="$TERMUX__ROOTFS" # Deprecated alternative variable for `TERMUX__ROOTFS`
__termux_build_props__add_variables_validator_actions "TERMUX__ROOTFS" "safe_rootfs_or_absolute_path invalid_termux_rootfs_paths"
# FIXME: Remove after updating Termux app and `termux-am-socket`
# package sources and use `TERMUX__APPS_DIR`.
TERMUX_APPS_DIR="$TERMUX__ROOTFS/apps"
##
# The max length for the `TERMUX__ROOTFS` including the null '\0'
# terminator.
#
# Check https://github.com/termux/termux-packages/wiki/Termux-file-system-layout#file-path-limits
# for why the value `86` is chosen.
#
# Constant value: `86`
##
TERMUX__ROOTFS_DIR___MAX_LEN=86
####
# Variables for the Termux home.
####
##
# Termux subdirectory path for `TERMUX__HOME`.
#
# Default value: `home`
##
TERMUX__HOME_SUBDIR="home"
__termux_build_props__add_variables_validator_actions "TERMUX__HOME_SUBDIR" "safe_relative_path"
##
# Termux home directory path under `TERMUX__ROOTFS` used for `$HOME`.
#
# It serves the same purpose as the `/home` directory on Linux distros.
#
# - https://github.com/termux/termux-packages/wiki/Termux-file-system-layout#termux-home-directory
# - https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s08.html
#
# Check `TERMUX__PREFIX` variable docs for rules that apply depending
# on if `TERMUX__ROOTFS` is equal to Android/Linux rootfs `/` or not.
# The Termux home must not be set to Android/Linux rootfs `/` or any
# other path in `TERMUX_REGEX__INVALID_TERMUX_HOME_PATHS`.
#
# Default value: `/data/data/com.termux/files/home`
##
[[ "$TERMUX__ROOTFS" != "/" ]] && TERMUX__HOME="$TERMUX__ROOTFS/$TERMUX__HOME_SUBDIR" || \
TERMUX__HOME="/$TERMUX__HOME_SUBDIR"
__termux_build_props__add_variables_validator_actions "TERMUX__HOME" "safe_absolute_path invalid_termux_home_paths path_under_termux_rootfs"
TERMUX_ANDROID_HOME="$TERMUX__HOME" # Deprecated alternative variable for `TERMUX__HOME`
##
# Termux legacy project user config directory path under `TERMUX__HOME`.
#
# Default value: `/data/data/com.termux/files/home/.termux`
##
TERMUX__LEGACY_PROJECT_USER_CONFIG_DIR="$TERMUX__HOME/.termux"
####
# Variables for the Termux prefix.
####
##
# Termux subdirectory path for `TERMUX__PREFIX`.
#
# Default value: `usr`
##
TERMUX__PREFIX_SUBDIR="usr"
__termux_build_props__add_variables_validator_actions "TERMUX__PREFIX_SUBDIR" "allow_unset_value safe_relative_path"
##
# Termux prefix directory path under or equal to `TERMUX__ROOTFS`
# where all Termux packages data is installed.
#
# It serves the same purpose as the `/usr` directory on Linux distros
# and contains the `bin`, `etc`, `include`, `lib`, `libexec`, `opt`,
# `share`, `tmp` and `var` sub directories.
#
# - https://github.com/termux/termux-packages/wiki/Termux-file-system-layout#termux-prefix-directory
# - https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04.html
#
# If `TERMUX__ROOTFS` is not equal to `/`, then by default Termux
# uses `usr` merge format, like used by `debian`, as per
# `__TERMUX_BUILD_PROPS__VALIDATE_TERMUX_PREFIX_USR_MERGE_FORMAT`
# being enabled by default. In the `usr` merge format, all packages
# are installed under the `usr` subdirectory under rootfs, like under
# `$TERMUX__ROOTFS/usr/bin` and `$TERMUX__ROOTFS/usr/lib`,
# instead of under `$TERMUX__ROOTFS/bin` and `$TERMUX__ROOTFS/lib`.
# So if `usr` merge format is enabled, then DO NOT change the default
# value of `TERMUX__PREFIX_SUBDIR` from `usr`.
# The `$TERMUX__ROOTFS/usr-staging` directory is also used as a
# temporary directory for extracting bootstrap zip by the Termux app,
# before its renamed to `$TERMUX__ROOTFS/usr`.
# Additionally, `TERMUX__PREFIX` must not be equal to `TERMUX__HOME`
# and they must not be under each other, as Termux app requires that
# prefix and home are separate directories as prefix gets wiped during
# bootstrap installation or if `termux-reset` is run, and backup
# scripts require the same. Package data also needs to be kept
# separate from `home`, so it does not make sense for them to be
# equal to or be under each other.
# However, if a Termux app fork is using a modified bootstrap
# installation that does not use the `usr` merge format, then
# `__TERMUX_BUILD_PROPS__VALIDATE_TERMUX_PREFIX_USR_MERGE_FORMAT` can
# be set to `false` and `TERMUX__PREFIX_SUBDIR` could optionally be
# set to an empty string if `TERMUX__ROOTFS` should be equal to
# `TERMUX__PREFIX`, or a custom directory other than `usr`. In this
# case `TERMUX__HOME` can optionally be under `TERMUX__PREFIX`, but
# not be equal to it.
#
# - https://wiki.debian.org/UsrMerge
# - https://lists.debian.org/debian-devel-announce/2019/03/msg00001.html
# - https://dep-team.pages.debian.net/deps/dep17/
#
# If `TERMUX__ROOTFS` is equal to Android/Linux rootfs `/`, then
# `TERMUX__PREFIX_SUBDIR` must not be set to an empty string as
# `TERMUX__PREFIX` must be a subdirectory under rootfs `/`, and must
# not be set to `usr` either or or any other path in
# `TERMUX_REGEX__INVALID_TERMUX_PREFIX_PATHS`. Check the
# `TERMUX_REGEX__INVALID_TERMUX_ROOTFS_PATHS` variable docs for why
# some paths like `/usr`, etc are now allowed.
#
# Basically, the following rules apply for `TERMUX__PREFIX`.
# - If `TERMUX__ROOTFS` is not equal to `/`:
# - If `usr` merge format is enabled:
# - `TERMUX__PREFIX` must be equal to `$TERMUX__ROOTFS/usr`.
# - `TERMUX__PREFIX` must not be equal to `TERMUX__HOME` and
# they must not be under each other.
# - If `usr` merge format is disabled:
# - `TERMUX__PREFIX` must be equal to or be under `$TERMUX__ROOTFS`.
# - `TERMUX__PREFIX` must not be equal to or be under `TERMUX__HOME`.
# - If `TERMUX__ROOTFS` is equal to `/`:
# - If `usr` merge format is enabled or disabled:
# - `TERMUX__PREFIX` must be under `$TERMUX__ROOTFS` and not
# equal to `/usr` or other paths in `TERMUX_REGEX__INVALID_TERMUX_PREFIX_PATHS`.
# - `TERMUX__PREFIX` must not be equal to or be under `TERMUX__HOME`.
#
# The directory set will be deleted by `clean.sh` if not running
# on-device, so make sure a safe path is set if running `clean.sh` in
# Termux docker or host OS build environment.
#
# At runtime, `TERMUX__PREFIX` may be overridden and set to
# `TERMUX__PREFIX_GLIBC` when compiling `glibc` packages by calling
# `termux_build_props__set_termux_prefix_dir_and_sub_variables` in
# `termux_step_setup_variables` if `TERMUX_PACKAGE_LIBRARY` equals `glibc`.
# However, `TERMUX__PREFIX_CLASSICAL` retains the original value
# set below for `TERMUX__PREFIX`.
# - https://github.com/termux/termux-packages/pull/16901
# - https://github.com/termux/termux-packages/pull/20864
#
# Default value: `/data/data/com.termux/files/usr`
##
[[ "$TERMUX__ROOTFS" != "/" ]] && TERMUX__PREFIX="$TERMUX__ROOTFS${TERMUX__PREFIX_SUBDIR:+"/$TERMUX__PREFIX_SUBDIR"}" || \
TERMUX__PREFIX="/$TERMUX__PREFIX_SUBDIR"
__termux_build_props__add_variables_validator_actions "TERMUX__PREFIX" "safe_absolute_path invalid_termux_prefix_paths"
if [[ "$TERMUX__ROOTFS" != "/" ]] && [[ "$__TERMUX_BUILD_PROPS__VALIDATE_TERMUX_PREFIX_USR_MERGE_FORMAT" != "true" ]]; then
__termux_build_props__add_variables_validator_actions "TERMUX__PREFIX" " path_equal_to_or_under_termux_rootfs"
else
__termux_build_props__add_variables_validator_actions "TERMUX__PREFIX" " path_under_termux_rootfs"
fi
TERMUX_PREFIX="$TERMUX__PREFIX" # Deprecated alternative variable for `TERMUX__PREFIX`
##
# The original value for `TERMUX__PREFIX` set above, as `TERMUX__PREFIX`
# can be overridden at runtime, like when compiling `glibc` packages.
# Checks variable docs of `TERMUX__PREFIX` for more info.
#
# Default value: `/data/data/com.termux/files/usr`
##
TERMUX__PREFIX_CLASSICAL="$TERMUX__PREFIX"
TERMUX_PREFIX_CLASSICAL="$TERMUX__PREFIX" # Deprecated alternative variable for `TERMUX__PREFIX_CLASSICAL`
##
# Termux subdirectory path for `TERMUX__PREFIX_GLIBC`.
#
# Default value: `glibc`
##
TERMUX__PREFIX_GLIBC_SUBDIR="glibc"
##
# Termux `glibc` prefix directory path under `TERMUX__PREFIX`
# where all Termux `glibc` packages data is installed.
#
# **See Also:**
# - https://github.com/termux-pacman/glibc-packages
# - https://github.com/termux/glibc-packages (mirror)
#
# Default value: `/data/data/com.termux/files/usr/glibc`
##
TERMUX__PREFIX_GLIBC="$TERMUX__PREFIX/$TERMUX__PREFIX_GLIBC_SUBDIR"
__termux_build_props__add_variables_validator_actions "TERMUX__PREFIX_GLIBC" "safe_absolute_path invalid_termux_prefix_paths path_under_termux_rootfs"
##
# The max length for the `TERMUX__PREFIX` including the null '\0'
# terminator.
#
# Check https://github.com/termux/termux-packages/wiki/Termux-file-system-layout#file-path-limits
# for why the value `90` is chosen.