mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -05:00
Merge pull request #157 from mtatton/master
[ win64 ] added openssl build support to docker, minor code changes
This commit is contained in:
commit
749d9ebab6
27
build.sh
27
build.sh
@ -32,9 +32,9 @@ configure() {
|
|||||||
time \
|
time \
|
||||||
CC=$1 \
|
CC=$1 \
|
||||||
LD=$2 \
|
LD=$2 \
|
||||||
LIBS=$5 \
|
|
||||||
CFLAGS="-g -no-pie -std=c99" \
|
|
||||||
LDFLAGS=$4 \
|
LDFLAGS=$4 \
|
||||||
|
LIBS=$5 \
|
||||||
|
CXXFLAGS=$6 \
|
||||||
PKG_CONFIG="./pkg-config.sh" \
|
PKG_CONFIG="./pkg-config.sh" \
|
||||||
./configure -C \
|
./configure -C \
|
||||||
--host=$3 \
|
--host=$3 \
|
||||||
@ -129,14 +129,18 @@ pub() {
|
|||||||
|
|
||||||
info() {
|
info() {
|
||||||
echo "--[ binary info ]--"
|
echo "--[ binary info ]--"
|
||||||
|
if [ ! -f ../src/elinks$1 ]; then
|
||||||
file ./src/elinks$1
|
file ./src/elinks$1
|
||||||
ls -lh ./src/elinks$1
|
ls -lh ./src/elinks$1
|
||||||
ls -l ./src/elinks$1
|
ls -l ./src/elinks$1
|
||||||
if [ "$ARCHIT" = "win64" || "$ARCHIT" = "win32" ]; then
|
if [ "$ARCHIT" = "win64" ] || [ "$ARCHIT" = "win32" ]; then
|
||||||
wineconsole ./src/elinks$1 --version
|
wineconsole --backend=ncurses ./src/elinks$1 --version
|
||||||
else
|
else
|
||||||
./src/elinks$1 --version
|
./src/elinks$1 --version
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo "--[*] No binary compiled."
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
set_arch() {
|
set_arch() {
|
||||||
@ -146,6 +150,7 @@ set_arch() {
|
|||||||
LD="i686-linux-gnu-ld"
|
LD="i686-linux-gnu-ld"
|
||||||
MAKE_HOST="i686-linux-gnu"
|
MAKE_HOST="i686-linux-gnu"
|
||||||
BIN_SUFFIX=""
|
BIN_SUFFIX=""
|
||||||
|
CXXFLAGS=""
|
||||||
LDFLAGS=""
|
LDFLAGS=""
|
||||||
LIBS=""
|
LIBS=""
|
||||||
elif [ "$1" = "lin64" ]; then
|
elif [ "$1" = "lin64" ]; then
|
||||||
@ -154,6 +159,7 @@ set_arch() {
|
|||||||
LD="x86_64-linux-gnu-ld"
|
LD="x86_64-linux-gnu-ld"
|
||||||
MAKE_HOST="x86_64-linux-gnu"
|
MAKE_HOST="x86_64-linux-gnu"
|
||||||
BIN_SUFFIX=""
|
BIN_SUFFIX=""
|
||||||
|
CXXFLAGS=""
|
||||||
LDFLAGS=""
|
LDFLAGS=""
|
||||||
LIBS=""
|
LIBS=""
|
||||||
elif [ "$1" = "win32" ]; then
|
elif [ "$1" = "win32" ]; then
|
||||||
@ -162,6 +168,7 @@ set_arch() {
|
|||||||
LD="i686-w64-mingw32-ld"
|
LD="i686-w64-mingw32-ld"
|
||||||
MAKE_HOST="x86_64-w32-mingw32"
|
MAKE_HOST="x86_64-w32-mingw32"
|
||||||
BIN_SUFFIX=".exe"
|
BIN_SUFFIX=".exe"
|
||||||
|
CXXFLAGS=""
|
||||||
LDFLAGS=""
|
LDFLAGS=""
|
||||||
LIBS=""
|
LIBS=""
|
||||||
elif [ "$1" = "win64" ]; then
|
elif [ "$1" = "win64" ]; then
|
||||||
@ -170,14 +177,16 @@ set_arch() {
|
|||||||
LD="x86_64-w64-mingw32-ld"
|
LD="x86_64-w64-mingw32-ld"
|
||||||
MAKE_HOST="x86_64-w64-mingw32"
|
MAKE_HOST="x86_64-w64-mingw32"
|
||||||
BIN_SUFFIX=".exe"
|
BIN_SUFFIX=".exe"
|
||||||
|
CXXFLAGS="-I/usr/local/include"
|
||||||
LDFLAGS=""
|
LDFLAGS=""
|
||||||
LIBS=""
|
LIBS="-lws2_32"
|
||||||
elif [ "$1" = "arm32" ]; then
|
elif [ "$1" = "arm32" ]; then
|
||||||
ARCHIT="$1"
|
ARCHIT="$1"
|
||||||
CC="arm-linux-gnueabihf-gcc"
|
CC="arm-linux-gnueabihf-gcc"
|
||||||
LD="arm-linux-gnueabihf-ld"
|
LD="arm-linux-gnueabihf-ld"
|
||||||
MAKE_HOST="arm-linux-gnu"
|
MAKE_HOST="arm-linux-gnu"
|
||||||
BIN_SUFFIX=""
|
BIN_SUFFIX=""
|
||||||
|
CXXFLAGS=""
|
||||||
LDFLAGS=""
|
LDFLAGS=""
|
||||||
LIBS="-L../../lib/$ARCHIT"
|
LIBS="-L../../lib/$ARCHIT"
|
||||||
elif [ "$1" = "arm64" ]; then
|
elif [ "$1" = "arm64" ]; then
|
||||||
@ -186,6 +195,7 @@ set_arch() {
|
|||||||
LD="aarch64-linux-gnu-ld"
|
LD="aarch64-linux-gnu-ld"
|
||||||
MAKE_HOST="aarch64-linux-gnu"
|
MAKE_HOST="aarch64-linux-gnu"
|
||||||
BIN_SUFFIX=""
|
BIN_SUFFIX=""
|
||||||
|
CXXFLAGS=""
|
||||||
LDFLAGS=""
|
LDFLAGS=""
|
||||||
LIBS="-L../../lib/$ARCHIT"
|
LIBS="-L../../lib/$ARCHIT"
|
||||||
elif [ "$1" = "native" ]; then
|
elif [ "$1" = "native" ]; then
|
||||||
@ -194,6 +204,7 @@ set_arch() {
|
|||||||
LD="ld"
|
LD="ld"
|
||||||
MAKE_HOST=""
|
MAKE_HOST=""
|
||||||
BIN_SUFFIX=""
|
BIN_SUFFIX=""
|
||||||
|
CXXFLAGS=""
|
||||||
LDFLAGS=""
|
LDFLAGS=""
|
||||||
LIBS=""
|
LIBS=""
|
||||||
fi
|
fi
|
||||||
@ -247,7 +258,7 @@ select SEL in $CC_SEL; do
|
|||||||
if [ "$SEL" = "arch" ]; then
|
if [ "$SEL" = "arch" ]; then
|
||||||
arch_menu
|
arch_menu
|
||||||
elif [ "$SEL" = "build" ]; then
|
elif [ "$SEL" = "build" ]; then
|
||||||
configure "$CC" "$LD" "$MAKE_HOST" "$LDFLAGS" "$LIBS"
|
configure "$CC" "$LD" "$MAKE_HOST" "$LDFLAGS" "$LIBS" "$CXXFLAGS"
|
||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
@ -258,7 +269,7 @@ select SEL in $CC_SEL; do
|
|||||||
elif [ "$SEL" = "make" ]; then
|
elif [ "$SEL" = "make" ]; then
|
||||||
build
|
build
|
||||||
elif [ "$SEL" = "config" ]; then
|
elif [ "$SEL" = "config" ]; then
|
||||||
configure "$CC" "$LD" "$MAKE_HOST" "$LDFLAGS" "$LIBS"
|
configure "$CC" "$LD" "$MAKE_HOST" "$LDFLAGS" "$LIBS" "$CXXFLAGS"
|
||||||
elif [ "$SEL" = "test" ]; then
|
elif [ "$SEL" = "test" ]; then
|
||||||
test $BIN_SUFFIX
|
test $BIN_SUFFIX
|
||||||
elif [ "$SEL" = "pub" ]; then
|
elif [ "$SEL" = "pub" ]; then
|
||||||
@ -273,7 +284,7 @@ select SEL in $CC_SEL; do
|
|||||||
for arch in "${arch_arr[@]}"; do
|
for arch in "${arch_arr[@]}"; do
|
||||||
echo "--[ Building: $arch ]--"
|
echo "--[ Building: $arch ]--"
|
||||||
set_arch "$arch"
|
set_arch "$arch"
|
||||||
configure "$CC" "$LD" "$MAKE_HOST" "$LDFLAGS" "$LIBS"
|
configure "$CC" "$LD" "$MAKE_HOST" "$LDFLAGS" "$LIBS" "$CXXFLAGS"
|
||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
@ -1,9 +1,24 @@
|
|||||||
#
|
#
|
||||||
# [ win64 ] elinks docker development environment
|
# [ win64 ] elinks docker development environment v0.1a
|
||||||
#
|
#
|
||||||
|
|
||||||
FROM debian:latest
|
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
|
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
|
RUN cd /root; git clone https://github.com/rkd77/elinks
|
||||||
|
|
||||||
|
@ -173,8 +173,13 @@ do_real_lookup(char *name, struct sockaddr_storage **addrs, int *addrno,
|
|||||||
{
|
{
|
||||||
struct in_addr inp;
|
struct in_addr inp;
|
||||||
|
|
||||||
|
#ifndef HAVE_INET_PTON
|
||||||
if (is_ip_address(name, strlen(name)) && inet_aton(name, &inp))
|
if (is_ip_address(name, strlen(name)) && inet_aton(name, &inp))
|
||||||
hostent = gethostbyaddr(&inp, sizeof(inp), AF_INET);
|
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)
|
if (!hostent)
|
||||||
#endif
|
#endif
|
||||||
|
@ -70,6 +70,11 @@
|
|||||||
|
|
||||||
#endif
|
#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.
|
/* Refuse to negotiate TLS 1.0 and later protocols on @socket->ssl.
|
||||||
* Without this, connecting to <https://www-s.uiuc.edu/> with GnuTLS
|
* 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. */
|
* network byte order. */
|
||||||
switch (ASN1_STRING_length(cert_host_asn1)) {
|
switch (ASN1_STRING_length(cert_host_asn1)) {
|
||||||
case 4:
|
case 4:
|
||||||
|
#ifndef HAVE_INET_PTON
|
||||||
return inet_aton(uri_host, &uri_host_in) != 0
|
return inet_aton(uri_host, &uri_host_in) != 0
|
||||||
&& memcmp(cert_host_addr, &uri_host_in.s_addr, 4) == 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
|
#ifdef CONFIG_IPV6
|
||||||
case 16:
|
case 16:
|
||||||
@ -298,6 +309,7 @@ match_uri_host_ip(const char *uri_host,
|
|||||||
static int
|
static int
|
||||||
verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
|
verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
|
||||||
{
|
{
|
||||||
|
|
||||||
X509 *cert;
|
X509 *cert;
|
||||||
SSL *ssl;
|
SSL *ssl;
|
||||||
struct socket *socket;
|
struct socket *socket;
|
||||||
@ -348,7 +360,6 @@ verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
|
|||||||
/* Free the GENERAL_NAMES list and each element. */
|
/* Free the GENERAL_NAMES list and each element. */
|
||||||
sk_GENERAL_NAME_pop_free(alts, GENERAL_NAME_free);
|
sk_GENERAL_NAME_pop_free(alts, GENERAL_NAME_free);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!matched && !saw_dns_name) {
|
if (!matched && !saw_dns_name) {
|
||||||
X509_NAME *name;
|
X509_NAME *name;
|
||||||
int cn_index;
|
int cn_index;
|
||||||
|
@ -151,9 +151,14 @@ const char *elinks_inet_ntop(int af, const void *src, char *dst, size_t size);
|
|||||||
|
|
||||||
/* Silence various sparse warnings. */
|
/* 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
|
#ifndef __builtin_stpcpy
|
||||||
extern char *__builtin_stpcpy(char *dest, const char *src);
|
extern char *__builtin_stpcpy(char *dest, const char *src);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __builtin_mempcpy
|
#ifndef __builtin_mempcpy
|
||||||
extern void *__builtin_mempcpy(void *dest, const void *src, size_t n);
|
extern void *__builtin_mempcpy(void *dest, const void *src, size_t n);
|
||||||
|
Loading…
Reference in New Issue
Block a user