nixpkgs/pkgs/by-name/li/libcpucycles/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

59 lines
1.5 KiB
Diff

diff --git a/configure b/configure
index 87d5c14..5e2a1a4 100755
--- a/configure
+++ b/configure
@@ -112,21 +112,26 @@ def compilerversion(c):
except:
pass
-firstcompiler = None
-
-with open('compilers/default') as f:
- for c in f.readlines():
- c = c.strip()
- cv = compilerversion(c)
- if cv == None:
- print('skipping default compiler %s' % c)
- continue
- print('using default compiler %s' % c)
- firstcompiler = c
- break
-
-if firstcompiler is None:
- raise ValueError('did not find a working compiler')
+if c := os.getenv("CC"):
+ firstcompiler = c
+ print('using default compiler %s' % c)
+else:
+ firstcompiler = None
+
+ with open('compilers/default') as f:
+ for c in f.readlines():
+ c = c.strip()
+ cv = compilerversion(c)
+ if cv == None:
+ print('skipping default compiler %s' % c)
+ continue
+ print('using default compiler %s' % c)
+ firstcompiler = c
+ break
+
+ if firstcompiler is None:
+ raise ValueError('did not find a working compiler')
+
with open('build/%s/scripts/compiledefault' % host,'w') as f:
f.write('#!/bin/sh\n')
diff --git a/scripts-build/staticlib b/scripts-build/staticlib
index bb23658..111ab13 100755
--- a/scripts-build/staticlib
+++ b/scripts-build/staticlib
@@ -1,6 +1,6 @@
#!/bin/sh
rm -f package/lib/libcpucycles.a
-ar cr package/lib/libcpucycles.a "$@"
-ranlib package/lib/libcpucycles.a || :
+${AR:-ar} cr package/lib/libcpucycles.a "$@"
+${RANLIB:-ranlib} package/lib/libcpucycles.a || :
chmod 644 package/lib/libcpucycles.a