mirror of
https://github.com/tmate-io/tmate.git
synced 2024-11-23 00:23:08 +01:00
Lower the required glib version to 2.8 for static builds
This commit is contained in:
parent
a2520da195
commit
6dc58ab6de
@ -8,6 +8,10 @@ MSGPACK_LIB=ext/lib/libmsgpack.a
|
||||
|
||||
TMATE_CONFIGURE=PKG_CONFIG_PATH=./ext/lib/pkgconfig
|
||||
|
||||
LIBC=$(shell gcc -print-file-name=libc.a)
|
||||
STATIC_LIBC_OBJECTS=fdelt_chk
|
||||
STATIC_COMPAT_OBJECTS=memcpy clock_gettime
|
||||
|
||||
all: tmate
|
||||
|
||||
dependencies:
|
||||
@ -39,11 +43,18 @@ $(MSGPACK_LIB): $(MSGPACK)/.ready
|
||||
cd $(MSGPACK)/build; ([ -f Makefile ] || cmake -DCMAKE_INSTALL_PREFIX:PATH=$(shell pwd)/ext ..)
|
||||
+make -C $(MSGPACK)/build install
|
||||
|
||||
tmate: $(MSGPACK_LIB) $(LIBSSH_LIB)
|
||||
libc/%.o:
|
||||
mkdir -p libc
|
||||
cd libc; ar x $(LIBC) $(notdir $@)
|
||||
|
||||
compat/%.o: compat/%.c
|
||||
gcc -c -o $@ $<
|
||||
|
||||
tmate: $(MSGPACK_LIB) $(LIBSSH_LIB) $(patsubst %,libc/%.o,$(STATIC_LIBC_OBJECTS)) $(patsubst %,compat/%.o,$(STATIC_COMPAT_OBJECTS))
|
||||
./autogen.sh
|
||||
$(TMATE_CONFIGURE) ./configure --enable-static
|
||||
+make
|
||||
|
||||
clean:
|
||||
rm -rf ext $(LIBSSH) $(MSGPACK)
|
||||
rm -rf ext libc $(LIBSSH) $(MSGPACK)
|
||||
+make clean
|
||||
|
9
compat/clock_gettime.c
Normal file
9
compat/clock_gettime.c
Normal file
@ -0,0 +1,9 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
int clock_gettime(clockid_t clk_id, struct timespec *tp)
|
||||
{
|
||||
return syscall(SYS_clock_gettime, clk_id, tp);
|
||||
}
|
11
compat/memcpy.c
Normal file
11
compat/memcpy.c
Normal file
@ -0,0 +1,11 @@
|
||||
// http://stackoverflow.com/questions/8823267/linking-against-older-symbol-version-in-a-so-file
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/* some systems do not have newest memcpy@@GLIBC_2.14 - stay with old good one */
|
||||
asm (".symver memcpy, memcpy@GLIBC_2.2.5");
|
||||
|
||||
void *__wrap_memcpy(void *dest, const void *src, size_t n)
|
||||
{
|
||||
return memcpy(dest, src, n);
|
||||
}
|
@ -61,6 +61,7 @@ if test "x$found_static" = xyes; then
|
||||
CPPFLAGS="$LIBCRYPTO_CFLAGS $CPPFLAGS"
|
||||
LIBS="$LIBCRYPTO_LIBS $LIBS"
|
||||
])
|
||||
# See more static settings below... (search for found_static)
|
||||
fi
|
||||
|
||||
# Is this gcc?
|
||||
@ -451,6 +452,12 @@ AM_CONDITIONAL(NO_GETOPT, [test "x$found_getopt" = xno])
|
||||
|
||||
if test "x$found_static" = xyes; then
|
||||
# libc and libdl should be dynamically linked.
|
||||
# but we want to lower our requirements for libc's version.
|
||||
# so we extract some symobls and add them here
|
||||
if test `uname -m` = x86_64; then
|
||||
LIBS="compat/memcpy.o -Wl,--wrap=memcpy $LIBS"
|
||||
fi
|
||||
LIBS="compat/clock_gettime.o libc/fdelt_chk.o $LIBS"
|
||||
LIBS="-Wl,-Bstatic ${LIBS/-ldl/} -Wl,-Bdynamic -ldl"
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user