1diff --git a/Makefile b/Makefile
2index fba4e6a1..ceff4f3d 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -57,11 +57,7 @@ endif
6
7 export MAKEOPT=-j ${NPROCS}
8
9-ifeq ($(wildcard /usr/lib/systemd/system), /usr/lib/systemd/system)
10- SYSTEMD=1
11-else
12- SYSTEMD=0
13-endif
14+SYSTEMD=1
15 USERCHECK := $(shell getent passwd proxysql)
16 GROUPCHECK := $(shell getent group proxysql)
17
18@@ -724,16 +720,10 @@ cleanbuild:
19
20 .PHONY: install
21 install: src/proxysql
22- install -m 0755 src/proxysql /usr/bin
23- install -m 0600 etc/proxysql.cnf /etc
24- if [ ! -d /var/lib/proxysql ]; then mkdir /var/lib/proxysql ; fi
25-ifeq ($(findstring proxysql,$(USERCHECK)),)
26- @echo "Creating proxysql user and group"
27- useradd -r -U -s /bin/false proxysql
28-endif
29+ install -m 0755 src/proxysql $(out)/bin
30+ install -m 0600 etc/proxysql.cnf $(out)/etc
31 ifeq ($(SYSTEMD), 1)
32- install -m 0644 systemd/system/proxysql.service /usr/lib/systemd/system/
33- systemctl enable proxysql.service
34+ install -m 0644 systemd/system/proxysql.service $(out)/lib/systemd/system/
35 else
36 install -m 0755 etc/init.d/proxysql /etc/init.d
37 ifeq ($(DISTRO),"CentOS Linux")
38diff --git a/deps/Makefile b/deps/Makefile
39index 13eed9c5..9abb2262 100644
40--- a/deps/Makefile
41+++ b/deps/Makefile
42@@ -65,18 +65,11 @@ endif
43
44
45 libinjection/libinjection/src/libinjection.a:
46- cd libinjection && rm -rf libinjection-*/ || true
47- cd libinjection && tar -zxf libinjection-3.10.0.tar.gz
48-ifneq ($(CENTOSVER),6)
49- cd libinjection/libinjection && patch -p1 < ../update-build-py3.diff
50-endif
51 sed -i 's/CC=/CC?=/' libinjection/libinjection/src/Makefile
52 cd libinjection/libinjection && CC=${CC} CXX=${CXX} ${MAKE}
53 libinjection: libinjection/libinjection/src/libinjection.a
54
55 libssl/openssl/libssl.a:
56- cd libssl && rm -rf openssl-openssl-*/ openssl-3*/ || true
57- cd libssl && tar -zxf openssl-*.tar.gz
58 cd libssl/openssl && patch crypto/ec/curve448/curve448.c < ../curve448.c-multiplication-overflow.patch
59 cd libssl/openssl && patch crypto/asn1/a_time.c < ../a_time.c-multiplication-overflow.patch
60 cd libssl/openssl && ./config no-ssl3 no-tests
61@@ -93,8 +86,6 @@ ifeq ($(MIN_VERSION),$(lastword $(sort $(GCC_VERSION) $(MIN_VERSION))))
62 endif
63
64 libhttpserver/libhttpserver/build/src/.libs/libhttpserver.a: libmicrohttpd/libmicrohttpd/src/microhttpd/.libs/libmicrohttpd.a re2/re2/obj/libre2.a
65- cd libhttpserver && rm -rf libhttpserver-*/ || true
66- cd libhttpserver && tar -zxf libhttpserver-0.18.1.tar.gz
67 ifeq ($(REQUIRE_PATCH), true)
68 cd libhttpserver/libhttpserver && patch src/httpserver/basic_auth_fail_response.hpp < ../basic_auth_fail_response.hpp.patch
69 cd libhttpserver/libhttpserver && patch src/httpserver/create_webserver.hpp < ../create_webserver.hpp.patch
70@@ -117,34 +108,16 @@ endif
71 libhttpserver: libhttpserver/libhttpserver/build/src/.libs/libhttpserver.a
72
73 libev/libev/.libs/libev.a:
74- cd libev && rm -rf libev-*/ || true
75- cd libev && tar -zxf libev-4.24.tar.gz
76 cd libev/libev && patch ev.c < ../ev.c-multiplication-overflow.patch
77 cd libev/libev && ./configure
78 cd libev/libev && CC=${CC} CXX=${CXX} ${MAKE}
79 ev: libev/libev/.libs/libev.a
80
81 curl/curl/lib/.libs/libcurl.a: libssl/openssl/libssl.a
82- cd curl && rm -rf curl-*/ || true
83- cd curl && tar -zxf curl-*.tar.gz
84- #cd curl/curl && ./configure --disable-debug --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual --disable-ipv6 --disable-sspi --disable-crypto-auth --disable-ntlm-wb --disable-tls-srp --without-nghttp2 --without-libidn2 --without-libssh2 --without-brotli --with-ssl=$(shell pwd)/../../libssl/openssl/ && CC=${CC} CXX=${CXX} ${MAKE}
85 cd curl/curl && CFLAGS=-fPIC ./configure --disable-debug --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual --disable-ipv6 --disable-sspi --disable-ntlm-wb --disable-tls-srp --without-nghttp2 --without-libidn2 --without-libssh2 --without-brotli --without-librtmp --without-libpsl --without-zstd --with-ssl=$(shell pwd)/libssl/openssl/ --enable-shared=no && CC=${CC} CXX=${CXX} ${MAKE}
86 curl: curl/curl/lib/.libs/libcurl.a
87
88 libmicrohttpd/libmicrohttpd/src/microhttpd/.libs/libmicrohttpd.a:
89- cd libmicrohttpd && rm -rf libmicrohttpd-*/ || true
90- cd libmicrohttpd && rm -f libmicrohttpd || true
91-ifeq ($(CENTOSVER),6)
92- cd libmicrohttpd && ln -s libmicrohttpd-0.9.55 libmicrohttpd
93- cd libmicrohttpd && tar -zxf libmicrohttpd-0.9.55.tar.gz
94-else
95- cd libmicrohttpd && ln -s libmicrohttpd-0.9.68 libmicrohttpd
96- cd libmicrohttpd && tar -zxf libmicrohttpd-0.9.68.tar.gz
97- cd libmicrohttpd/libmicrohttpd && patch src/microhttpd/connection.c < ../connection.c-snprintf-overflow.patch
98-endif
99-ifeq ($(OS),Darwin)
100- cd libmicrohttpd/libmicrohttpd && patch src/microhttpd/mhd_sockets.c < ../mhd_sockets.c-issue-5977.patch
101-endif
102 cd libmicrohttpd/libmicrohttpd && ./configure --enable-https && CC=${CC} CXX=${CXX} ${MAKE}
103 microhttpd: libmicrohttpd/libmicrohttpd/src/microhttpd/.libs/libmicrohttpd.a
104
105@@ -155,8 +128,6 @@ cityhash/cityhash/src/.libs/libcityhash.a:
106 cityhash: cityhash/cityhash/src/.libs/libcityhash.a
107
108 lz4/lz4/liblz4.a:
109- cd lz4 && rm -rf lz4-*/ || true
110- cd lz4 && tar -zxf lz4-1.7.5.tar.gz
111 cd lz4/lz4 && CC=${CC} CXX=${CXX} ${MAKE}
112 lz4: lz4/lz4/liblz4.a
113
114@@ -181,8 +152,6 @@ clickhouse-cpp: clickhouse-cpp/clickhouse-cpp/clickhouse/libclickhouse-cpp-lib-s
115
116
117 libdaemon/libdaemon/libdaemon/.libs/libdaemon.a:
118- cd libdaemon && rm -rf libdaemon-*/ || true
119- cd libdaemon && tar -zxf libdaemon-0.14.tar.gz
120 cd libdaemon/libdaemon && cp ../config.guess . && chmod +x config.guess && ./configure --disable-examples
121 cd libdaemon/libdaemon && CC=${CC} CXX=${CXX} ${MAKE}
122
123@@ -253,17 +222,12 @@ sqlite3/sqlite3/sqlite3.o:
124 sqlite3: sqlite3/sqlite3/sqlite3.o
125
126 libconfig/libconfig/lib/.libs/libconfig++.a:
127- cd libconfig && rm -rf libconfig-*/ || true
128- cd libconfig && tar -zxf libconfig-1.7.2.tar.gz
129 cd libconfig/libconfig && ./configure --disable-examples
130 cd libconfig/libconfig && CC=${CC} CXX=${CXX} ${MAKE}
131
132 libconfig: libconfig/libconfig/lib/.libs/libconfig++.a
133
134 prometheus-cpp/prometheus-cpp/lib/libprometheus-cpp-core.a:
135- cd prometheus-cpp && rm -rf prometheus-cpp-*/ || true
136- cd prometheus-cpp && tar -zxf v0.9.0.tar.gz
137- cd prometheus-cpp && tar --strip-components=1 -zxf civetweb-v1.11.tar.gz -C prometheus-cpp/3rdparty/civetweb
138 cd prometheus-cpp/prometheus-cpp && patch -p1 < ../serial_exposer.patch
139 cd prometheus-cpp/prometheus-cpp && patch -p0 < ../registry_counters_reset.patch
140 cd prometheus-cpp/prometheus-cpp && patch -p0 < ../include_limits.patch
141@@ -273,10 +237,6 @@ prometheus-cpp/prometheus-cpp/lib/libprometheus-cpp-core.a:
142 prometheus-cpp: prometheus-cpp/prometheus-cpp/lib/libprometheus-cpp-core.a
143
144 re2/re2/obj/libre2.a:
145- cd re2 && rm -rf re2-*/ || true
146- cd re2 && tar -zxf re2.tar.gz
147-# cd re2/re2 && sed -i -e 's/-O3 -g /-O3 -fPIC /' Makefile
148-# cd re2/re2 && patch util/mutex.h < ../mutex.h.patch
149 cd re2/re2 && patch re2/onepass.cc < ../onepass.cc-multiplication-overflow.patch
150 cd re2/re2 && sed -i -e 's/-O3 /-O3 -fPIC -DMEMORY_SANITIZER -DRE2_ON_VALGRIND /' Makefile
151 cd re2/re2 && sed -i -e 's/RE2_CXXFLAGS?=-std=c++11 /RE2_CXXFLAGS?=-std=c++11 -fPIC /' Makefile
152@@ -285,8 +245,6 @@ re2/re2/obj/libre2.a:
153 re2: re2/re2/obj/libre2.a
154
155 pcre/pcre/.libs/libpcre.a:
156- cd pcre && rm -rf pcre-*/ || true
157- cd pcre && tar -zxf pcre-8.44.tar.gz
158 cd pcre/pcre && patch pcretest.c < ../pcretest.c-multiplication-overflow.patch
159 cd pcre/pcre && ./configure
160 cd pcre/pcre && CC=${CC} CXX=${CXX} ${MAKE}