Skip to content

Commit cf0131f

Browse files
committed
MacOSX build fixes.
1 parent 42547cf commit cf0131f

File tree

4 files changed

+27
-7
lines changed

4 files changed

+27
-7
lines changed

Makefile.macosx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
CC = clang
22
STRIP = strip
3-
OBJS = pseudo_node.o sha256.o
4-
CFLAGS = -std=gnu99 -DMACOSX -O2 -Wall -Wno-unused-value
5-
CLIBS = -lpthread
3+
OBJS = pseudo_node.o
4+
CFLAGS = -std=gnu99 -DMACOSX -O2 -Wall -Wno-unused-value -fpic
5+
CLIBS = -lpthread -ldl -Wl,-rpath -Wl,.
66

7-
pseudonode: $(OBJS)
8-
$(CC) $(CFLAGS) -o pseudonode $(OBJS) $(CLIBS)
7+
pseudonode: libpseudonode.dylib main.o
8+
$(CC) $(CFLAGS) -o pseudonode main.o $(CLIBS) -L. libpseudonode.dylib
99
$(STRIP) pseudonode
1010
cp pseudonode pseudonode.macosx
1111

12+
libpseudonode.dylib: $(OBJS)
13+
$(CC) -shared -o libpseudonode.dylib $(OBJS)
14+
1215
clean:
13-
rm -f $(OBJS) pseduonode
16+
rm -f $(OBJS) main.o
1417

apps/txmon/Makefile.macosx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ CC = clang
22
STRIP = strip
33
OBJS = txmon.o
44
CFLAGS = -std=gnu99 -DLINUX -I../../ -O2 -Wall -Wno-unused-value -fpic
5-
CLIBS = -L ../../ -lpseudonode -lpthread -ldl -Wl,-R.
5+
CLIBS = -L ../../ -lpseudonode -lpthread -ldl -Wl,-rpath -Wl,.
66

77
txmon: txmon.o
88
$(CC) $(CFLAGS) -o txmon $(OBJS) $(CLIBS)

apps/txmon/txmon.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,10 @@ int main(int argc, char **argv)
898898
if (!isatty(1))
899899
option_color = false;
900900

901+
#ifdef LINUX
902+
signal(SIGPIPE, SIG_IGN);
903+
#endif
904+
901905
struct PN_callbacks CALLBACKS;
902906
memset(&CALLBACKS, 0, sizeof(CALLBACKS));
903907
CALLBACKS.tx = tx_callback;

main.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,18 @@
3939
#include <setjmp.h>
4040
#include <getopt.h>
4141

42+
#ifdef MACOSX
43+
#define LINUX
44+
#endif
45+
4246
#ifdef LINUX
4347
#include <pwd.h>
4448
#include <arpa/inet.h>
49+
50+
#ifdef MACOSX
51+
#define s6_addr16 __u6_addr.__u6_addr16
52+
#endif
53+
4554
#endif /* LINUX */
4655

4756
#ifdef WINDOWS
@@ -234,6 +243,10 @@ int main(int argc, char **argv)
234243
return EXIT_FAILURE;
235244
}
236245

246+
#ifdef LINUX
247+
signal(SIGPIPE, SIG_IGN);
248+
#endif
249+
237250
struct PN_config CONFIG;
238251
memset(&CONFIG, 0, sizeof(CONFIG));
239252
CONFIG.user_agent = USER_AGENT;

0 commit comments

Comments
 (0)