Index: Makefile --- Makefile.orig 2006-10-13 00:56:32 +0200 +++ Makefile 2006-11-13 13:01:21 +0100 @@ -134,17 +134,17 @@ ifndef host_os_family ifeq (,$(OSTYPE)) - ifneq (,$(RPM_OS)) - OSTYPE = $(RPM_OS) - endif - endif - - ifeq (,$(OSTYPE)) OSTYPE := $(shell uname -s) endif endif ifndef host_os_family + ifneq (,$(findstring FreeBSD,$(OSTYPE))) + host_os_family = freebsd + endif +endif + +ifndef host_os_family ifneq (,$(findstring Linux,$(OSTYPE))) host_os_family = linux endif @@ -244,6 +244,13 @@ # -- Target operating system -- ifndef target_os_family + ifeq ($(host_os_family),freebsd) + unix_target = yes + target_os_family = freebsd + endif +endif + +ifndef target_os_family ifeq ($(host_os_family),linux) unix_target = yes target_os_family = linux @@ -1129,6 +1136,12 @@ lib_link_libs = -lpthread exe_link_libs = -lpthread + ifeq ($(target_os_family),freebsd) + lib_link_libs += -lstdc++ -lncurses + exe_link_libs += -lstdc++ -lncurses + shared_link_flags += -shared -Wl,-Bsymbolic -fpic \ + -Wl,-soname,$(@F) -o $@ + endif ifeq ($(target_os_family),linux) lib_link_libs += -lrt -lstdc++ -ldl -lncurses exe_link_libs += -lrt -lstdc++ -ldl -lncurses @@ -1573,7 +1586,7 @@ # -- Default target -- .PHONY : libs -libs: status clean dircheck $(flaim_static_lib) $(flaim_shared_lib) +libs: status clean dircheck $(flaim_static_lib) # -- *.cpp -> *$(obj_suffix) -- @@ -1871,25 +1884,12 @@ .PHONY : install install: libs pkgconfig ifneq ($(host_os_family),win) - $(ec)$(gprintf) "Installing ...\n" - mkdir -p $(lib_install_dir)/pkgconfig - mkdir -p $(include_install_dir) - install --mode=644 $(flaim_shared_lib) $(lib_install_dir) - install --mode=644 $(flaim_static_lib) $(lib_install_dir) - install --mode=644 $(pkgconfig_file) $(pkgconfig_install_dir) - install --mode=644 src/flaim.h $(include_install_dir) - install --mode=644 $(ftk_src_dir)/ftk.h $(include_install_dir)/flaimtk.h -ifneq ($(so_age),0) -ifneq ($(so_revision),0) - cd $(lib_install_dir); ln -fs $(lib_prefix)$(project_name).so.$(so_current).$(so_revision).$(so_age) $(lib_prefix)$(project_name).so.$(so_current).$(so_revision) -endif -endif -ifneq ($(so_revision),0) - cd $(lib_install_dir); ln -fs $(lib_prefix)$(project_name).so.$(so_current).$(so_revision) $(lib_prefix)$(project_name).so.$(so_current) -endif - cd $(lib_install_dir); ln -fs $(lib_prefix)$(project_name).so.$(so_current) $(lib_prefix)$(project_name).so - -ldconfig $(lib_install_dir) - $(ec)$(gprintf) "Installation complete.\n" + $(MKDIR) -p $(lib_install_dir)/pkgconfig + $(MKDIR) -p $(include_install_dir) + $(INSTALL) -c -m 644 $(flaim_static_lib) $(lib_install_dir) + $(INSTALL) -c -m 644 $(pkgconfig_file) $(pkgconfig_install_dir) + $(INSTALL) -c -m 644 src/flaim.h $(include_install_dir) + $(INSTALL) -c -m 644 $(ftk_src_dir)/ftk.h $(include_install_dir)/flaimtk.h endif # -- uninstall -- Index: ftk/src/ftk.h --- ftk/src/ftk.h.orig 2006-10-13 00:56:32 +0200 +++ ftk/src/ftk.h 2006-11-13 13:00:56 +0100 @@ -39,6 +39,7 @@ #undef FLM_NLM #undef FLM_UNIX #undef FLM_AIX + #undef FLM_FREEBSD #undef FLM_LINUX #undef FLM_SOLARIS #undef FLM_HPUX @@ -112,6 +113,19 @@ #define FLM_UNIX #define FLM_BIG_ENDIAN #define FLM_STRICT_ALIGNMENT + #elif defined( __FreeBSD__) + #define FLM_FREEBSD + #define FLM_OSTYPE_STR "FreeBSD" + #define FLM_UNIX + #define FLM_STRICT_ALIGNMENT + #if defined( sparc) || defined( __sparc) || defined( __sparc__) + #define FLM_SPARC + #define FLM_BIG_ENDIAN + #elif defined( i386) || defined( _i386) + #define FLM_X86 + #endif + #define FLM_HAS_ASYNC_IO + #define FLM_HAS_DIRECT_IO #elif defined( linux) #define FLM_LINUX #define FLM_OSTYPE_STR "Linux" Index: ftk/src/ftkthrd.cpp --- ftk/src/ftkthrd.cpp.orig 2006-10-13 00:56:32 +0200 +++ ftk/src/ftkthrd.cpp 2006-11-13 13:00:56 +0100 @@ -24,6 +24,7 @@ //------------------------------------------------------------------------------ #include "ftksys.h" +#include #ifdef FLM_UNIX pid_t getpid( void); Index: ftk/src/ftkunix.cpp --- ftk/src/ftkunix.cpp.orig 2006-10-13 00:56:32 +0200 +++ ftk/src/ftkunix.cpp 2006-11-13 13:00:56 +0100 @@ -435,7 +435,11 @@ if( !m_bDoDirectIO || m_bFlushRequired) { +#ifdef FLM_FREEBSD + if( fsync( m_fd) != 0) +#else if( fdatasync( m_fd) != 0) +#endif { return( f_mapPlatformError( errno, NE_FLM_FLUSHING_FILE)); } Index: src/flaimtk.h --- src/flaimtk.h.orig 2006-10-13 00:56:32 +0200 +++ src/flaimtk.h 2006-11-13 13:00:56 +0100 @@ -39,6 +39,7 @@ #undef FLM_NLM #undef FLM_UNIX #undef FLM_AIX + #undef FLM_FREEBSD #undef FLM_LINUX #undef FLM_SOLARIS #undef FLM_HPUX @@ -112,6 +113,19 @@ #define FLM_UNIX #define FLM_BIG_ENDIAN #define FLM_STRICT_ALIGNMENT + #elif defined( __FreeBSD__) + #define FLM_FREEBSD + #define FLM_OSTYPE_STR "FreeBSD" + #define FLM_UNIX + #define FLM_STRICT_ALIGNMENT + #if defined( sparc) || defined( __sparc) || defined( __sparc__) + #define FLM_SPARC + #define FLM_BIG_ENDIAN + #elif defined( i386) || defined( _i386) + #define FLM_X86 + #endif + #define FLM_HAS_ASYNC_IO + #define FLM_HAS_DIRECT_IO #elif defined( linux) #define FLM_LINUX #define FLM_OSTYPE_STR "Linux"