1
0
Fork 0

[ win64 ] added openssl build support to docker, minor code changes

This commit is contained in:
Unknown 2022-04-25 20:52:03 +02:00
parent f1da254e0a
commit e2cf1923c4
5 changed files with 63 additions and 15 deletions

View File

@ -32,9 +32,9 @@ configure() {
time \
CC=$1 \
LD=$2 \
LIBS=$5 \
CFLAGS="-g -no-pie -std=c99" \
LDFLAGS=$4 \
LIBS=$5 \
CXXFLAGS=$6 \
PKG_CONFIG="./pkg-config.sh" \
./configure -C \
--host=$3 \
@ -129,13 +129,17 @@ pub() {
info() {
echo "--[ binary info ]--"
file ./src/elinks$1
ls -lh ./src/elinks$1
ls -l ./src/elinks$1
if [ "$ARCHIT" = "win64" || "$ARCHIT" = "win32" ]; then
wineconsole ./src/elinks$1 --version
if [ ! -f ../src/elinks$1 ]; then
file ./src/elinks$1
ls -lh ./src/elinks$1
ls -l ./src/elinks$1
if [ "$ARCHIT" = "win64" ] || [ "$ARCHIT" = "win32" ]; then
wineconsole --backend=ncurses ./src/elinks$1 --version
else
./src/elinks$1 --version
fi
else
./src/elinks$1 --version
echo "--[*] No binary compiled."
fi
}
@ -146,6 +150,7 @@ set_arch() {
LD="i686-linux-gnu-ld"
MAKE_HOST="i686-linux-gnu"
BIN_SUFFIX=""
CXXFLAGS=""
LDFLAGS=""
LIBS=""
elif [ "$1" = "lin64" ]; then
@ -154,6 +159,7 @@ set_arch() {
LD="x86_64-linux-gnu-ld"
MAKE_HOST="x86_64-linux-gnu"
BIN_SUFFIX=""
CXXFLAGS=""
LDFLAGS=""
LIBS=""
elif [ "$1" = "win32" ]; then
@ -162,6 +168,7 @@ set_arch() {
LD="i686-w64-mingw32-ld"
MAKE_HOST="x86_64-w32-mingw32"
BIN_SUFFIX=".exe"
CXXFLAGS=""
LDFLAGS=""
LIBS=""
elif [ "$1" = "win64" ]; then
@ -170,14 +177,16 @@ set_arch() {
LD="x86_64-w64-mingw32-ld"
MAKE_HOST="x86_64-w64-mingw32"
BIN_SUFFIX=".exe"
CXXFLAGS="-I/usr/local/include"
LDFLAGS=""
LIBS=""
LIBS="-lws2_32"
elif [ "$1" = "arm32" ]; then
ARCHIT="$1"
CC="arm-linux-gnueabihf-gcc"
LD="arm-linux-gnueabihf-ld"
MAKE_HOST="arm-linux-gnu"
BIN_SUFFIX=""
CXXFLAGS=""
LDFLAGS=""
LIBS="-L../../lib/$ARCHIT"
elif [ "$1" = "arm64" ]; then
@ -186,6 +195,7 @@ set_arch() {
LD="aarch64-linux-gnu-ld"
MAKE_HOST="aarch64-linux-gnu"
BIN_SUFFIX=""
CXXFLAGS=""
LDFLAGS=""
LIBS="-L../../lib/$ARCHIT"
elif [ "$1" = "native" ]; then
@ -194,6 +204,7 @@ set_arch() {
LD="ld"
MAKE_HOST=""
BIN_SUFFIX=""
CXXFLAGS=""
LDFLAGS=""
LIBS=""
fi
@ -247,7 +258,7 @@ select SEL in $CC_SEL; do
if [ "$SEL" = "arch" ]; then
arch_menu
elif [ "$SEL" = "build" ]; then
configure "$CC" "$LD" "$MAKE_HOST" "$LDFLAGS" "$LIBS"
configure "$CC" "$LD" "$MAKE_HOST" "$LDFLAGS" "$LIBS" "$CXXFLAGS"
if [ $? -eq 1 ]; then
break
fi
@ -258,7 +269,7 @@ select SEL in $CC_SEL; do
elif [ "$SEL" = "make" ]; then
build
elif [ "$SEL" = "config" ]; then
configure "$CC" "$LD" "$MAKE_HOST" "$LDFLAGS" "$LIBS"
configure "$CC" "$LD" "$MAKE_HOST" "$LDFLAGS" "$LIBS" "$CXXFLAGS"
elif [ "$SEL" = "test" ]; then
test $BIN_SUFFIX
elif [ "$SEL" = "pub" ]; then
@ -273,7 +284,7 @@ select SEL in $CC_SEL; do
for arch in "${arch_arr[@]}"; do
echo "--[ Building: $arch ]--"
set_arch "$arch"
configure "$CC" "$LD" "$MAKE_HOST" "$LDFLAGS" "$LIBS"
configure "$CC" "$LD" "$MAKE_HOST" "$LDFLAGS" "$LIBS" "$CXXFLAGS"
if [ $? -eq 1 ]; then
break
fi

View File

@ -1,9 +1,24 @@
#
# [ win64 ] elinks docker development environment
# [ win64 ] elinks docker development environment v0.1a
#
FROM debian:latest
RUN apt-get update; apt-get -y install rsync vim screen git make automake gcc-mingw-w64-x86-64 bash g++-mingw-w64-x86-64 libssl-dev
# [*] elinks openssl development support
# install sources build tools and update
RUN apt-get install -y apt-src && grep '^deb ' /etc/apt/sources.list | sed 's/deb /deb-src /' >> /etc/apt/sources.list && apt-src update
# install openssl library source code
RUN cd /root && apt-src install libssl-dev
# build openssl library for win64
RUN cd /root && cd `ls -d /root/openssl-*` && ./Configure mingw64 --cross-compile-prefix=x86_64-w64-mingw32- --prefix=/usr/local && make && make install
# [*] elinks sources
# get elinks source
RUN cd /root; git clone https://github.com/rkd77/elinks

View File

@ -173,8 +173,13 @@ do_real_lookup(char *name, struct sockaddr_storage **addrs, int *addrno,
{
struct in_addr inp;
#ifndef WIN32
if (is_ip_address(name, strlen(name)) && inet_aton(name, &inp))
hostent = gethostbyaddr(&inp, sizeof(inp), AF_INET);
#else
if (is_ip_address(name, strlen(name)) && inet_pton(name, &inp))
hostent = gethostbyaddr(&inp, sizeof(inp), AF_INET);
#endif
}
if (!hostent)
#endif

View File

@ -70,6 +70,11 @@
#endif
/* Definition of X509_NAME causes compilation error on WIN32
* due to X509_NAME redefinition in wincrypt.h */
#ifdef WIN32
#undef X509_NAME
#endif
/* Refuse to negotiate TLS 1.0 and later protocols on @socket->ssl.
* Without this, connecting to <https://www-s.uiuc.edu/> with GnuTLS
@ -279,8 +284,14 @@ match_uri_host_ip(const char *uri_host,
* network byte order. */
switch (ASN1_STRING_length(cert_host_asn1)) {
case 4:
#ifndef win32
return inet_aton(uri_host, &uri_host_in) != 0
&& memcmp(cert_host_addr, &uri_host_in.s_addr, 4) == 0;
#else
return inet_pton(uri_host, &uri_host_in) != 0
&& memcmp(cert_host_addr, &uri_host_in.s_addr, 4) == 0;
#endif
#ifdef CONFIG_IPV6
case 16:
@ -298,6 +309,8 @@ match_uri_host_ip(const char *uri_host,
static int
verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
{
X509_NAME *name;
X509 *cert;
SSL *ssl;
struct socket *socket;
@ -348,9 +361,8 @@ verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
/* Free the GENERAL_NAMES list and each element. */
sk_GENERAL_NAME_pop_free(alts, GENERAL_NAME_free);
}
if (!matched && !saw_dns_name) {
X509_NAME *name;
int cn_index;
X509_NAME_ENTRY *entry = NULL;

View File

@ -151,9 +151,14 @@ const char *elinks_inet_ntop(int af, const void *src, char *dst, size_t size);
/* Silence various sparse warnings. */
/* WIN32 This caused linker error on mingw w64 cross-compiler and in my
* honest opinion it's just here to silence the compiler as noted above */
#ifndef WIN32
#ifndef __builtin_stpcpy
extern char *__builtin_stpcpy(char *dest, const char *src);
#endif
#endif
#ifndef __builtin_mempcpy
extern void *__builtin_mempcpy(void *dest, const void *src, size_t n);