#!/bin/bash -e cd /tmp ################# ################# ver_nettle=3.3 ver_gnutls=3.5.8 ver_libev=4.22 ver_ocserv=0.12.3 ################# ################# cores=$(grep -c '^processor' /proc/cpuinfo) instPrefix="/tmp/inst" export CC=/usr/bin/gcc export PKG_CONFIG_SYSROOT_DIR="$instPrefix" export PKG_CONFIG_LIBDIR="$instPrefix/lib/pkgconfig" ################# ################# rm -rf $instPrefix mkdir -p $instPrefix ln -s . $instPrefix/usr ln -s . $instPrefix/local ################# ################# # Nettle wget --no-check-certificate -4 -O nettle.tar.gz https://ftp.gnu.org/gnu/nettle/nettle-${ver_nettle}.tar.gz [ -d nettle ] && rm -rf nettle mkdir -p nettle; tar -xz -f nettle.tar.gz -C nettle --strip-components=1; cd nettle cat >>mini-gmp.c <$instPrefix/include/readline.h < #include char *rl_line_buffer = NULL; char *rl_readline_name; void *rl_attempted_completion_function; void *rl_completion_entry_function; int rl_completion_query_items; char *readline(const char *prompt) { char buf[512], *ptr; if(prompt) printf("%s", prompt); fflush(stdout); ptr = buf; while((*ptr = getchar()) != '\n') ptr++; *ptr = '\0'; return strdup(buf); } void add_history(const char *string) {} int rl_reset_terminal(const char *terminal_name) {return 0;} char **rl_completion_matches(const char *text, void *entry_func) {return NULL;} void rl_redisplay(void) {} EOF # readline.a ar rcs $instPrefix/lib/libreadline.a readline.o rm -rf readline.o # OpenConnect server rm -rf $HOME/ocserv-bin mkdir -p $HOME/ocserv-bin wget --no-check-certificate -4 -O ocserv.tar.xz ftp://ftp.infradead.org/pub/ocserv/ocserv-${ver_ocserv}.tar.xz [ -d ocserv ] && rm -rf ocserv mkdir -p ocserv; tar -xJ -f ocserv.tar.xz -C ocserv --strip-components=1; cd ocserv #autoreconf -fvi sed -i 's/#define DEFAULT_CONFIG_ENTRIES 96/#define DEFAULT_CONFIG_ENTRIES 200/' src/vpn.h sed -i 's/\$LIBS \$LIBEV/\$LIBEV \$LIBS/g' configure CFLAGS="-I$instPrefix/include -ffloat-store -O0 --static" \ LDFLAGS="-L$instPrefix/lib -static -static-libgcc -static-libstdc++ -s -pthread -lpthread" \ LIBNETTLE_LIBS="-lnettle -lhogweed" LIBREADLINE_LIBS="-lreadline" \ LIBS="-lm" \ ./configure --prefix=/usr \ --disable-rpath \ --with-local-talloc \ --without-{root-tests,docker-tests,nuttcp-tests} \ --without-{protobuf,maxmind,geoip,liboath,pam,radius,utmp,lz4,http-parser,gssapi,pcl-lib} make -j$cores [ $? -eq 0 ] || exit 1 make DESTDIR=$HOME/ocserv-bin install cd .. # cd $HOME/ocserv-bin # tar -cvf "../ocserv_v0.12.3.tar" ./ # tar --overwrite -xvf ocserv_v0.12.3.tar -C /