Add switch for nacl / libsodium
This commit is contained in:
parent
9d70cba6c7
commit
e380438bd3
@ -1,7 +1,7 @@
|
|||||||
diff -up ./node_build/make.js.dyn ./node_build/make.js
|
diff -up ./node_build/make.js.dyn ./node_build/make.js
|
||||||
--- ./node_build/make.js.dyn 2015-11-02 17:59:41.000000000 -0500
|
--- ./node_build/make.js.dyn 2016-01-27 03:07:49.000000000 -0500
|
||||||
+++ ./node_build/make.js 2015-11-04 19:57:49.961155943 -0500
|
+++ ./node_build/make.js 2016-04-18 16:17:04.052719207 -0400
|
||||||
@@ -238,41 +238,9 @@ Builder.configure({
|
@@ -250,41 +250,9 @@ Builder.configure({
|
||||||
|
|
||||||
}).nThen(function (waitFor) {
|
}).nThen(function (waitFor) {
|
||||||
|
|
||||||
@ -40,13 +40,13 @@ diff -up ./node_build/make.js.dyn ./node_build/make.js
|
|||||||
- process.chdir(cwd);
|
- process.chdir(cwd);
|
||||||
- }));
|
- }));
|
||||||
- }));
|
- }));
|
||||||
+ builder.config.libs.push('-lsodium');
|
+ builder.config.libs.push('-lnacl');
|
||||||
+ builder.config.libs.push('-lstdc++');
|
+ builder.config.libs.push('-lstdc++');
|
||||||
+ builder.config.includeDirs.push('/usr/include/sodium/');
|
+ builder.config.includeDirs.push('/usr/include/nacl/');
|
||||||
|
|
||||||
}).nThen(function (waitFor) {
|
}).nThen(function (waitFor) {
|
||||||
|
|
||||||
@@ -411,7 +379,7 @@ Builder.configure({
|
@@ -423,7 +391,7 @@ Builder.configure({
|
||||||
builder.buildExecutable('crypto/random/randombytes.c');
|
builder.buildExecutable('crypto/random/randombytes.c');
|
||||||
|
|
||||||
builder.lintFiles(function (fileName, file, callback) {
|
builder.lintFiles(function (fileName, file, callback) {
|
||||||
|
57
cjdns.sodium.patch
Normal file
57
cjdns.sodium.patch
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
diff -up ./node_build/make.js.dyn ./node_build/make.js
|
||||||
|
--- ./node_build/make.js.dyn 2015-11-02 17:59:41.000000000 -0500
|
||||||
|
+++ ./node_build/make.js 2015-11-04 19:57:49.961155943 -0500
|
||||||
|
@@ -238,41 +238,9 @@ Builder.configure({
|
||||||
|
|
||||||
|
}).nThen(function (waitFor) {
|
||||||
|
|
||||||
|
- builder.config.libs.push(dependencyDir + '/cnacl/jsbuild/libnacl.a');
|
||||||
|
- builder.config.includeDirs.push(dependencyDir + '/cnacl/jsbuild/include/');
|
||||||
|
-
|
||||||
|
- Fs.exists(dependencyDir + '/cnacl/jsbuild/libnacl.a', waitFor(function (exists) {
|
||||||
|
- if (exists) { return; }
|
||||||
|
-
|
||||||
|
- console.log("Build NaCl");
|
||||||
|
- var cwd = process.cwd();
|
||||||
|
- process.chdir(dependencyDir + '/cnacl/');
|
||||||
|
-
|
||||||
|
- var NaCl = require(process.cwd() + '/node_build/make.js');
|
||||||
|
- NaCl.build(function (args, callback) {
|
||||||
|
- if (builder.config.systemName !== 'win32') {
|
||||||
|
- args.unshift('-fPIC');
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- args.unshift(builder.config.optimizeLevel, '-fomit-frame-pointer');
|
||||||
|
-
|
||||||
|
- if (CFLAGS) {
|
||||||
|
- [].push.apply(args, CFLAGS.split(' '));
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- if (!builder.config.crossCompiling) {
|
||||||
|
- if (NO_MARCH_FLAG.indexOf(process.arch) < -1) {
|
||||||
|
- builder.config.cflags.push('-march=native');
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- builder.cc(args, callback);
|
||||||
|
- },
|
||||||
|
- builder.config,
|
||||||
|
- waitFor(function () {
|
||||||
|
- process.chdir(cwd);
|
||||||
|
- }));
|
||||||
|
- }));
|
||||||
|
+ builder.config.libs.push('-lsodium');
|
||||||
|
+ builder.config.libs.push('-lstdc++');
|
||||||
|
+ builder.config.includeDirs.push('/usr/include/sodium/');
|
||||||
|
|
||||||
|
}).nThen(function (waitFor) {
|
||||||
|
|
||||||
|
@@ -411,7 +379,7 @@ Builder.configure({
|
||||||
|
builder.buildExecutable('crypto/random/randombytes.c');
|
||||||
|
|
||||||
|
builder.lintFiles(function (fileName, file, callback) {
|
||||||
|
- if (/dependencies/.test(fileName)) {
|
||||||
|
+ if (/(dependencies|\/usr\/include)/.test(fileName)) {
|
||||||
|
callback('', false);
|
||||||
|
return;
|
||||||
|
}
|
24
cjdns.spec
24
cjdns.spec
@ -3,6 +3,18 @@
|
|||||||
|
|
||||||
# Use the optimized libnacl embedded with cjdns
|
# Use the optimized libnacl embedded with cjdns
|
||||||
%global use_embedded 0
|
%global use_embedded 0
|
||||||
|
# Use libsodium instead of nacl
|
||||||
|
%global use_libsodium 0
|
||||||
|
|
||||||
|
%if 0%{use_libsodium}
|
||||||
|
%global nacl_name libsodium
|
||||||
|
%global nacl_version 1.0.5
|
||||||
|
%global nacl_lib %{_libdir}/libsodium.so
|
||||||
|
%else
|
||||||
|
%global nacl_name nacl
|
||||||
|
%global nacl_version 20110221
|
||||||
|
%global nacl_lib %{_libdir}/libnacl.so
|
||||||
|
%endif
|
||||||
|
|
||||||
%if 0%{?rhel} >= 5 && 0%{?rhel} < 7
|
%if 0%{?rhel} >= 5 && 0%{?rhel} < 7
|
||||||
%global use_systemd 0
|
%global use_systemd 0
|
||||||
@ -70,6 +82,8 @@ Patch8: cjdns.warnings.patch
|
|||||||
Patch9: cjdns.man.patch
|
Patch9: cjdns.man.patch
|
||||||
# Patch some bugs in nodejs tools
|
# Patch some bugs in nodejs tools
|
||||||
Patch10: cjdns.tools.patch
|
Patch10: cjdns.tools.patch
|
||||||
|
# Alternate dynamic library patch to use libsodium
|
||||||
|
Patch11: cjdns.sodium.patch
|
||||||
|
|
||||||
BuildRequires: nodejs, nodejs-ronn
|
BuildRequires: nodejs, nodejs-ronn
|
||||||
|
|
||||||
@ -78,7 +92,7 @@ BuildRequires: make
|
|||||||
|
|
||||||
%if !%{use_embedded}
|
%if !%{use_embedded}
|
||||||
# x86_64 and ARM libnacl are not compiled with -fPIC before Fedora release 11.
|
# x86_64 and ARM libnacl are not compiled with -fPIC before Fedora release 11.
|
||||||
BuildRequires: libsodium-devel >= 1.0.5
|
BuildRequires: %{nacl_name}-devel >= %{nacl_version}
|
||||||
%endif
|
%endif
|
||||||
%if %{use_systemd}
|
%if %{use_systemd}
|
||||||
# systemd macros are not defined unless systemd is present
|
# systemd macros are not defined unless systemd is present
|
||||||
@ -153,8 +167,12 @@ Python graphing tools for cjdns.
|
|||||||
|
|
||||||
%if !%{use_embedded}
|
%if !%{use_embedded}
|
||||||
# use system nacl library if provided.
|
# use system nacl library if provided.
|
||||||
if test -x %{_libdir}/libsodium.so; then
|
if test -x %{nacl_lib}; then
|
||||||
|
%if 0%{use_libsodium}
|
||||||
|
%patch11 -b .sodium
|
||||||
|
%else
|
||||||
%patch6 -b .dyn
|
%patch6 -b .dyn
|
||||||
|
%endif
|
||||||
rm -rf node_build/dependencies/cnacl
|
rm -rf node_build/dependencies/cnacl
|
||||||
# use static library if system nacl doesn't provide dynamic
|
# use static library if system nacl doesn't provide dynamic
|
||||||
elif test -d %{_includedir}/nacl && test -r %{_libdir}/libnacl.a; then
|
elif test -d %{_includedir}/nacl && test -r %{_libdir}/libnacl.a; then
|
||||||
@ -451,6 +469,8 @@ fi
|
|||||||
%changelog
|
%changelog
|
||||||
* Tue Apr 18 2016 Stuart D. Gathman <stuart@gathman.org> 17.3-12
|
* Tue Apr 18 2016 Stuart D. Gathman <stuart@gathman.org> 17.3-12
|
||||||
- Run modprobe only if /dev/tun not present - fixes running on openVZ
|
- Run modprobe only if /dev/tun not present - fixes running on openVZ
|
||||||
|
- Select nacl/libsodium with a macro
|
||||||
|
- Switch back to nacl for platforms that support it
|
||||||
|
|
||||||
* Tue Apr 5 2016 Stuart D. Gathman <stuart@gathman.org> 17.3-11
|
* Tue Apr 5 2016 Stuart D. Gathman <stuart@gathman.org> 17.3-11
|
||||||
- Patch some bugs in traceroute and symlink to /usr/bin/cjdns-traceroute
|
- Patch some bugs in traceroute and symlink to /usr/bin/cjdns-traceroute
|
||||||
|
Loading…
Reference in New Issue
Block a user