aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-05-29 16:56:12 +0000
committermerakor <cem@ckyln.com>2020-05-29 16:56:12 +0000
commit705b8d5a326d67c2829421695cb14a2877104bc4 (patch)
tree6ca75245f913af647cef5e0ebc4ef8544b58e746 /contrib
parente48ca12bb5a1a211717bd62659d3e588f930caa5 (diff)
downloadcpt-705b8d5a326d67c2829421695cb14a2877104bc4.tar.gz
kiss-chroot: set CFLAGS based on architecture
FossilOrigin-Name: 12f1d250af19b5a8245d49e11025a1a571d2be63b7eeb19b3004b2009721c022
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/kiss-chroot12
1 files changed, 10 insertions, 2 deletions
diff --git a/contrib/kiss-chroot b/contrib/kiss-chroot
index 9caa4cf..47a2636 100755
--- a/contrib/kiss-chroot
+++ b/contrib/kiss-chroot
@@ -29,6 +29,14 @@ main() {
[ -d "$1" ] || die Given path does not exist
[ "$(id -u)" = 0 ] || die Script needs to be run as root
+ [ "$2" ] || {
+ march=$(uname -m 2>/dev/null) ||:
+ case "$march" in
+ '') march=native ;;
+ i*86) march=i686 ;;
+ esac
+ }
+
trap 'clean "$1"' EXIT INT
log Mounting /dev, /proc and /sys from host; {
@@ -49,8 +57,8 @@ main() {
SHELL=/bin/sh \
USER=root \
KISS_ASROOT=1 \
- CFLAGS="${2:--march=x86-64 -mtune=generic -pipe -Os}" \
- CXXFLAGS="${2:--march=x86-64 -mtune=generic -pipe -Os}" \
+ CFLAGS="${2:--march=$march -mtune=generic -pipe -Os}" \
+ CXXFLAGS="${2:--march=$march -mtune=generic -pipe -Os}" \
MAKEFLAGS="-j$(nproc 2>/dev/null || echo 1)" \
/bin/sh -l
}