From b976e79b0fbcf1d9be305841f0ebcab0af44f6f1 Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Fri, 5 Dec 2014 13:51:02 -0500 Subject: [PATCH] Fix some mpw.c link errors. [FIXED] Libraries should be specified after the objects that need them for some compilers apparently.. [FIXED] bool type requires stdbool.h, disable more color code when COLOR not defined. [UPDATED] Disable mpw_color by default as it doesn't link cleanly on some Linux'es for now.. --- MasterPassword/C/build | 20 ++++++++++---------- MasterPassword/C/types.c | 3 +++ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/MasterPassword/C/build b/MasterPassword/C/build index d9cdf19c..6e6271c2 100755 --- a/MasterPassword/C/build +++ b/MasterPassword/C/build @@ -38,7 +38,7 @@ else fi # Optional features. -mpw_color=1 # Colorized Identicon, requires libncurses-dev +mpw_color=0 # Colorized Identicon, requires libncurses-dev ### DEPENDENCIES @@ -200,10 +200,6 @@ mpw() { -I"lib/scrypt/lib" -I"lib/scrypt/libcperciva" ) LDFLAGS=( - # library paths - -L"." -L"lib/scrypt" - # link libraries - -l"crypto" # scrypt "lib/scrypt/scrypt-crypto_aesctr.o" "lib/scrypt/scrypt-sha256.o" @@ -211,6 +207,10 @@ mpw() { "lib/scrypt/scrypt-memlimit.o" "lib/scrypt/scrypt-scryptenc_cpuperf.o" "lib/scrypt/scrypt-scryptenc.o" + # library paths + -L"." -L"lib/scrypt" + # link libraries + -l"crypto" ) # optional features (( mpw_color )) && CFLAGS+=( -DCOLOR ) LDFLAGS+=( -l"curses" ) @@ -234,11 +234,6 @@ mpw-bench() { -I"lib/bcrypt" ) LDFLAGS=( - # library paths - -L"." -L"lib/scrypt" - -L"lib/bcrypt" - # libraries - -l"crypto" # scrypt "lib/scrypt/scrypt-crypto_aesctr.o" "lib/scrypt/scrypt-sha256.o" @@ -251,6 +246,11 @@ mpw-bench() { "lib/bcrypt/crypt_gensalt.o" "lib/bcrypt/wrapper.o" "lib/bcrypt/x86.o" + # library paths + -L"." -L"lib/scrypt" + -L"lib/bcrypt" + # libraries + -l"crypto" ) cc "${CFLAGS[@]}" -c types.c -o types.o "$@" diff --git a/MasterPassword/C/types.c b/MasterPassword/C/types.c index 7e33914c..471259fe 100644 --- a/MasterPassword/C/types.c +++ b/MasterPassword/C/types.c @@ -6,6 +6,7 @@ // Copyright (c) 2012 Lyndir. All rights reserved. // +#include #include #include #include @@ -198,6 +199,7 @@ const char *Hex(const void *buf, size_t length) { return id; } +#ifdef COLOR int putvari; char *putvarc = NULL; bool istermsetup = false; @@ -214,6 +216,7 @@ static int putvar(int c) { putvarc[putvari++]=c; return 0; } +#endif const char *Identicon(const char *userName, const char *masterPassword) { const char *leftArm[] = { "╔", "╚", "╰", "═" };