diff --git a/ASCOfficeDocFile/DocDocxConverter/StringTable.h b/ASCOfficeDocFile/DocDocxConverter/StringTable.h index 9ee5fb69f..a4e384f2d 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/ASCOfficeRtfFile/RtfFormatLib/source/Utils.h b/ASCOfficeRtfFile/RtfFormatLib/source/Utils.h index f81888863..0bd0d6d34 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Utils.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Utils.h @@ -709,7 +709,7 @@ public: sResult.erase(outsize_with_0 - 1); ansi = false; } -#elif defined(__linux__) +#elif defined(__linux__) || defined(__FreeBSD__) std::string sCodepage = "CP" + std::to_string(nCodepage); iconv_t ic= iconv_open("WCHAR_T", sCodepage.c_str()); diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Auxiliary/HelpFunc.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Auxiliary/HelpFunc.cpp index 85fd53feb..745da4df5 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 @@ -469,7 +469,7 @@ std::wstring toStdWStringSystem(std::string ansi_string, const unsigned int code sResult.erase(outsize_with_0 - 1); ansi = false; } -#elif defined(__linux__) +#elif defined(__linux__) || defined(__FreeBSD__) std::string sCodepage = "CP" + std::to_string(code_page); iconv_t ic= iconv_open("WCHAR_T", sCodepage.c_str()); diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Crypt/rtl/cipher.h b/ASCOfficeXlsFile2/source/XlsFormat/Crypt/rtl/cipher.h index 61193823b..62b81eece 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 66b2e31ee..88c751310 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 a0d679578..44a452b1d 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/build.sh b/Common/3dParty/boost/build.sh index 946939c5d..d6a3178d9 100755 --- a/Common/3dParty/boost/build.sh +++ b/Common/3dParty/boost/build.sh @@ -3,9 +3,11 @@ SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" os=$(uname -s) platform="" +extra_args="" case "$os" in Linux*) platform="linux" ;; + FreeBSD*) platform="linux"; extra_args="--with-toolset=clang" ;; Darwin*) platform="mac" ;; *) exit ;; esac @@ -15,6 +17,7 @@ arch="" case "$architecture" in x86_64*) arch="_64" ;; + amd64*) arch="_64" ;; *) arch="_32" ;; esac @@ -25,7 +28,7 @@ cd "$SCRIPTPATH/boost_1_58_0" folder="build/$platform$arch" if [ ! -d $folder ]; then - ./bootstrap.sh --with-libraries=filesystem,system,date_time,regex + ./bootstrap.sh --with-libraries=filesystem,system,date_time,regex $extra_args stage="stage" if [ -d $stage ]; then diff --git a/Common/3dParty/boost/fetch.sh b/Common/3dParty/boost/fetch.sh index 0cf8ea457..9b81f7799 100755 --- a/Common/3dParty/boost/fetch.sh +++ b/Common/3dParty/boost/fetch.sh @@ -7,6 +7,7 @@ platform="" case "$os" in Linux*) platform="linux" ;; + FreeBSD*) platform="linux" ;; Darwin*) platform="mac" ;; *) exit ;; esac @@ -15,7 +16,7 @@ if [[ -f "$SCRIPTPATH/boost_1_58_0.7z" ]] then echo "boost already downloaded" else -wget $BOOST_URL || curl -O $BOOST_URL +wget $BOOST_URL || curl -L -O $BOOST_URL fi if [ -d "$SCRIPTPATH/boost_1_58_0" ]; then diff --git a/Common/3dParty/icu/fetch.sh b/Common/3dParty/icu/fetch.sh index c574a7e81..d21abd417 100755 --- a/Common/3dParty/icu/fetch.sh +++ b/Common/3dParty/icu/fetch.sh @@ -22,6 +22,14 @@ case "$os" in SHARED_LIB_EXT=.$SHARED_LIB_VER.dylib SHARED_LIB_SHORT_EXT=.$ICU_MAJOR_VER.dylib ;; + FreeBSD*) + # We use the standard ICU library also used by NodeJS + cat > icu.pri << EOF +INCLUDEPATH += /usr/local/include +LIBS += -licuuc -l icudata +EOF + exit + ;; *) exit ;; esac diff --git a/Common/3dParty/v8/fetch.sh b/Common/3dParty/v8/fetch.sh index 83406f924..ce51f6ab3 100755 --- a/Common/3dParty/v8/fetch.sh +++ b/Common/3dParty/v8/fetch.sh @@ -1,6 +1,17 @@ #!/bin/bash SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +os=$(uname -s) +platform="" +if [ "$os" == "FreeBSD" ]; then + # We use the standard V8 provided by the libnode. + cat > v8.pri << EOF +INCLUDEPATH += /usr/local/include/node +LIBS += -lnode +EOF + exit +fi + cd "$SCRIPTPATH" if [ ! -d "depot_tools" ] @@ -34,8 +45,6 @@ fi gclient sync --no-history -os=$(uname -s) -platform="" case "$os" in Linux*) platform="linux" ;; *) exit ;; diff --git a/Common/DocxFormat/Source/Base/Types_32.h b/Common/DocxFormat/Source/Base/Types_32.h index 394a8eb9a..9baf26bf2 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 3609fe3c1..7d3f9aa83 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 d3b3341ea..f09d5e245 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Common.cpp +++ b/Common/DocxFormat/Source/XlsxFormat/Common.cpp @@ -43,6 +43,11 @@ #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 97e02c654..c700acf4d 100644 --- a/Common/base.pri +++ b/Common/base.pri @@ -79,6 +79,12 @@ linux-g++:contains(DST_ARCH, arm): { } } +freebsd-clang { + message("freebsd-clang") + CONFIG += core_linux + CONFIG += core_linux_64 +} + 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 58d99bfa9..f8f883aff 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 8543a4dcc..e77ff2b7d 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 53e280ec2..0f831d980 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); @@ -379,7 +379,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 e29507ec5..fcb462a92 100644 --- a/DesktopEditor/common/File.cpp +++ b/DesktopEditor/common/File.cpp @@ -39,7 +39,7 @@ #include #endif -#if defined(__linux__) || defined(_MAC) && !defined(_IOS) +#if defined(__linux__) ||defined(__FreeBSD__) || defined(_MAC) && !defined(_IOS) #include #include #endif @@ -1468,7 +1468,7 @@ namespace NSFile return std::wstring(buf); #endif -#if defined(__linux__) || defined(_MAC) && !defined(_IOS) +#if defined(__linux__) || defined(__FreeBSD__) || defined(_MAC) && !defined(_IOS) char buf[NS_FILE_MAX_PATH]; memset(buf, 0, NS_FILE_MAX_PATH); if (readlink ("/proc/self/exe", buf, NS_FILE_MAX_PATH) <= 0) diff --git a/DesktopEditor/common/Path.cpp b/DesktopEditor/common/Path.cpp index 4508dc2a0..0718fffa2 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 d63f2ff25..9b71c8297 100644 --- a/DesktopEditor/common/Types.h +++ b/DesktopEditor/common/Types.h @@ -75,7 +75,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 61f8f4aa5..3600e7aa5 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 e3a278c0c..1ed13adaf 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 24781ee4d..76f639ae6 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 686dc1807..8f410b211 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 4cb2484a8..74160700c 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 cf9c4a5d5..0056f0d3e 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 af6dd0def..1f16858fc 100644 --- a/DesktopEditor/cximage/CxImage/ximaraw.cpp +++ b/DesktopEditor/cximage/CxImage/ximaraw.cpp @@ -204,7 +204,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 212c15a2e..a83bbe22b 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 _swab swab diff --git a/DesktopEditor/cximage/tiff/tif_config.h b/DesktopEditor/cximage/tiff/tif_config.h index 76e55df81..544a2be4d 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 be746e6ea..9b0ed7614 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 f85b92348..308556112 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 fa74f4a90..c065757db 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 5336a57c6..c1d4f2a57 100644 --- a/DesktopEditor/doctrenderer/docbuilder_p.h +++ b/DesktopEditor/doctrenderer/docbuilder_p.h @@ -50,7 +50,7 @@ #include "nativecontrol.h" #include -#ifdef LINUX +#if defined(LINUX) || defined(__FreeBSD__) #include #include #include @@ -1229,7 +1229,7 @@ namespace NSDoctRenderer #endif - #ifdef LINUX + #if defined(LINUX) || defined(__FreeBSD__) pid_t pid = fork(); // create child process int status; @@ -1462,7 +1462,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/MemoryStream.h b/DesktopEditor/fontengine/MemoryStream.h index 50568d4a0..a99f30901 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 ebb15196c..2644a2bc1 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 149d8bf83..012b6dd77 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/JBig2/source/LeptonLib/readfile.cpp b/DesktopEditor/raster/JBig2/source/LeptonLib/readfile.cpp index 2c398d5c6..e47a61b26 100644 --- a/DesktopEditor/raster/JBig2/source/LeptonLib/readfile.cpp +++ b/DesktopEditor/raster/JBig2/source/LeptonLib/readfile.cpp @@ -81,10 +81,10 @@ static const char JP2K_IMAGE_DATA[12] = { }; #else -static const char JP2K_CODESTREAM[4] = { 0xff, 0x4f, 0xff, 0x51 }; +static const char JP2K_CODESTREAM[4] = { (char)0xff, 0x4f, (char)0xff, 0x51 }; static const char JP2K_IMAGE_DATA[12] = { 0x00, 0x00, 0x00, 0x0C, 0x6A, 0x50, 0x20, 0x20, - 0x0D, 0x0A, 0x87, 0x0A }; + 0x0D, 0x0A, (char)0x87, 0x0A }; #endif /*---------------------------------------------------------------------* diff --git a/DesktopEditor/raster/Metafile/Wmf/WmfObjects.h b/DesktopEditor/raster/Metafile/Wmf/WmfObjects.h index 8f27b0111..874e4f98f 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 74313efd7..a1493d13e 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 11664c2d7..78cf0e6dc 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 dc70479a2..7d0039513 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 @@ -389,7 +389,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 182cfcabc..bfd557896 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 715b27f58..908e5148e 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 36afed644..b7e82c54f 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 bf126327a..00f3c2d1e 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 43bb458be..22a22284e 100644 --- a/Test/Applications/StandardTester/main.cpp +++ b/Test/Applications/StandardTester/main.cpp @@ -170,7 +170,7 @@ namespace NSX2T #endif -#ifdef LINUX +#if defined(LINUX) || defined(__FreeBSD__) pid_t pid = fork(); // create child process int status; @@ -712,7 +712,7 @@ void CheckFonts(const bool& bIsUseSystemFonts, std::vector& arDirs NSDirectory::GetFiles2(*i, strFontsW_Cur, true); } -#if defined(_LINUX) +#if defined(_LINUX) || defined(__FreeBSD__) std::wstring sHome = GetHomeDirectory(); if (!sHome.empty()) { diff --git a/UnicodeConverter/icubuilds-mac/icu/unicode/platform.h b/UnicodeConverter/icubuilds-mac/icu/unicode/platform.h index 471caa233..0bd7aaf31 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/test/batch_convert/x2t_test/mainwindow.cpp b/X2tConverter/test/batch_convert/x2t_test/mainwindow.cpp index b8d4cc1cc..d00510b4a 100644 --- a/X2tConverter/test/batch_convert/x2t_test/mainwindow.cpp +++ b/X2tConverter/test/batch_convert/x2t_test/mainwindow.cpp @@ -85,7 +85,7 @@ public: 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 @@ public: #endif -#ifdef LINUX +#if defined(LINUX) || defined(__FreeBSD__) pid_t pid = fork(); // create child process int status;