make.sh uses macros define in /usr/include/fastcommon/_os_define.h

pull/252/head
yuqing 2018-05-23 15:36:08 +08:00
parent 5fe58217de
commit 9757d08b18
4 changed files with 20 additions and 53 deletions

View File

@ -1,8 +1,9 @@
Version 5.12 2017-10-16
Version 5.12 2018-05-23
* code refine for rare case
* replace print format OFF_PRINTF_FORMAT to PRId64
* 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
* bug fixed: file_offset has no effect when use trunk file

View File

@ -52,7 +52,7 @@ all: $(ALL_OBJS) $(ALL_PRGS) $(ALL_LIBS)
libfdfsclient.so:
$(COMPILE) -o $@ $< -shared $(FDFS_SHARED_OBJS) $(LIB_PATH)
libfdfsclient.a:
ar cru $@ $< $(FDFS_STATIC_OBJS)
ar rcs $@ $< $(FDFS_STATIC_OBJS)
.o:
$(COMPILE) -o $@ $< $(STATIC_OBJS) $(LIB_PATH) $(INC_PATH)
.c:

66
make.sh
View File

@ -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_SHARED_LIB=1
TARGET_PREFIX=$DESTDIR/usr
@ -58,16 +10,30 @@ DEBUG_FLAG=1
CFLAGS='-Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE'
if [ "$DEBUG_FLAG" = "1" ]; then
CFLAGS="$CFLAGS -g -O -DDEBUG_FLAG"
CFLAGS="$CFLAGS -g -O1 -DDEBUG_FLAG"
else
CFLAGS="$CFLAGS -O3"
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=''
uname=$(uname)
if [ "$uname" = "Linux" ]; then
if [ $OS_BITS -eq 64 ]; then
if [ "$OS_BITS" -eq 64 ]; then
LIBS="$LIBS -L/usr/lib64"
else
LIBS="$LIBS -L/usr/lib"

View File

@ -1710,7 +1710,7 @@ static int trunk_wait_file_ready(const char *filename, const int64_t file_size,
return 0;
}
if (abs(g_current_time - file_mtime) > 10)
if (labs(g_current_time - file_mtime) > 10)
{
return ETIMEDOUT;
}