Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions builds/posix/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ else
Process := master_process
endif

ifeq ($(LSB_FLG),Y)
GCC=/opt/lsb/bin/lsbcc
else
GCC=gcc
endif

.PHONY: master_process cross_process firebird Debug Release extern

all: firebird
Expand Down Expand Up @@ -123,18 +129,18 @@ $(GEN_ROOT)/Make.Version : $(SRC_ROOT)/misc/writeBuildNum.sh
#

extern:
$(MAKE) -C $(ROOT)/extern/btyacc
$(MAKE) -C $(ROOT)/extern/cloop TARGET=release WITH_FPC=0 BUILD_DIR=$(TMP_ROOT)/cloop OUT_DIR=$(GEN_ROOT)/$(TARGET)/cloop
$(MAKE) -C $(ROOT)/extern/btyacc CC="$(CC)" CXX="$(CXX)"
$(MAKE) -C $(ROOT)/extern/cloop TARGET=release WITH_FPC=0 BUILD_DIR=$(TMP_ROOT)/cloop OUT_DIR=$(GEN_ROOT)/$(TARGET)/cloop CC="$(CC)" CXX="$(CXX)"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the point to pass variables via parameters to every child make process instead of exporting them?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the functions from fb_io used in Windows too. So Windows module also will be changed. And what macros do you mean?
Exporting variables to sub-make works fine, thanks. I will fix it.

Copy link
Copy Markdown
Contributor

@aafemt aafemt May 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

STAT, FSTAT, LSTAT and so on.
Function that are used in Windows either don't need to be hidden in macros or may be implemented slightly differently. You can inline them in os_utils.h instead of common.h. Look at my unicode branch for examples: https://github.com/aafemt/firebird/blob/unicode/src/common/os/.


ifeq ($(TOMBUILD_FLG),Y)
$(MAKE) -C $(ROOT)/extern/libtommath -f makefile.shared
CFLAGS="$(CFLAGS)" $(MAKE) -C $(ROOT)/extern/libtommath -f makefile.shared GCC=$(GCC)
ln -sf $(TOMMATH_SO).$(TOMMATH_VER) $(LIB)
ln -sf $(TOMMATH_SO) $(LIB)
endif

ifeq ($(STD_EDITLINE),false)
ifeq ($(EDITLINE_FLG),Y)
$(MAKE) -f $(GEN_ROOT)/Makefile.extern.editline
$(MAKE) -f $(GEN_ROOT)/Makefile.extern.editline CC="$(CC)" CXX="$(CXX)"
endif
endif

Expand Down Expand Up @@ -567,7 +573,7 @@ $(FIREBIRD_MSG): $(BUILD_FILE) msg.timestamp
$(CHMOD_6) $@

$(BUILD_FILE): $(BUILD_Objects) $(COMMON_LIB)
$(EXE_LINK) $(EXE_LINK_OPTIONS) $^ -o $@ $(FIREBIRD_LIBRARY_LINK) $(LINK_LIBS)
$(EXE_LINK) $(EXE_LINK_OPTIONS) $(LSB_UNDEF) $^ -o $@ $(FIREBIRD_LIBRARY_LINK) $(LINK_LIBS)

gbak_files: $(GBAK_FILES)

Expand Down
2 changes: 1 addition & 1 deletion builds/posix/Makefile.in.examples
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ $(EXAMPLES_DEST)/isql$(EXEC_EXT):
$(LN) $(ISQL) $(EXAMPLES_DEST)/isql$(EXEC_EXT)

$(EXAMPLES_DEST)/empbuild$(EXEC_EXT): $(EMPBLD_Objects) $(COMMON_LIB)
$(EXE_LINK) $(EXE_LINK_OPTIONS) $^ -o $@ -L$(LIB) $(FIREBIRD_LIBRARY_LINK) $(LINK_LIBS)
$(EXE_LINK) $(EXE_LINK_OPTIONS) $(LSB_UNDEF) $^ -o $@ -L$(LIB) $(FIREBIRD_LIBRARY_LINK) $(LINK_LIBS)

$(EXAMPLES_DEST)/empbuild.c: $(EXAMPLES_DEST)/empbuild.fdb $(EXAMPLES_DEST)/empbuild.e

Expand Down
2 changes: 1 addition & 1 deletion builds/posix/Makefile.in.plugins_examples
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ AllObjects += $(CA_Objects)
crypt_app: $(CRYPT_APP)

$(CRYPT_APP): $(CA_Objects)
$(EXE_LINK) $^ -o $@ $(FIREBIRD_LIBRARY_LINK)
$(EXE_LINK) $(LSB_UNDEF) $^ -o $@ $(FIREBIRD_LIBRARY_LINK)


include $(ROOT)/gen/make.shared.targets
Expand Down
8 changes: 8 additions & 0 deletions builds/posix/make.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ CAS_OPTIONS=@CAS_OPTIONS@
# multiple-precision integer library
MATHLIB=@MATHLIB@

