nixpkgs/pkgs/by-name/li/lib25519/environment-variable-tools.patch
Jack Leightcap c8dfaee895
lib25519: init at 20240321 (#319618)
* init: lib25519 at 20240321

Signed-off-by: Jack Leightcap <jack@leightcap.com>

* Add installCheckPhase to lib25519

* Set platforms for lib25519, libcpucycles and librandombytes

* Fixed patch for libcpucycles

* lib25519: remove openssl unneeded variable

* lib25519: patch scripts to pull toolchain from environment variables

* librandombytes: add regression test script

* lib25519: checkpoint for successful cross-compile

* testing without binfmt

* compilation for arm64 without cross compiling

* compilation for x86 that creates a x86 binary

* lib25519: replace compiler command to fix cross- and native compiling

* librandombytes, lib25519: cleanup

* crosstest.sh: drop

---------

Signed-off-by: Jack Leightcap <jack@leightcap.com>
Co-authored-by: Roland Coeurjoly <rolandcoeurjoly@gmail.com>
Co-authored-by: imad.nyc <me@imad.nyc>
Co-authored-by: Enric Morales <me@enric.me>
Co-authored-by: Alberto Merino Risueño <Alberto.Merino@uclm.es>
Co-authored-by: Weijia Wang <9713184+wegank@users.noreply.github.com>
2024-07-16 12:27:18 +02:00

49 lines
1.7 KiB
Diff

diff --git a/configure b/configure
index 04042b2..30d1ea9 100755
--- a/configure
+++ b/configure
@@ -210,6 +210,17 @@ for arch in sorted(os.listdir('compilers')):
with open('compilers/%s' % arch) as f:
for c in f.readlines():
c = c.strip()
+ if env_cc := os.getenv('CC'):
+ c_as_list= c.split()
+ # check if the compiler we're testing has the name inside the last
+ # part of the CC env var
+ # i.e. gcc == x86_64-linux-unknown-gnu-gcc
+ # or gcc == gcc
+ if c_as_list[0] == env_cc.split("-")[-1]:
+ c_as_list[0] = env_cc
+ c = ' '.join(c_as_list)
+ log('patched command as %s' % c)
+
cv = compilerversion(c)
if cv == None:
log('skipping %s compiler %s' % (arch,c))
diff --git a/scripts-build/checknamespace b/scripts-build/checknamespace
index ae11bed..bd9cb85 100755
--- a/scripts-build/checknamespace
+++ b/scripts-build/checknamespace
@@ -36,7 +36,7 @@ def doit(d):
obj2U = {}
try:
- p = subprocess.Popen(['nm','-ApP']+objs,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,universal_newlines=True)
+ p = subprocess.Popen([os.getenv('NM', 'nm'),'-ApP']+objs,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,universal_newlines=True)
out,err = p.communicate()
except Exception as e:
warn('nm failure: %s' % e)
diff --git a/scripts-build/staticlib b/scripts-build/staticlib
index 7683233..0445bc3 100755
--- a/scripts-build/staticlib
+++ b/scripts-build/staticlib
@@ -3,6 +3,6 @@
lib="$1"
rm -f package/lib/"$lib".a
-ar cr package/lib/"$lib".a ofiles/*.o
-ranlib package/lib/"$lib".a || :
+${AR:-ar} cr package/lib/"$lib".a ofiles/*.o
+${RANLIB:-ranlib} package/lib/"$lib".a || :
chmod 644 package/lib/"$lib".a