mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -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 \
|
||||
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,14 +129,18 @@ pub() {
|
||||
|
||||
info() {
|
||||
echo "--[ binary info ]--"
|
||||
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 ./src/elinks$1 --version
|
||||
if [ "$ARCHIT" = "win64" ] || [ "$ARCHIT" = "win32" ]; then
|
||||
wineconsole --backend=ncurses ./src/elinks$1 --version
|
||||
else
|
||||
./src/elinks$1 --version
|
||||
fi
|
||||
else
|
||||
echo "--[*] No binary compiled."
|
||||
fi
|
||||
}
|
||||
|
||||
set_arch() {
|
||||
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -173,8 +173,13 @@ do_real_lookup(char *name, struct sockaddr_storage **addrs, int *addrno,
|
||||
{
|
||||
struct in_addr inp;
|
||||
|
||||
#ifndef HAVE_INET_PTON
|
||||
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
|
||||
|
@ -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 HAVE_INET_PTON
|
||||
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,7 @@ match_uri_host_ip(const char *uri_host,
|
||||
static int
|
||||
verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
|
||||
{
|
||||
|
||||
X509 *cert;
|
||||
SSL *ssl;
|
||||
struct socket *socket;
|
||||
@ -348,7 +360,6 @@ 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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user