-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.macOS
executable file
·73 lines (65 loc) · 4.04 KB
/
Makefile.macOS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Program parameters
NAME = "Tor Proxy"
VERSION = "1.0.6"
CC = "g++"
STRIP = "strip"
CFLAGS = -I "./openssl/dist/include" -I "./libevent" -I "./libevent/dist/include" -I "./tor" -I "./tor/src" -O3 -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -std=c++17 -finput-charset=UTF-8 -fexec-charset=UTF-8 -funsigned-char -ffunction-sections -fdata-sections -D PROGRAM_NAME=$(NAME) -D PROGRAM_VERSION=$(VERSION)
LIBS = -L "./openssl/dist/lib" -L "./libevent/dist/lib" -L "./zlib/dist/lib" -L "./tor" -ltor -levent -levent_openssl -levent_pthreads -lssl -lcrypto "./zlib/dist/lib/libz.a" -lpthread
SRCS = "./main.cpp"
PROGRAM_NAME = $(subst $\",,$(NAME))
# Make
all:
$(CC) $(CFLAGS) -o "./$(PROGRAM_NAME)" $(SRCS) $(LIBS)
$(STRIP) "./$(PROGRAM_NAME)"
# Make clean
clean:
rm -rf "./$(PROGRAM_NAME)" "./openssl-3.1.3.tar.gz" "./openssl-3.1.3" "./openssl" "./libevent-2.2.1-alpha-dev.tar.gz" "./libevent-2.2.1-alpha-dev" "./libevent" "./zlib-1.3.tar.gz" "./zlib-1.3" "./zlib" "./tor-tor-0.4.8.7.zip" "./tor-tor-0.4.8.7" "./tor" "./autoconf-2.71.tar.gz" "./autoconf-2.71" "./automake-1.16.5.tar.gz" "./automake-1.16.5" "./libtool-2.4.7.tar.gz" "./libtool-2.4.7" "./pkg-config-0.29.2.tar.gz" "./pkg-config-0.29.2"
# Make run
run:
"./$(PROGRAM_NAME)"
# Make dependencies
dependencies:
# OpenSSL
curl -f -LOk "https://github.com/openssl/openssl/releases/download/openssl-3.1.3/openssl-3.1.3.tar.gz"
tar -xf "./openssl-3.1.3.tar.gz"
rm "./openssl-3.1.3.tar.gz"
mv "./openssl-3.1.3" "./openssl"
cd "./openssl" && "./Configure" --prefix="$(CURDIR)/openssl/dist" --openssldir="/etc/ssl" --libdir=lib --release no-shared darwin64-x86_64-cc && make && make install || true
# Libevent
curl -f -LOk "https://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.gz"
tar -xf "./autoconf-2.71.tar.gz"
rm "./autoconf-2.71.tar.gz"
cd "./autoconf-2.71" && "./configure" && make && sudo make install
sudo rm -r "./autoconf-2.71"
curl -f -LOk "https://ftp.gnu.org/gnu/automake/automake-1.16.5.tar.gz"
tar -xf "./automake-1.16.5.tar.gz"
rm "./automake-1.16.5.tar.gz"
cd "./automake-1.16.5" && "./configure" && make && sudo make install
sudo rm -r "./automake-1.16.5"
curl -f -LOk "https://mirrors.kernel.org/gnu/libtool/libtool-2.4.7.tar.gz"
tar -xf "./libtool-2.4.7.tar.gz"
rm "./libtool-2.4.7.tar.gz"
cd "./libtool-2.4.7" && "./configure" && make && sudo make install
sudo rm -r "./libtool-2.4.7"
curl -f -LOk "https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz"
tar -xf "./pkg-config-0.29.2.tar.gz"
rm "./pkg-config-0.29.2.tar.gz"
cd "./pkg-config-0.29.2" && "./configure" --with-internal-glib CFLAGS="Wno-int-conversion" && make && sudo make install
sudo rm -r "./pkg-config-0.29.2"
curl -f -LOk "https://github.com/libevent/libevent/releases/download/release-2.2.1-alpha/libevent-2.2.1-alpha-dev.tar.gz"
tar -xf "./libevent-2.2.1-alpha-dev.tar.gz"
rm "./libevent-2.2.1-alpha-dev.tar.gz"
mv "./libevent-2.2.1-alpha-dev" "./libevent"
cd "./libevent" && "./autogen.sh" && "./configure" --prefix="$(CURDIR)/libevent/dist" --disable-debug-mode --disable-shared CPPFLAGS="-I../openssl/dist/include" LDFLAGS="-L../openssl/dist/lib" --disable-libevent-regress && make && make install
# Zlib
curl -f -LOk "https://github.com/madler/zlib/releases/download/v1.3/zlib-1.3.tar.gz"
tar -xf "./zlib-1.3.tar.gz"
rm "./zlib-1.3.tar.gz"
mv "./zlib-1.3" "./zlib"
cd "./zlib" && "./configure" --prefix="$(CURDIR)/zlib/dist" --static && make && make install
# Tor
curl -f -LOk "https://gitlab.torproject.org/tpo/core/tor/-/archive/tor-0.4.8.7/tor-tor-0.4.8.7.zip"
unzip "./tor-tor-0.4.8.7.zip"
rm "./tor-tor-0.4.8.7.zip"
mv "./tor-tor-0.4.8.7" "./tor"
cd "./tor" && "./autogen.sh" && "./configure" --enable-static-openssl --with-openssl-dir="$(CURDIR)/openssl/dist" --enable-static-libevent --with-libevent-dir="$(CURDIR)/libevent/dist" --enable-static-zlib --with-zlib-dir="$(CURDIR)/zlib/dist" --disable-module-relay --disable-module-dirauth --disable-asciidoc --disable-system-torrc --disable-nss --disable-systemd --disable-lzma --disable-zstd --disable-seccomp --disable-libscrypt && make