mirror of
https://github.com/tmate-io/tmate.git
synced 2025-06-19 08:06:54 +02: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
|
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
|
all: tmate
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -39,11 +43,18 @@ $(MSGPACK_LIB): $(MSGPACK)/.ready
|
|||||||
cd $(MSGPACK)/build; ([ -f Makefile ] || cmake -DCMAKE_INSTALL_PREFIX:PATH=$(shell pwd)/ext ..)
|
cd $(MSGPACK)/build; ([ -f Makefile ] || cmake -DCMAKE_INSTALL_PREFIX:PATH=$(shell pwd)/ext ..)
|
||||||
+make -C $(MSGPACK)/build install
|
+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
|
./autogen.sh
|
||||||
$(TMATE_CONFIGURE) ./configure --enable-static
|
$(TMATE_CONFIGURE) ./configure --enable-static
|
||||||
+make
|
+make
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf ext $(LIBSSH) $(MSGPACK)
|
rm -rf ext libc $(LIBSSH) $(MSGPACK)
|
||||||
+make clean
|
+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"
|
CPPFLAGS="$LIBCRYPTO_CFLAGS $CPPFLAGS"
|
||||||
LIBS="$LIBCRYPTO_LIBS $LIBS"
|
LIBS="$LIBCRYPTO_LIBS $LIBS"
|
||||||
])
|
])
|
||||||
|
# See more static settings below... (search for found_static)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Is this gcc?
|
# Is this gcc?
|
||||||
@ -451,6 +452,12 @@ AM_CONDITIONAL(NO_GETOPT, [test "x$found_getopt" = xno])
|
|||||||
|
|
||||||
if test "x$found_static" = xyes; then
|
if test "x$found_static" = xyes; then
|
||||||
# libc and libdl should be dynamically linked.
|
# 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"
|
LIBS="-Wl,-Bstatic ${LIBS/-ldl/} -Wl,-Bdynamic -ldl"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user