LSB_FLG=@LSB_FLG@
ifeq ($(LSB_FLG), Y)
LSB_UNDEF=-Wl,--allow-shlib-undefined
endif

# switch to make sed edit files inplace
INLINE_EDIT_SED:= -i

Expand Down Expand Up @@ -162,6 +167,9 @@ CC = @CC@
CXX = @CXX@
LD = @CXX@

CFLAGS = @CFLAGS@
CXXFLAGS = @CXXFLAGS@

# LINKER COMMANDS

LIB_LINK = $(CXX) $(GLOB_OPTIONS) $(CXXFLAGS)
Expand Down
4 changes: 4 additions & 0 deletions builds/posix/make.rules
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ ifeq ($(TOMBUILD_FLG),Y)
WFLAGS += -I$(TOMMATH_INC)
endif

ifeq ($(LSB_FLG),Y)
WFLAGS += -DLSB_BUILD
endif

ifeq ($(TARGET),Release)
WFLAGS += $(PROD_FLAGS)
else
Expand Down
23 changes: 23 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,26 @@ if test "x$enable_rpath" != "xno" || test "x$enable_rpath" = "x" ; then
AC_SUBST(USE_RPATH, 1)
fi

LSB_FLG=N
AC_ARG_ENABLE(lsb-build,
[ --enable-lsb-build build LSB-compliant binaries (default=no)],
[case "$enableval" in
yes) LSB_FLG=Y;;
no) LSB_FLG=N;;
*) AC_MSG_ERROR(bad value '${enableval}' for --enable-lsb-build);;
esac])
AC_SUBST(LSB_FLG)
if test "$LSB_FLG" = "Y"; then
CFLAGS="$CFLAGS --lsb-besteffort --lsb-shared-libs=fbclient:ib_util:tommath --lsb-target-version=4.1"
CXXFLAGS="$CXXFLAGS --lsb-besteffort --lsb-shared-libs=fbclient:ib_util:tommath --lsb-target-version=4.1"
AC_SUBST(TOMBUILD, Y)
AC_PATH_PROG(CC, lsbcc, "", [$PATH$PATH_SEPARATOR/opt/lsb/bin$PATH_SEPARATOR])
AC_PATH_PROG(CXX, lsbc++, "", [$PATH$PATH_SEPARATOR/opt/lsb/bin$PATH_SEPARATOR])
if test "x$CC" = "x" || test "x$CXX" = "x" ; then
AC_MSG_ERROR(Can not find LSB compilers in /opt/lsb/bin)
fi
fi

AC_ARG_WITH(editline,
[ --with-editline support fancy command line editing],
[case "$withval" in
Expand Down Expand Up @@ -767,8 +787,11 @@ fi

dnl check for ICU presence
AC_CHECK_HEADER(unicode/ucnv.h,,AC_MSG_ERROR(ICU support not found - please install development ICU package))

if test "$LSB_FLG" = "N"; then
dnl setting ICU_OK here is done to only avoid default action
AC_CHECK_LIB(icuuc, main, ICU_OK=yes, AC_MSG_ERROR(ICU support not found - please install development ICU package))
fi

dnl check for tommath presence
if test "$TOMBUILD" = "Y"; then
Expand Down
4 changes: 2 additions & 2 deletions extern/cloop/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ WITH_FPC := 1

TARGET := release

CC := gcc
CXX := g++
CC := $(CC)
CXX := $(CXX)
LD := $(CXX)

SRC_DIR := src
Expand Down
5 changes: 5 additions & 0 deletions extern/editline/src/vis.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ static wchar_t *do_svis(wchar_t *, wint_t, int, wint_t, const wchar_t *);

#define MAXEXTRAS 30

// LSB compliance
#ifndef NBBY
#define NBBY CHAR_BIT
#endif

static const wchar_t char_shell[] = L"'`\";&<>()|{}]\\$!^~";
static const wchar_t char_glob[] = L"*?[#";

Expand Down
21 changes: 15 additions & 6 deletions extern/libtommath/makefile.shared
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@
#
#Tom St Denis
VERSION=0:41
VERSION_SO=0.41
LIBNAME_SO=libtommath.so
LIBNAME_SO_0=$(LIBNAME_SO).0

CC = libtool --mode=compile --tag=CC gcc
ifndef GCC
GCC=gcc
endif

CC = libtool --mode=compile --tag=CC $(GCC)

CFLAGS += -I./ -Wall -W -Wshadow -Wsign-compare

Expand Down Expand Up @@ -83,7 +90,9 @@ bn_mp_to_signed_bin_n.o bn_mp_to_unsigned_bin_n.o
objs: $(OBJECTS)

$(LIBNAME): $(OBJECTS)
libtool --mode=link --tag=CC gcc *.lo -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION)
$(GCC) -shared -fPIC -DPIC $(CFLAGS) $(addprefix .libs/, $(OBJECTS)) -Wl,-soname -Wl,$(LIBNAME_SO_0) -o .libs/$(LIBNAME_SO_0).$(VERSION_SO)
ln -sf $(LIBNAME_SO_0).$(VERSION_SO) .libs/$(LIBNAME_SO_0)
ln -sf $(LIBNAME_SO_0).$(VERSION_SO) .libs/$(LIBNAME_SO)

install: $(LIBNAME)
install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH)
Expand All @@ -92,11 +101,11 @@ install: $(LIBNAME)
install -g $(GROUP) -o $(USER) $(HEADERS) $(DESTDIR)$(INCPATH)

