diff --git a/ASCOfficeDocFile/DocDocxConverter/StringTable.h b/ASCOfficeDocFile/DocDocxConverter/StringTable.h index 9ee5fb69fea..a4e384f2d43 100644 --- a/ASCOfficeDocFile/DocDocxConverter/StringTable.h +++ b/ASCOfficeDocFile/DocDocxConverter/StringTable.h @@ -77,13 +77,13 @@ namespace DocFileFormat } StringTable( VirtualStreamReader *reader, int code_page_ ): - code_page(code_page_), fExtend(false), cbData(0), cbExtra(0), DataExtra(NULL) + code_page(code_page_), fExtend(false), cbData(0), cbExtra(0) { parse( reader, (unsigned int)reader->GetPosition(), 0, false ); } StringTable( POLE::Stream* tableStream, unsigned int fc, unsigned int lcb, int nWordVersion, bool bReadExta = false) : - code_page(1250), fExtend(false), cbData(0), cbExtra(0), DataExtra(NULL) + code_page(1250), fExtend(false), cbData(0), cbExtra(0) { if ( lcb > 0 ) { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Auxiliary/HelpFunc.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Auxiliary/HelpFunc.cpp index 0c3a6ee5477..8587603ed9e 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Auxiliary/HelpFunc.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Auxiliary/HelpFunc.cpp @@ -352,7 +352,7 @@ const std::wstring unescape_ST_Xstring(const std::wstring& wstr) while(true) { -#if defined(__linux__) || defined(_MAC) || defined(_IOS) +#if defined(__linux__) || defined(__FreeBSD__) || defined(_MAC) || defined(_IOS) const auto it_range = boost::make_iterator_range(x_pos_noncopied, wstr_end); x_pos_next = boost::algorithm::find_first(it_range, L"_x").begin(); #else diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Crypt/rtl/cipher.h b/ASCOfficeXlsFile2/source/XlsFormat/Crypt/rtl/cipher.h index 61193823b35..62b81eececa 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Crypt/rtl/cipher.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Crypt/rtl/cipher.h @@ -33,7 +33,7 @@ #include -#ifdef __linux__ +#if defined(__linux__) || defined(__FreeBSD__) #include #endif diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Crypt/rtl/digest.h b/ASCOfficeXlsFile2/source/XlsFormat/Crypt/rtl/digest.h index 66b2e31ee27..88c751310fd 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Crypt/rtl/digest.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Crypt/rtl/digest.h @@ -31,7 +31,7 @@ */ #pragma once -#ifdef __linux__ +#if defined(__linux__) || defined(__FreeBSD__) #include #endif diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BitMarkedStructs.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BitMarkedStructs.h index a0d67957815..44a452b1d2f 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BitMarkedStructs.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BitMarkedStructs.h @@ -31,7 +31,7 @@ */ #pragma once -#ifdef __linux__ +#if defined(__linux__) || defined(__FreeBSD__) #include #endif diff --git a/Common/3dParty/boost/boost.pri b/Common/3dParty/boost/boost.pri index 8287c972958..f054f2815a9 100644 --- a/Common/3dParty/boost/boost.pri +++ b/Common/3dParty/boost/boost.pri @@ -1,5 +1,11 @@ -INCLUDEPATH += $$PWD/build/$$CORE_BUILDS_PLATFORM_PREFIX/include -CORE_BOOST_LIBS = $$PWD/build/$$CORE_BUILDS_PLATFORM_PREFIX/lib +!core_freebsd { + INCLUDEPATH += $$PWD/build/$$CORE_BUILDS_PLATFORM_PREFIX/include + CORE_BOOST_LIBS = $$PWD/build/$$CORE_BUILDS_PLATFORM_PREFIX/lib +} +core_freebsd { + INCLUDEPATH += /usr/local/include + CORE_BOOST_LIBS = /usr/local/lib +} core_android { INCLUDEPATH += $$PWD/build/android/include diff --git a/Common/3dParty/icu/icu.pri b/Common/3dParty/icu/icu.pri index 424edb38150..c632e4c5069 100644 --- a/Common/3dParty/icu/icu.pri +++ b/Common/3dParty/icu/icu.pri @@ -11,10 +11,17 @@ core_windows { } core_linux { - INCLUDEPATH += $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/usr/local/include + !core_freebsd { + INCLUDEPATH += $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/usr/local/include + + LIBS += $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/build/libicuuc.so.$$ICU_MAJOR_VER + LIBS += $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/build/libicudata.so.$$ICU_MAJOR_VER + } + core_freebsd { + INCLUDEPATH += /usr/local/include + LIBS += -licuuc -l icudata + } - LIBS += $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/build/libicuuc.so.$$ICU_MAJOR_VER - LIBS += $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/build/libicudata.so.$$ICU_MAJOR_VER } core_mac { diff --git a/Common/3dParty/v8/v8.pri b/Common/3dParty/v8/v8.pri index a59f0b5693f..5d0ce50b17a 100644 --- a/Common/3dParty/v8/v8.pri +++ b/Common/3dParty/v8/v8.pri @@ -20,15 +20,22 @@ core_windows { } core_linux { - SNAPSHOT_LIB=v8_snapshot - !exists($$CORE_V8_PATH_LIBS/libv8_snapshot.a) { - SNAPSHOT_LIB=v8_nosnapshot + !core_freebsd { + SNAPSHOT_LIB=v8_snapshot + !exists($$CORE_V8_PATH_LIBS/libv8_snapshot.a) { + SNAPSHOT_LIB=v8_nosnapshot + } + + LIBS += -L$$CORE_V8_PATH_LIBS -lv8_base -lv8_libplatform -lv8_libbase -l$$SNAPSHOT_LIB -lv8_libsampler + LIBS += -L$$CORE_V8_PATH_LIBS/third_party/icu -licui18n -licuuc + } + core_freebsd { + INCLUDEPATH += /usr/local/include/node + LIBS += -lnode } - - LIBS += -L$$CORE_V8_PATH_LIBS -lv8_base -lv8_libplatform -lv8_libbase -l$$SNAPSHOT_LIB -lv8_libsampler - LIBS += -L$$CORE_V8_PATH_LIBS/third_party/icu -licui18n -licuuc } + core_mac { LIBS += -L$$CORE_V8_PATH_LIBS -lv8_base -lv8_libplatform -lv8_libbase -lv8_snapshot -lv8_libsampler diff --git a/Common/DocxFormat/Source/Base/Types_32.h b/Common/DocxFormat/Source/Base/Types_32.h index 394a8eb9a79..9baf26bf2c6 100644 --- a/Common/DocxFormat/Source/Base/Types_32.h +++ b/Common/DocxFormat/Source/Base/Types_32.h @@ -38,7 +38,7 @@ typedef unsigned __int16 _UINT16; typedef unsigned __int32 _UINT32; typedef unsigned __int64 _UINT64; -#elif __linux__ +#elif defined(__linux__) || defined(__FreeBSD__) typedef int16_t _INT16; typedef int32_t _INT32; typedef int64_t _INT64; diff --git a/Common/DocxFormat/Source/DocxFormat/Docx.cpp b/Common/DocxFormat/Source/DocxFormat/Docx.cpp index 3609fe3c1c8..7d3f9aa830a 100644 --- a/Common/DocxFormat/Source/DocxFormat/Docx.cpp +++ b/Common/DocxFormat/Source/DocxFormat/Docx.cpp @@ -67,7 +67,7 @@ namespace OOX { void CDocx::FixAfterRead() { //solve id conflict between comments and documentComments - if(NULL != m_pComments && m_pComments->m_arrComments.size() > 0 && NULL != m_pDocumentComments && NULL != m_pDocumentComments->m_arrComments.size() > 0) + if(NULL != m_pComments && m_pComments->m_arrComments.size() > 0 && NULL != m_pDocumentComments && m_pDocumentComments->m_arrComments.size() > 0) { int maxId = INT_MIN; for (size_t i = 0; i < m_pComments->m_arrComments.size(); ++i) diff --git a/Common/DocxFormat/Source/XlsxFormat/Common.cpp b/Common/DocxFormat/Source/XlsxFormat/Common.cpp index 7c397657237..b7a6077cab5 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Common.cpp +++ b/Common/DocxFormat/Source/XlsxFormat/Common.cpp @@ -48,6 +48,11 @@ char* gcvt(double x, int n, char* b) #define _gcvt gcvt #endif +#ifdef __FreeBSD__ +#define _gcvt(x,n,b) sprintf(b, "%.17g", x) +#endif + + #define DBL_MAX 15 #define DBL_MAXDIG10 17 diff --git a/Common/base.pri b/Common/base.pri index d8c41ff4329..421b2355f84 100644 --- a/Common/base.pri +++ b/Common/base.pri @@ -105,6 +105,13 @@ linux-g++:contains(DST_ARCH, arm): { } } +freebsd-clang { + message("freebsd-clang") + CONFIG += core_linux + CONFIG += core_linux_64 + CONFIG += core_freebsd +} + linux-g++-64 { message("linux-64") CONFIG += core_linux diff --git a/DesktopEditor/agg-2.4/include/agg_math.h b/DesktopEditor/agg-2.4/include/agg_math.h index 58d99bfa9ef..f8f883affb1 100644 --- a/DesktopEditor/agg-2.4/include/agg_math.h +++ b/DesktopEditor/agg-2.4/include/agg_math.h @@ -431,7 +431,7 @@ namespace agg } } -#if defined(_LINUX) || defined(__APPLE__) +#if defined(_LINUX) || defined(__APPLE__) || defined(__FreeBSD__) inline double _hypot(const double& x, const double& y) { return sqrt(x * x + y * y); diff --git a/DesktopEditor/agg-2.4/include/agg_span_gradient.h b/DesktopEditor/agg-2.4/include/agg_span_gradient.h index 8543a4dcc2d..e77ff2b7d78 100644 --- a/DesktopEditor/agg-2.4/include/agg_span_gradient.h +++ b/DesktopEditor/agg-2.4/include/agg_span_gradient.h @@ -24,7 +24,7 @@ namespace agg { -#if !defined(_LINUX) && !(defined(_WIN32) || defined (_WIN64)) && !defined(__APPLE__) +#if !defined(_LINUX) && !defined(__FreeBSD__) && !(defined(_WIN32) || defined (_WIN64)) && !defined(__APPLE__) double _hypot(double x, double y) { return sqrt(x*x + y*y); diff --git a/DesktopEditor/common/Directory.cpp b/DesktopEditor/common/Directory.cpp index 0f9d33fd700..4ce14ff4892 100644 --- a/DesktopEditor/common/Directory.cpp +++ b/DesktopEditor/common/Directory.cpp @@ -35,7 +35,7 @@ #include "windef.h" #include #include -#elif __linux__ +#elif defined(__linux__) || defined(__FreeBSD__) #include #include #include @@ -120,7 +120,7 @@ namespace NSDirectory FindClose( hRes ); #endif -#ifdef __linux__ +#if defined(__linux__) || defined(__FreeBSD__) BYTE* pUtf8 = NULL; LONG lLen = 0; NSFile::CUtf8Converter::GetUtf8StringFromUnicode(strDirectory.c_str(), strDirectory.length(), pUtf8, lLen, false); @@ -233,7 +233,7 @@ namespace NSDirectory } } while( FindNextFileW( hRes, &oFD ) ); FindClose( hRes ); -#elif __linux__ +#elif defined(__linux__) || defined(__FreeBSD__) BYTE* pUtf8 = NULL; LONG lLen = 0; NSFile::CUtf8Converter::GetUtf8StringFromUnicode(strDirectory.c_str(), strDirectory.length(), pUtf8, lLen, false); @@ -297,7 +297,7 @@ namespace NSDirectory #if defined(_WIN32) || defined (_WIN64) DWORD dwAttrib = ::GetFileAttributesW(strDirectory.c_str()); return (dwAttrib != INVALID_FILE_ATTRIBUTES && 0 != (dwAttrib & FILE_ATTRIBUTE_DIRECTORY)); -#elif __linux__ +#elif defined(__linux__) || defined(__FreeBSD__) BYTE* pUtf8 = NULL; LONG lLen = 0; NSFile::CUtf8Converter::GetUtf8StringFromUnicode(strDirectory.c_str(), strDirectory.length(), pUtf8, lLen, false); @@ -491,7 +491,7 @@ namespace NSDirectory } #if defined(_WIN32) || defined (_WIN64) if (deleteRoot) RemoveDirectoryW(strDirectory.c_str()); -#elif __linux__ +#elif defined(__linux__) || defined(__FreeBSD__) BYTE* pUtf8 = NULL; LONG lLen = 0; NSFile::CUtf8Converter::GetUtf8StringFromUnicode(strDirectory.c_str(), strDirectory.length(), pUtf8, lLen, false); diff --git a/DesktopEditor/common/File.cpp b/DesktopEditor/common/File.cpp index 34dd27f5e86..41e3454421f 100644 --- a/DesktopEditor/common/File.cpp +++ b/DesktopEditor/common/File.cpp @@ -39,10 +39,14 @@ #include #endif -#if defined(__linux__) || defined(_MAC) && !defined(_IOS) +#if defined(__linux__) || defined(__FreeBSD__) || defined(_MAC) && !defined(_IOS) #include #include #include +#if defined(__FreeBSD__) +#include +#include +#endif #endif #ifdef _IOS @@ -1522,6 +1526,22 @@ namespace NSFile return sRet; #endif +#if defined(__FreeBSD__) + int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1}; + char buf[NS_FILE_MAX_PATH]; + size_t size = NS_FILE_MAX_PATH; + + memset(buf, 0, NS_FILE_MAX_PATH); + if (sysctl(mib, 4, &buf, &size, NULL, 0) != 0) { + size = readlink("/proc/curproc/file", buf, size - 1); + if (size < 0) + return L""; + } + std::string sUTF8(buf); + std::wstring sRet = CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)sUTF8.c_str(), sUTF8.length()); + return sRet; +#endif + return L""; } diff --git a/DesktopEditor/common/Path.cpp b/DesktopEditor/common/Path.cpp index 4508dc2a0b3..0718fffa259 100644 --- a/DesktopEditor/common/Path.cpp +++ b/DesktopEditor/common/Path.cpp @@ -34,7 +34,7 @@ #if defined(_WIN32) || defined (_WIN64) #include -#elif __linux__ || MAC +#elif __linux__ || __FreeBSD__ || MAC #include #endif @@ -53,7 +53,7 @@ namespace NSSystemPath sRes.append(tFolder); if(sRes.length() > 0) sRes.erase(sRes.length()-1); -#elif __linux__ || MAC +#elif __linux__ || __FreeBSD__ || MAC BYTE* pUtf8 = NULL; LONG lLen = 0; NSFile::CUtf8Converter::GetUtf8StringFromUnicode(strFileName.c_str(), strFileName.length(), pUtf8, lLen, false); @@ -73,7 +73,7 @@ namespace NSSystemPath sRes.append(tFilename); sRes.append(tExt); return sRes; -#elif __linux__ || MAC +#elif __linux__ || __FreeBSD__ || MAC BYTE* pUtf8 = NULL; LONG lLen = 0; NSFile::CUtf8Converter::GetUtf8StringFromUnicode(strFileName.c_str(), strFileName.length(), pUtf8, lLen, false); diff --git a/DesktopEditor/common/Types.h b/DesktopEditor/common/Types.h index 812b5952045..ec4abf057c5 100644 --- a/DesktopEditor/common/Types.h +++ b/DesktopEditor/common/Types.h @@ -78,7 +78,7 @@ typedef int INT; typedef unsigned int UINT, *PUINT; typedef wchar_t WCHAR; -#ifdef __linux__ +#if defined(__linux__) || defined(__FreeBSD__) #include typedef int64_t T_LONG64; typedef uint64_t T_ULONG64; diff --git a/DesktopEditor/cximage/CxImage/ximage.h b/DesktopEditor/cximage/CxImage/ximage.h index 61f8f4aa533..3600e7aa520 100644 --- a/DesktopEditor/cximage/CxImage/ximage.h +++ b/DesktopEditor/cximage/CxImage/ximage.h @@ -52,7 +52,7 @@ #pragma once #endif -#ifdef _LINUX +#if defined(_LINUX) || defined(__FreeBSD__) #define _XOPEN_SOURCE #include #include diff --git a/DesktopEditor/cximage/CxImage/ximainfo.cpp b/DesktopEditor/cximage/CxImage/ximainfo.cpp index e3a278c0c0f..1ed13adafdd 100644 --- a/DesktopEditor/cximage/CxImage/ximainfo.cpp +++ b/DesktopEditor/cximage/CxImage/ximainfo.cpp @@ -5,7 +5,7 @@ #include "ximage.h" -#if defined(_LINUX) || defined(__APPLE__) +#if defined(_LINUX) || defined(__APPLE__) || defined(__FreeBSD__) #ifdef UNICODE #define _tcsnicmp(a,b,c) wcscasecmp(a,b) #else diff --git a/DesktopEditor/cximage/CxImage/ximajas.h b/DesktopEditor/cximage/CxImage/ximajas.h index 24781ee4d88..76f639ae612 100644 --- a/DesktopEditor/cximage/CxImage/ximajas.h +++ b/DesktopEditor/cximage/CxImage/ximajas.h @@ -16,7 +16,7 @@ #if CXIMAGE_SUPPORT_JASPER -#ifdef _LINUX +#if defined(_LINUX) || defined(__FreeBSD__) #include #else #include "../jasper/include/jasper/jasper.h" diff --git a/DesktopEditor/cximage/CxImage/ximajpg.cpp b/DesktopEditor/cximage/CxImage/ximajpg.cpp index 686dc180715..8f410b21191 100644 --- a/DesktopEditor/cximage/CxImage/ximajpg.cpp +++ b/DesktopEditor/cximage/CxImage/ximajpg.cpp @@ -9,7 +9,7 @@ #if CXIMAGE_SUPPORT_JPG -#ifdef _LINUX +#if defined(_LINUX) || defined(__FreeBSD__) #include #else #include "../jpeg/jmorecfg.h" diff --git a/DesktopEditor/cximage/CxImage/ximajpg.h b/DesktopEditor/cximage/CxImage/ximajpg.h index 4cb2484a8b7..74160700c6a 100644 --- a/DesktopEditor/cximage/CxImage/ximajpg.h +++ b/DesktopEditor/cximage/CxImage/ximajpg.h @@ -29,7 +29,7 @@ #define CXIMAGEJPG_SUPPORT_EXIF CXIMAGE_SUPPORT_EXIF extern "C" { -#ifdef _LINUX +#if defined(_LINUX) || defined(__FreeBSD__) #include #include #else diff --git a/DesktopEditor/cximage/CxImage/ximapng.h b/DesktopEditor/cximage/CxImage/ximapng.h index cf9c4a5d577..0056f0d3e53 100644 --- a/DesktopEditor/cximage/CxImage/ximapng.h +++ b/DesktopEditor/cximage/CxImage/ximapng.h @@ -22,7 +22,7 @@ #if CXIMAGE_SUPPORT_PNG extern "C" { -#ifdef _LINUX +#if defined(_LINUX) || defined(__FreeBSD__) #undef _DLL #include #include diff --git a/DesktopEditor/cximage/CxImage/ximaraw.cpp b/DesktopEditor/cximage/CxImage/ximaraw.cpp index e5661d20055..506398b4bdc 100644 --- a/DesktopEditor/cximage/CxImage/ximaraw.cpp +++ b/DesktopEditor/cximage/CxImage/ximaraw.cpp @@ -200,7 +200,7 @@ bool CxImageRAW::Decode(CxFile *hFile) for (c=0; c < dcr.colors; c++) ppm2[col*dcr.colors+c] = dcr.image[soff][c]; } if (dcr.opt.output_bps == 16 && !dcr.opt.output_tiff && htons(0x55aa) != 0x55aa) -#if defined(_LINUX) || defined(__APPLE__) +#if defined(_LINUX) || defined(__APPLE__) || defined(__FreeBSD__) swab ((char*)ppm2, (char*)ppm2, dcr.width*dcr.colors*2); #else _swab ((char*)ppm2, (char*)ppm2, dcr.width*dcr.colors*2); diff --git a/DesktopEditor/cximage/raw/libdcr.h b/DesktopEditor/cximage/raw/libdcr.h index 34e10b66707..c6eca84de4b 100644 --- a/DesktopEditor/cximage/raw/libdcr.h +++ b/DesktopEditor/cximage/raw/libdcr.h @@ -42,7 +42,7 @@ #include #endif -#if defined(_LINUX) || defined(__APPLE__) +#if defined(_LINUX) || defined(__APPLE__) || defined(__FreeBSD__) #include #include #define _getcwd getcwd diff --git a/DesktopEditor/cximage/tiff/tif_config.h b/DesktopEditor/cximage/tiff/tif_config.h index 76e55df816f..544a2be4de0 100644 --- a/DesktopEditor/cximage/tiff/tif_config.h +++ b/DesktopEditor/cximage/tiff/tif_config.h @@ -19,7 +19,7 @@ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ -#ifndef _LINUX +#if !defined(_LINUX) && !defined(__FreeBSD__) #define HAVE_IO_H 1 #endif @@ -35,7 +35,7 @@ /* The size of a `long', as computed by sizeof. */ #define SIZEOF_LONG 4 -#ifndef _LINUX +#if !defined(_LINUX) && !defined(__FreeBSD__) /* Signed 64-bit type */ #define TIFF_INT64_T signed __int64 @@ -43,7 +43,7 @@ #define TIFF_UINT64_T unsigned __int64 #endif -#ifdef _LINUX +#if defined(_LINUX) || defined(__FreeBSD__) #include /* Signed 64-bit type */ @@ -69,7 +69,7 @@ //# endif //#endif -#ifndef _LINUX +#if !defined(_LINUX) && !defined(__FreeBSD__) #define lfind _lfind #endif /* diff --git a/DesktopEditor/cximage/tiff/tiffconf.h b/DesktopEditor/cximage/tiff/tiffconf.h index be746e6ea8a..9b0ed761422 100644 --- a/DesktopEditor/cximage/tiff/tiffconf.h +++ b/DesktopEditor/cximage/tiff/tiffconf.h @@ -33,7 +33,7 @@ #define TIFF_UINT64_T unsigned __int64 #endif -#ifdef _LINUX +#if defined(_LINUX) || defined(__FreeBSD__) #include /* Signed 64-bit type */ diff --git a/DesktopEditor/cximage/tiff/tiffiop.h b/DesktopEditor/cximage/tiff/tiffiop.h index f85b923482d..30855611243 100644 --- a/DesktopEditor/cximage/tiff/tiffiop.h +++ b/DesktopEditor/cximage/tiff/tiffiop.h @@ -62,8 +62,12 @@ extern void *lfind(const void *, const void *, size_t *, size_t, Libtiff itself does not require a 64-bit type, but bundled TIFF utilities may use it. */ +#ifndef TIFF_INT64_T typedef TIFF_INT64_T int64; +#endif +#ifndef TIFF_UINT64_T typedef TIFF_UINT64_T uint64; +#endif #endif diff --git a/DesktopEditor/doctrenderer/app_builder/main.cpp b/DesktopEditor/doctrenderer/app_builder/main.cpp index d9ced92b29b..fd68ed3a3b7 100644 --- a/DesktopEditor/doctrenderer/app_builder/main.cpp +++ b/DesktopEditor/doctrenderer/app_builder/main.cpp @@ -34,7 +34,7 @@ #include "../docbuilder.h" #include "../../common/File.h" -#ifdef LINUX +#if defined(LINUX) || defined(__FreeBSD__) #include "../../../DesktopEditor/common/File.h" #endif diff --git a/DesktopEditor/doctrenderer/docbuilder_p.h b/DesktopEditor/doctrenderer/docbuilder_p.h index 59108560ed2..f834e1d49f3 100644 --- a/DesktopEditor/doctrenderer/docbuilder_p.h +++ b/DesktopEditor/doctrenderer/docbuilder_p.h @@ -50,7 +50,7 @@ #include "nativebuilder.h" #include -#ifdef LINUX +#if defined(LINUX) || defined(__FreeBSD__) #include #include #include @@ -645,7 +645,7 @@ namespace NSDoctRenderer #endif - #ifdef LINUX + #if defined(LINUX) || defined(__FreeBSD__) pid_t pid = fork(); // create child process int status; @@ -935,7 +935,7 @@ namespace NSDoctRenderer #endif - #ifdef LINUX + #if defined(LINUX) || defined(__FreeBSD__) pid_t pid = fork(); // create child process int status; diff --git a/DesktopEditor/fontengine/ApplicationFonts.cpp b/DesktopEditor/fontengine/ApplicationFonts.cpp index 32daceeb69c..cdac232631b 100644 --- a/DesktopEditor/fontengine/ApplicationFonts.cpp +++ b/DesktopEditor/fontengine/ApplicationFonts.cpp @@ -1642,6 +1642,10 @@ void CApplicationFonts::Initialize(bool bIsCheckSelection) m_oList.LoadFromFolder(L"/usr/share/fonts"); #endif +#if defined (__FreeBSD__) + m_oList.LoadFromFolder(L"/usr/local/share/fonts"); +#endif + #if defined(_MAC) && !defined(_IOS) m_oList.LoadFromFolder(L"/Library/Fonts/"); #endif diff --git a/DesktopEditor/fontengine/MemoryStream.h b/DesktopEditor/fontengine/MemoryStream.h index 50568d4a0bc..a99f3090149 100644 --- a/DesktopEditor/fontengine/MemoryStream.h +++ b/DesktopEditor/fontengine/MemoryStream.h @@ -41,7 +41,7 @@ //#define _LOGGING_NATIVE_ #endif -#ifdef _LINUX +#if defined(_LINUX) || defined(__FreeBSD__) #include #endif diff --git a/DesktopEditor/fontengine/fontconverter/MemoryUtils.h b/DesktopEditor/fontengine/fontconverter/MemoryUtils.h index ebb15196c35..2644a2bc1bf 100644 --- a/DesktopEditor/fontengine/fontconverter/MemoryUtils.h +++ b/DesktopEditor/fontengine/fontconverter/MemoryUtils.h @@ -37,7 +37,7 @@ #include #include -#ifdef __linux__ +#ifdef __linux__ || __FreeBSD__ #include #endif diff --git a/DesktopEditor/graphics/Graphics.cpp b/DesktopEditor/graphics/Graphics.cpp index 149d8bf8358..012b6dd778b 100644 --- a/DesktopEditor/graphics/Graphics.cpp +++ b/DesktopEditor/graphics/Graphics.cpp @@ -60,7 +60,7 @@ namespace Aggplus m_dGlobalAlpha = 1.0; m_bSwapRGB = false; -#if defined (_LINUX) || defined (_QT) +#if defined (_LINUX) || defined (_QT) || defined(__FreeBSD__) m_bSwapRGB = true; #endif @@ -93,7 +93,7 @@ namespace Aggplus m_bSwapRGB = false; -#if defined (_LINUX) || defined (_QT) +#if defined (_LINUX) || defined (_QT) || defined(__FreeBSD__) m_bSwapRGB = true; #endif @@ -131,7 +131,7 @@ namespace Aggplus m_bSwapRGB = false; -#if defined (_LINUX) || defined (_QT) +#if defined (_LINUX) || defined (_QT) || defined(_FreeBSD__) m_bSwapRGB = true; #endif diff --git a/DesktopEditor/raster/Metafile/Wmf/WmfObjects.h b/DesktopEditor/raster/Metafile/Wmf/WmfObjects.h index 8f27b011141..874e4f98ffc 100644 --- a/DesktopEditor/raster/Metafile/Wmf/WmfObjects.h +++ b/DesktopEditor/raster/Metafile/Wmf/WmfObjects.h @@ -37,7 +37,7 @@ #include "WmfTypes.h" -#ifdef __linux__ +#ifdef __linux__ || __FreeBSD__ #include //memset oO #endif namespace MetaFile diff --git a/DesktopEditor/xml/libxml2/trionan.c b/DesktopEditor/xml/libxml2/trionan.c index 74313efd71d..a1493d13e1f 100644 --- a/DesktopEditor/xml/libxml2/trionan.c +++ b/DesktopEditor/xml/libxml2/trionan.c @@ -51,7 +51,7 @@ # include #endif #if defined(TRIO_COMPILER_DECC) -# if defined(__linux__) +# if defined(__linux__) || defined(__FreeBSD__) # include # else # include @@ -85,7 +85,7 @@ # error "Must be compiled with option -ieee" # endif # endif -# elif defined(TRIO_COMPILER_GCC) && (defined(__osf__) || defined(__linux__)) +# elif defined(TRIO_COMPILER_GCC) && (defined(__osf__) || defined(__linux__)) || defined(__FreeBSD__) # error "Must be compiled with option -mieee" # endif #endif /* __alpha && ! _IEEE_FP */ diff --git a/DesktopEditor/xmlsec/src/src/XmlCertificate.cpp b/DesktopEditor/xmlsec/src/src/XmlCertificate.cpp index 11664c2d7a0..78cf0e6dc7f 100644 --- a/DesktopEditor/xmlsec/src/src/XmlCertificate.cpp +++ b/DesktopEditor/xmlsec/src/src/XmlCertificate.cpp @@ -19,7 +19,7 @@ namespace NSOpenSSL #include "../../../common/File.h" -#if defined(_LINUX) && !defined(_MAC) +#if (defined(_LINUX) || defined(__FreeBSD__)) && !defined(_MAC) #include "./XmlSigner_openssl.h" #define XML_CERTIFICATE_USE_OPENSSL #define CCertificate CCertificate_openssl diff --git a/HtmlFile/HtmlFile.cpp b/HtmlFile/HtmlFile.cpp index 0ab4fa30766..f5761d209c8 100644 --- a/HtmlFile/HtmlFile.cpp +++ b/HtmlFile/HtmlFile.cpp @@ -45,7 +45,7 @@ #include #include -#ifdef LINUX +#if defined(LINUX) || defined(__FreeBSD__) #include #include #include @@ -475,7 +475,7 @@ int CHtmlFile::Convert(const std::vector& arFiles, const std::wstr NSFile::CFileBinary::Remove(sTempFileForParams); #endif -#ifdef LINUX +#if defined(LINUX) || defined(__FreeBSD__) std::wstring sTempFileForParams = NSFile::CFileBinary::CreateTempFileWithUniqueName(NSFile::CFileBinary::GetTempPath(), L"XML"); NSFile::CFileBinary oFile; oFile.CreateFileW(sTempFileForParams); diff --git a/Makefile b/Makefile index cbcf30b568a..4250d091769 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,10 @@ ifeq ($(UNAME_M),x86_64) ARCHITECTURE := 64 ARCH_SUFFIX := x64 endif +ifeq ($(UNAME_M),amd64) + ARCHITECTURE := 64 + ARCH_SUFFIX := x64 +endif ifneq ($(filter %86,$(UNAME_M)),) ARCHITECTURE := 32 ARCH_SUFFIX := x86 @@ -40,6 +44,18 @@ else PACKAGE_VERSION := $(PRODUCT_VERSION)-$(BUILD_NUMBER) ARCH_REPO_DIR := linux endif + ifeq ($(UNAME_S),FreeBSD) + PLATFORM := linux + SHARED_EXT := .so* + SHELL_EXT := .sh + LIB_EXT := .a + LIB_PREFIX := lib + ARCH_EXT := .tar.gz + MAKE := gmake + AR := tar -zcvf + PACKAGE_VERSION := $(PRODUCT_VERSION)-$(BUILD_NUMBER) + ARCH_REPO_DIR := linux + endif ifeq ($(UNAME_S),Darwin) PLATFORM := mac SHARED_EXT := .dylib diff --git a/OfficeUtils/src/zlib-1.2.11/contrib/minizip/miniunz.c b/OfficeUtils/src/zlib-1.2.11/contrib/minizip/miniunz.c index 715b27f58ce..908e5148e2c 100644 --- a/OfficeUtils/src/zlib-1.2.11/contrib/minizip/miniunz.c +++ b/OfficeUtils/src/zlib-1.2.11/contrib/minizip/miniunz.c @@ -97,7 +97,7 @@ void change_file_date(filename,dosdate,tmu_date) SetFileTime(hFile,&ftm,&ftLastAcc,&ftm); CloseHandle(hFile); #else -#if defined(unix) || defined(_LINUX) || defined(__APPLE__) +#if defined(unix) || defined(_LINUX) || defined(__APPLE__) || defined(__FreeBSD__) struct utimbuf ut; struct tm newdate; newdate.tm_sec = tmu_date.tm_sec; diff --git a/OfficeUtils/src/zlib-1.2.11/contrib/minizip/minizip.c b/OfficeUtils/src/zlib-1.2.11/contrib/minizip/minizip.c index 36afed644cb..b7e82c54fdd 100644 --- a/OfficeUtils/src/zlib-1.2.11/contrib/minizip/minizip.c +++ b/OfficeUtils/src/zlib-1.2.11/contrib/minizip/minizip.c @@ -94,7 +94,7 @@ uLong filetime(f, tmzip, dt) return ret; } #else -#if defined(unix) || defined(_LINUX) || defined(__APPLE__) +#if defined(unix) || defined(_LINUX) || defined(__APPLE__) || defined(__FreeBSD__) uLong filetime(f, tmzip, dt) char *f; /* name of file to get info on */ tm_zip *tmzip; /* return value: access, modific. and creation times */ diff --git a/PdfWriter/Src/Types.h b/PdfWriter/Src/Types.h index bf126327a3d..00f3c2d1ed3 100644 --- a/PdfWriter/Src/Types.h +++ b/PdfWriter/Src/Types.h @@ -46,7 +46,7 @@ #include #include -#ifdef __linux__ +#if defined(__linux__) || defined(__FreeBSD__) #include #endif diff --git a/Test/Applications/StandardTester/main.cpp b/Test/Applications/StandardTester/main.cpp index dda9eb82fa0..bd65cef32a2 100644 --- a/Test/Applications/StandardTester/main.cpp +++ b/Test/Applications/StandardTester/main.cpp @@ -13,7 +13,7 @@ #include "../../../DesktopEditor/fontengine/application_generate_fonts.h" -#ifdef LINUX +#if defined(LINUX) || defined(__FreeBSD__) #include #include #include @@ -176,7 +176,7 @@ namespace NSX2T #endif -#ifdef LINUX +#if defined(LINUX) || defined(__FreeBSD__) pid_t pid = fork(); // create child process int status; diff --git a/UnicodeConverter/icubuilds-mac/icu/unicode/platform.h b/UnicodeConverter/icubuilds-mac/icu/unicode/platform.h index 471caa233f7..0bd7aaf3159 100644 --- a/UnicodeConverter/icubuilds-mac/icu/unicode/platform.h +++ b/UnicodeConverter/icubuilds-mac/icu/unicode/platform.h @@ -150,7 +150,7 @@ # include #elif defined(__native_client__) # define U_PLATFORM U_PF_BROWSER_NATIVE_CLIENT -#elif defined(linux) || defined(__linux__) || defined(__linux) +#elif defined(linux) || defined(__linux__) || defined(__linux) || defined(__FreeBSD__) # define U_PLATFORM U_PF_LINUX #elif defined(__APPLE__) && defined(__MACH__) # include diff --git a/X2tConverter/src/ASCConverters.cpp b/X2tConverter/src/ASCConverters.cpp index b917ac2bf6f..87d31bedfb6 100644 --- a/X2tConverter/src/ASCConverters.cpp +++ b/X2tConverter/src/ASCConverters.cpp @@ -4044,7 +4044,7 @@ namespace NExtractTools { bool bMacros = true; - _UINT32 nRes = ConvertXls2Xlsx( sFrom, sTo, params.getPassword(), params.getFontPath(), sTemp, NULL, bMacros); + _UINT32 nRes = ConvertXls2Xlsx( sFrom, sTo, params.getPassword(), params.getFontPath(), sTemp, 0, bMacros); nRes = processEncryptionError(nRes, sFrom, params); return nRes; @@ -4077,7 +4077,7 @@ namespace NExtractTools NSDirectory::CreateDirectory(sResultXlsxDir); bool bMacros = true; - _UINT32 nRes = ConvertXls2Xlsx( sFrom, sResultXlsxDir, params.getPassword(), params.getFontPath(), sTemp, NULL, bMacros); + _UINT32 nRes = ConvertXls2Xlsx( sFrom, sResultXlsxDir, params.getPassword(), params.getFontPath(), sTemp, 0, bMacros); nRes = processEncryptionError(nRes, sFrom, params); if (SUCCEEDED_X2T(nRes)) diff --git a/X2tConverter/test/batch_convert/x2t_test/mainwindow.cpp b/X2tConverter/test/batch_convert/x2t_test/mainwindow.cpp index b8d4cc1cc98..d00510b4ac5 100644 --- a/X2tConverter/test/batch_convert/x2t_test/mainwindow.cpp +++ b/X2tConverter/test/batch_convert/x2t_test/mainwindow.cpp @@ -85,7 +85,7 @@ class CDirectoryParse : public NSThreads::CBaseThread CApplicationFonts oApplication; std::vector strFontsW_Cur = oApplication.GetSetupFontFiles(); -#if defined(_LINUX) +#if defined(_LINUX) || defined(__FreeBSD__) std::wstring sHome = GetHomeDirectory(); if (!sHome.empty()) { @@ -767,7 +767,7 @@ class CConverter : public NSThreads::CBaseThread #endif -#ifdef LINUX +#if defined(LINUX) || defined(__FreeBSD__) pid_t pid = fork(); // create child process int status;