Skip to content

Commit

Permalink
directly use dnscrypt-proxy source to build libevent/libnacl
Browse files Browse the repository at this point in the history
it is easy to do
  • Loading branch information
cofyc committed Nov 20, 2012
1 parent f56d357 commit dd8330e
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 23 deletions.
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,4 @@
*.out
*~
/tags
/libnacl/.done
/libnacl/build/
/dnscrypt-wrapper
/libevent/*.lo
/libevent/*.la
/libevent/sample/
/libevent/test/
/libevent/.libs/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "argparse"]
path = argparse
url = [email protected]:Cofyc/argparse.git
[submodule "dnscrypt-proxy"]
path = dnscrypt-proxy
url = git://github.com/opendns/dnscrypt-proxy.git
28 changes: 14 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,39 @@ CC = cc
RM = rm -rf

EXTRA_CFLAGS = # dynamically added/remoted
CFLAGS = -O2 -std=c99 -pedantic -Wall $(EXTRA_CFLAGS) -Ilibevent/include -Ilibnacl/build/localhost/include/local
CFLAGS = -O2 -std=c99 -pedantic -Wall $(EXTRA_CFLAGS) -Idnscrypt-proxy/src/libevent/include -Idnscrypt-proxy/src/libnacl/build/localhost/include/local -lrt
LDFLAGS = -lm
PREFIX = /usr/local
BINDIR = $(PREFIX)/bin

LIB_H = dnscrypt.h udp_request.h edns.h argparse/argparse.h logger.h
LIB_H = dnscrypt.h udp_request.h edns.h logger.h

LIB_OBJS += dnscrypt.o
LIB_OBJS += udp_request.o
LIB_OBJS += edns.o
LIB_OBJS += logger.o
LIB_OBJS += main.o
LIB_OBJS += rfc1035.o
LIB_OBJS += argparse/argparse.o
LIB_OBJS += salsa20_random.o
LIB_OBJS += safe_rw.o
LIB_OBJS += cert.o

LDADD += libnacl/build/localhost/lib/local/libnacl.a
LDADD += libevent/.libs/libevent.a
LDADD += argparse/argparse.o
LDADD += dnscrypt-proxy/src/libnacl/build/localhost/lib/local/libnacl.a
LDADD += dnscrypt-proxy/src/libevent/.libs/libevent.a

version.h:
./gen-version.sh > version.h

argparse/.git:
argparse/argparse.h:
@git submodule update --init

argparse/argparse.o: argparse/.git
argparse/argparse.o: argparse/argparse.h
@make -C argparse argparse.o

libnacl/build/localhost/lib/local/libnacl.a:
@make -C libnacl

libevent/.libs/libevent.a:
@make -C libevent
dnscrypt-proxy/src/libnacl/build/localhost/lib/local/libnacl.a:
dnscrypt-proxy/src/libevent/.libs/libevent.a:
@cd dnscrypt-proxy && ./autogen.sh && ./configure && make

$(LIB_OBJS): $(LIB_H)

Expand All @@ -58,7 +56,9 @@ uninstall:

clean:
$(RM) dnscrypt-wrapper
$(RM) *.o
$(RM) libnacl/.done
$(RM) $(LIB_OBJS)

clean-all: clean
cd dnscrypt-proxy; make clean

.PHONY: all install uninstall clean test
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Only udp protocol is supported now, tcp is work in progress.
INSTALLATION
============

$ git clone git://github.com/Cofyc/dnscrypt-wrapper.git
$ make
$ make install

Expand Down
3 changes: 3 additions & 0 deletions compat.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef COMPAT_H
#define COMPAT_H

#define _GNU_SOURCE

/* ISO C */
#include <assert.h>
#include <complex.h>
Expand Down Expand Up @@ -34,6 +36,7 @@
#include <uuid/uuid.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <arpa/inet.h>

#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[1]))
#define COMPILER_ASSERT(X) (void) sizeof(char[(X) ? 1 : -1])
Expand Down
1 change: 1 addition & 0 deletions dnscrypt-proxy
Submodule dnscrypt-proxy added at 88ec48
2 changes: 1 addition & 1 deletion logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void
logger_lograw(int priority, const char *msg)
{
FILE *fp;
const char *priority_flag;
const char *priority_flag = NULL;

if (priority > logger_verbosity)
return;
Expand Down
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ static int
write_to_file(const char *path, char *buf, size_t count)
{
int fd;
fd = open(path, O_WRONLY | O_CREAT);
fd = open(path, O_WRONLY | O_CREAT, 0444);
if (fd < 0) {
printf("Cannnot open %s to write.\n", path);
return -1;
Expand Down

0 comments on commit dd8330e

Please sign in to comment.