test: $(LIBNAME) demo/demo.o
gcc $(CFLAGS) -c demo/demo.c -o demo/demo.o
libtool --mode=link gcc -o test demo/demo.o $(LIBNAME_S)
$(GCC) $(CFLAGS) -c demo/demo.c -o demo/demo.o
libtool --mode=link $(GCC) -o test demo/demo.o $(LIBNAME_S)

mtest: test
cd mtest ; gcc $(CFLAGS) mtest.c -o mtest
cd mtest ; $(GCC) $(CFLAGS) mtest.c -o mtest

timing: $(LIBNAME)
gcc $(CFLAGS) -DTIMER demo/timing.c $(LIBNAME_S) -o ltmtest
$(GCC) $(CFLAGS) -DTIMER demo/timing.c $(LIBNAME_S) -o ltmtest
6 changes: 3 additions & 3 deletions src/burp/burp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2122,7 +2122,7 @@ static gbak_action open_files(const TEXT* file1,
else
SetTapePosition(fil->fil_fd, TAPE_REWIND, 0, 0, 0, FALSE);
#else
lseek(fil->fil_fd, 0, SEEK_SET);
fb_io::lseek(fil->fil_fd, 0, SEEK_SET);
#endif
tdgbl->file_desc = fil->fil_fd;
tdgbl->gbl_sw_files = fil->fil_next;
Expand Down Expand Up @@ -2381,10 +2381,10 @@ void close_platf(DESC file)
#define O_ACCMODE 3
#endif

off_t fileSize = lseek(file, 0, SEEK_CUR);
off_t fileSize = fb_io::lseek(file, 0, SEEK_CUR);
if (fileSize != (off_t)(-1))
{
FB_UNUSED(ftruncate(file, fileSize));
FB_UNUSED(fb_io::ftruncate(file, fileSize));
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/common/ScanDir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ bool ScanDir::next()
if (!dir)
return false;

while ((data = readdir (dir)))
while ((data = fb_io::readdir (dir)))
{
if (match (pattern.c_str(), data->d_name))
return true;
Expand Down Expand Up @@ -150,12 +150,12 @@ bool ScanDir::isDirectory()
{
#if defined(_WIN32)
return (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
#elif defined(HAVE_STRUCT_DIRENT_D_TYPE)
#elif defined(HAVE_STRUCT_DIRENT_D_TYPE) && !defined(LSB_BUILD)
return (data->d_type == DT_DIR);
#else
struct stat buf;
struct STAT buf;

if (stat (getFilePath(), &buf))
if (fb_io::stat(getFilePath(), &buf))
return false;

return S_ISDIR (buf.st_mode);
Expand Down
2 changes: 1 addition & 1 deletion src/common/ThreadStart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void Thread::kill(Handle& thread)

ThreadId Thread::getId()
{
#if defined(LINUX) && !defined(ANDROID)
#if defined(LINUX) && !defined(ANDROID) && !defined(LSB_BUILD)
return syscall(SYS_gettid);
#else
return pthread_self();
Expand Down
4 changes: 2 additions & 2 deletions src/common/classes/TempFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ void TempFile::init(const PathName& directory, const PathName& prefix)
filename += NAME_PATTERN;

#ifdef HAVE_MKSTEMP
handle = (IPTR) mkstemp(filename.begin());
handle = (IPTR) fb_io::mkstemp(filename.begin());
#else
if (!mktemp(filename.begin()))
{
Expand Down Expand Up @@ -275,7 +275,7 @@ void TempFile::seek(const offset_t offset)
system_error::raise("SetFilePointer");
}
#else
const off_t seek_result = ::lseek(handle, (off_t) offset, SEEK_SET);
const off_t seek_result = fb_io::lseek(handle, (off_t) offset, SEEK_SET);
if (seek_result == (off_t) -1)
{
system_error::raise("lseek");
Expand Down
4 changes: 2 additions & 2 deletions src/common/classes/alloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2215,13 +2215,13 @@ void* MemPool::allocRaw(size_t size) throw (OOM_EXCEPTION)

#ifdef MAP_ANONYMOUS

void* result = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
void* result = fb_io::mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);

#else // MAP_ANONYMOUS

if (dev_zero_fd < 0)
dev_zero_fd = os_utils::open("/dev/zero", O_RDWR);
void* result = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, dev_zero_fd, 0);
void* result = fb_io::mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, dev_zero_fd, 0);

#endif // MAP_ANONYMOUS

Expand Down
Loading