make.sh uses macros define in /usr/include/fastcommon/_os_define.h
parent
5fe58217de
commit
9757d08b18
3
HISTORY
3
HISTORY
|
|
@ -1,8 +1,9 @@
|
||||||
|
|
||||||
Version 5.12 2017-10-16
|
Version 5.12 2018-05-23
|
||||||
* code refine for rare case
|
* code refine for rare case
|
||||||
* replace print format OFF_PRINTF_FORMAT to PRId64
|
* replace print format OFF_PRINTF_FORMAT to PRId64
|
||||||
* php_ext fix zend_object_store_get_object call in php5.5
|
* php_ext fix zend_object_store_get_object call in php5.5
|
||||||
|
* make.sh uses macros define in /usr/include/fastcommon/_os_define.h
|
||||||
|
|
||||||
Version 5.11 2017-05-26
|
Version 5.11 2017-05-26
|
||||||
* bug fixed: file_offset has no effect when use trunk file
|
* bug fixed: file_offset has no effect when use trunk file
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ all: $(ALL_OBJS) $(ALL_PRGS) $(ALL_LIBS)
|
||||||
libfdfsclient.so:
|
libfdfsclient.so:
|
||||||
$(COMPILE) -o $@ $< -shared $(FDFS_SHARED_OBJS) $(LIB_PATH)
|
$(COMPILE) -o $@ $< -shared $(FDFS_SHARED_OBJS) $(LIB_PATH)
|
||||||
libfdfsclient.a:
|
libfdfsclient.a:
|
||||||
ar cru $@ $< $(FDFS_STATIC_OBJS)
|
ar rcs $@ $< $(FDFS_STATIC_OBJS)
|
||||||
.o:
|
.o:
|
||||||
$(COMPILE) -o $@ $< $(STATIC_OBJS) $(LIB_PATH) $(INC_PATH)
|
$(COMPILE) -o $@ $< $(STATIC_OBJS) $(LIB_PATH) $(INC_PATH)
|
||||||
.c:
|
.c:
|
||||||
|
|
|
||||||
66
make.sh
66
make.sh
|
|
@ -1,51 +1,3 @@
|
||||||
tmp_src_filename=fdfs_check_bits.c
|
|
||||||
cat <<EOF > $tmp_src_filename
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
printf("%d\n", (int)sizeof(long));
|
|
||||||
printf("%d\n", (int)sizeof(off_t));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
gcc -D_FILE_OFFSET_BITS=64 -o a.out $tmp_src_filename
|
|
||||||
output=$(./a.out)
|
|
||||||
|
|
||||||
if [ -f /bin/expr ]; then
|
|
||||||
EXPR=/bin/expr
|
|
||||||
else
|
|
||||||
EXPR=/usr/bin/expr
|
|
||||||
fi
|
|
||||||
|
|
||||||
count=0
|
|
||||||
int_bytes=4
|
|
||||||
off_bytes=8
|
|
||||||
for col in $output; do
|
|
||||||
if [ $count -eq 0 ]; then
|
|
||||||
int_bytes=$col
|
|
||||||
else
|
|
||||||
off_bytes=$col
|
|
||||||
fi
|
|
||||||
|
|
||||||
count=$($EXPR $count + 1)
|
|
||||||
done
|
|
||||||
|
|
||||||
/bin/rm -f a.out $tmp_src_filename
|
|
||||||
if [ "$int_bytes" -eq 8 ]; then
|
|
||||||
OS_BITS=64
|
|
||||||
else
|
|
||||||
OS_BITS=32
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$off_bytes" -eq 8 ]; then
|
|
||||||
OFF_BITS=64
|
|
||||||
else
|
|
||||||
OFF_BITS=32
|
|
||||||
fi
|
|
||||||
|
|
||||||
ENABLE_STATIC_LIB=0
|
ENABLE_STATIC_LIB=0
|
||||||
ENABLE_SHARED_LIB=1
|
ENABLE_SHARED_LIB=1
|
||||||
TARGET_PREFIX=$DESTDIR/usr
|
TARGET_PREFIX=$DESTDIR/usr
|
||||||
|
|
@ -58,16 +10,30 @@ DEBUG_FLAG=1
|
||||||
|
|
||||||
CFLAGS='-Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE'
|
CFLAGS='-Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE'
|
||||||
if [ "$DEBUG_FLAG" = "1" ]; then
|
if [ "$DEBUG_FLAG" = "1" ]; then
|
||||||
CFLAGS="$CFLAGS -g -O -DDEBUG_FLAG"
|
CFLAGS="$CFLAGS -g -O1 -DDEBUG_FLAG"
|
||||||
else
|
else
|
||||||
CFLAGS="$CFLAGS -O3"
|
CFLAGS="$CFLAGS -O3"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -f /usr/include/fastcommon/_os_define.h ]; then
|
||||||
|
OS_BITS=$(fgrep OS_BITS /usr/include/fastcommon/_os_define.h | awk '{print $NF;}')
|
||||||
|
elif [ -f /usr/local/include/fastcommon/_os_define.h ]; then
|
||||||
|
OS_BITS=$(fgrep OS_BITS /usr/local/include/fastcommon/_os_define.h | awk '{print $NF;}')
|
||||||
|
else
|
||||||
|
OS_BITS=64
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$OS_BITS" -eq 64 ]; then
|
||||||
|
LIB_VERSION=lib64
|
||||||
|
else
|
||||||
|
LIB_VERSION=lib
|
||||||
|
fi
|
||||||
|
|
||||||
LIBS=''
|
LIBS=''
|
||||||
|
|
||||||
uname=$(uname)
|
uname=$(uname)
|
||||||
if [ "$uname" = "Linux" ]; then
|
if [ "$uname" = "Linux" ]; then
|
||||||
if [ $OS_BITS -eq 64 ]; then
|
if [ "$OS_BITS" -eq 64 ]; then
|
||||||
LIBS="$LIBS -L/usr/lib64"
|
LIBS="$LIBS -L/usr/lib64"
|
||||||
else
|
else
|
||||||
LIBS="$LIBS -L/usr/lib"
|
LIBS="$LIBS -L/usr/lib"
|
||||||
|
|
|
||||||
|
|
@ -1710,7 +1710,7 @@ static int trunk_wait_file_ready(const char *filename, const int64_t file_size,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (abs(g_current_time - file_mtime) > 10)
|
if (labs(g_current_time - file_mtime) > 10)
|
||||||
{
|
{
|
||||||
return ETIMEDOUT;
|
return ETIMEDOUT;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue