From 6f5bd96ed836ad26b9c4ab6ad9ecc81e28622736 Mon Sep 17 00:00:00 2001 From: Neven Sajko Date: Tue, 7 Jan 2020 20:49:26 +0100 Subject: [PATCH] all: sync and dedup the creation of the SYSNAME and OBJTYPE env vars (#321) This should prevent the issues of dist/buildmk and src/mkhdr getting out of synchronization yet again. I also add a rule for arm64 to the OBJTYPE sed command. Fixes #243 Fixes #320 Change-Id: I60f69a1f32b5ed5ae5ac8a1659c38e29debed005 --- buildEnvironmentVariables | 19 +++++++++++++++++++ dist/buildmk | 19 ++----------------- src/mkhdr | 20 +------------------- 3 files changed, 22 insertions(+), 36 deletions(-) create mode 100644 buildEnvironmentVariables diff --git a/buildEnvironmentVariables b/buildEnvironmentVariables new file mode 100644 index 000000000..f6de1e350 --- /dev/null +++ b/buildEnvironmentVariables @@ -0,0 +1,19 @@ +SYSNAME=`uname` +OBJTYPE=`(uname -m -p 2>/dev/null || uname -m) | sed ' + s;.*i[3-6]86.*;386;; + s;.*i86pc.*;386;; + s;.*amd64.*;x86_64;; + s;.*x86_64.*;x86_64;; + s;.*armv.*;arm;g; + s;.*powerpc.*;power;g; + s;.*PowerMacintosh.*;power;g; + s;.*Power.Macintosh.*;power;g; + s;.*macppc.*;power;g; + s;.*mips.*;mips;g; + s;.*ppc64.*;power;g; + s;.*ppc.*;power;g; + s;.*alpha.*;alpha;g; + s;.*sun4u.*;sun4u;g; + s;.*aarch64.*;arm64; + s;.*arm64.*;arm64; +'` diff --git a/dist/buildmk b/dist/buildmk index 07b223aca..6be4ba50f 100755 --- a/dist/buildmk +++ b/dist/buildmk @@ -1,21 +1,6 @@ #!/bin/sh # run this in the src directory -SYSNAME=`uname` export SYSNAME -OBJTYPE=`(uname -m -p 2>/dev/null || uname -m) | sed ' - s;.*i[3-6]86.*;386;; - s;.*i86pc.*;386;; - s;.*amd64.*;x86_64;; - s;.*x86_64.*;x86_64;; - s;.*armv.*;arm;g; - s;.*powerpc.*;power;g; - s;.*PowerMacintosh.*;power;g; - s;.*Power.Macintosh.*;power;g; - s;.*macppc.*;power;g; - s;.*mips.*;mips;g; - s;.*ppc64.*;power;g; - s;.*ppc.*;power;g; - s;.*alpha.*;alpha;g; - s;.*sun4u.*;sun4u;g; -'` export OBJTYPE +export SYSNAME OBJTYPE +. ../buildEnvironmentVariables sh -x mkmk.sh diff --git a/src/mkhdr b/src/mkhdr index 1c3f20af2..03447df93 100644 --- a/src/mkhdr +++ b/src/mkhdr @@ -1,22 +1,4 @@ -# if you change this, also edit ../dist/buildmk -SYSNAME=`uname` -OBJTYPE=`(uname -m -p 2>/dev/null || uname -m) | sed ' - s;.*i[3-6]86.*;386;; - s;.*i86pc.*;386;; - s;.*amd64.*;x86_64;; - s;.*x86_64.*;x86_64;; - s;.*armv.*;arm;g; - s;.*powerpc.*;power;g; - s;.*PowerMacintosh.*;power;g; - s;.*Power.Macintosh.*;power;g; - s;.*macppc.*;power;g; - s;.*mips.*;mips;g; - s;.*ppc64.*;power;g; - s;.*ppc.*;power;g; - s;.*alpha.*;alpha;g; - s;.*sun4u.*;sun4u;g; - s;.*aarch64.*;arm64; -'` +<$PLAN9/buildEnvironmentVariables BIN=$PLAN9/bin LIBDIR=$PLAN9/lib