mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
mac worked version
This commit is contained in:
46
Common/3dParty/v8/build.sh
Normal file → Executable file
46
Common/3dParty/v8/build.sh
Normal file → Executable file
@ -22,49 +22,19 @@ case "$architecture" in
|
||||
*) arch="_32" ;;
|
||||
esac
|
||||
|
||||
if [[ -d "$SCRIPTPATH/$platform$arch" ]]
|
||||
then
|
||||
echo
|
||||
else
|
||||
mkdir "$SCRIPTPATH/$platform$arch"
|
||||
fi
|
||||
|
||||
cd "$SCRIPTPATH/v8"
|
||||
|
||||
if [[ "$platform" == *"linux"* ]]
|
||||
if [[ "$platform" == "linux" ]]
|
||||
then
|
||||
CFLAGS="-fPIC" CXXFLAGS="-fPIC" make native -j $(grep -c ^processor /proc/cpuinfo) GYPFLAGS=-Dclang=0
|
||||
gn gen out.gn/linux_64 --args='is_debug=false target_cpu="x64" v8_static_library=true is_component_build=false v8_use_snapshot=false'
|
||||
ninja -C out.gn/linux_64
|
||||
|
||||
cp "./out/native/obj.target/tools/gyp/libv8_base.a" "./../$platform$arch/"
|
||||
cp "./out/native/obj.target/tools/gyp/libv8_libbase.a" "./../$platform$arch/"
|
||||
cp "./out/native/obj.target/tools/gyp/libv8_libplatform.a" "./../$platform$arch/"
|
||||
cp "./out/native/obj.target/tools/gyp/libv8_nosnapshot.a" "./../$platform$arch/"
|
||||
cp "./out/native/obj.target/tools/gyp/libv8_external_snapshot.a" "./../$platform$arch/"
|
||||
|
||||
cp "./out/native/obj.target/third_party/icu/libicui18n.a" "./../$platform$arch/"
|
||||
cp "./out/native/obj.target/third_party/icu/libicuuc.a" "./../$platform$arch/"
|
||||
cp "./out/native/obj.target/third_party/icu/libicudata.a" "./../$platform$arch/"
|
||||
|
||||
cp "./third_party/icu/linux/icudtl_dat.S" "./../$platform$arch/"
|
||||
|
||||
cp "./third_party/icu/source/data/in/icudtl.dat" "./../$platform$arch/"
|
||||
gn gen out.gn/linux_32 --args='is_debug=false target_cpu="x86" v8_static_library=true is_component_build=false v8_use_snapshot=false'
|
||||
ninja -C out.gn/linux_32
|
||||
fi
|
||||
|
||||
if [[ "$platform" == *"mac"* ]]
|
||||
if [[ "$platform" == "mac" ]]
|
||||
then
|
||||
CFLAGS="-fPIC" CXXFLAGS="-fPIC -stdlib=libc++" LDFLAGS="-stdlib=libc++" make native
|
||||
|
||||
cp "./out/native/libv8_base.a" "./../$platform$arch/"
|
||||
cp "./out/native/libv8_libbase.a" "./../$platform$arch/"
|
||||
cp "./out/native/libv8_libplatform.a" "./../$platform$arch/"
|
||||
cp "./out/native/libv8_nosnapshot.a" "./../$platform$arch/"
|
||||
cp "./out/native/libv8_external_snapshot.a" "./../$platform$arch/"
|
||||
|
||||
cp "./out/native/libicui18n.a" "./../$platform$arch/"
|
||||
cp "./out/native/libicuuc.a" "./../$platform$arch/"
|
||||
cp "./out/native/icudtl.dat" "./../$platform$arch/"
|
||||
|
||||
cp "./out/native/libv8_libsampler.a" "./../$platform$arch/"
|
||||
|
||||
cp "./third_party/icu/mac/icudtl_dat.S" "./../$platform$arch/"
|
||||
gn gen out.gn/mac_64 --args='is_debug=false target_cpu="x64" v8_static_library=true is_component_build=false v8_use_snapshot=false'
|
||||
ninja -C out.gn/mac_64
|
||||
fi
|
||||
|
||||
7
Common/3dParty/v8/fetch.sh
Normal file → Executable file
7
Common/3dParty/v8/fetch.sh
Normal file → Executable file
@ -11,10 +11,15 @@ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
fi
|
||||
|
||||
export PATH=`pwd`/depot_tools:"$PATH"
|
||||
gclient
|
||||
|
||||
if [ ! -d "./v8" ]
|
||||
then
|
||||
fetch v8
|
||||
cd v8
|
||||
git checkout -b 6.0 -t branch-heads/6.0
|
||||
else
|
||||
cd v8
|
||||
fi
|
||||
|
||||
gclient sync -r 4.10.253
|
||||
gclient sync
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
CORE_V8_PATH_INCLUDE = $$PWD/v8
|
||||
CORE_V8_PATH_LIBS = $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX
|
||||
CORE_V8_PATH_LIBS = $$CORE_V8_PATH_INCLUDE/out.gn/$$CORE_BUILDS_PLATFORM_PREFIX/obj
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$CORE_V8_PATH_INCLUDE \
|
||||
$$CORE_V8_PATH_INCLUDE/include
|
||||
|
||||
core_windows {
|
||||
CORE_V8_PATH_LIBS = $$CORE_V8_PATH_LIBS/$$CORE_BUILDS_CONFIGURATION_PREFIX
|
||||
CORE_V8_PATH_LIBS = $$CORE_V8_PATH_INCLUDE/out.gn/$$CORE_BUILDS_PLATFORM_PREFIX_$$CORE_BUILDS_CONFIGURATION_PREFIX/obj
|
||||
|
||||
LIBS += -L$$CORE_V8_PATH_LIBS -lv8_base_0 -lv8_base_1 -lv8_base_2 -lv8_base_3 -lv8_libbase -lv8_libplatform -lv8_nosnapshot -lv8_external_snapshot
|
||||
LIBS += -L$$CORE_V8_PATH_LIBS -licui18n -licuuc
|
||||
LIBS += -L$$CORE_V8_PATH_LIBS -lv8_base_0 -lv8_base_1 -lv8_base_2 -lv8_base_3 -lv8_libbase -lv8_libplatform -lv8_snapshot -lv8_libsampler
|
||||
LIBS += -L$$CORE_V8_PATH_LIBS/third_party/icu -licui18n -licuuc
|
||||
|
||||
LIBS += -lwinmm
|
||||
LIBS += -ladvapi32
|
||||
@ -17,16 +17,14 @@ core_windows {
|
||||
}
|
||||
|
||||
core_linux {
|
||||
LIBS += -L$$CORE_V8_PATH_LIBS -lv8_base -lv8_libplatform -lv8_libbase -lv8_nosnapshot -lv8_external_snapshot
|
||||
LIBS += -L$$CORE_V8_PATH_LIBS -licui18n -licuuc -licudata
|
||||
LIBS += -L$$CORE_V8_PATH_LIBS -lv8_base -lv8_libplatform -lv8_libbase -lv8_snapshot -lv8_libsampler
|
||||
LIBS += -L$$CORE_V8_PATH_LIBS/third_party/icu -licui18n -licuuc
|
||||
}
|
||||
|
||||
core_mac {
|
||||
LIBS += -L$$CORE_V8_PATH_LIBS -lv8_base -lv8_libbase -lv8_libplatform -lv8_nosnapshot -lv8_external_snapshot
|
||||
LIBS += -L$$CORE_V8_PATH_LIBS -licui18n -licuuc -lv8_libsampler
|
||||
LIBS += -L$$CORE_V8_PATH_LIBS -lv8_base -lv8_libplatform -lv8_libbase -lv8_snapshot -lv8_libsampler
|
||||
LIBS += -L$$CORE_V8_PATH_LIBS/third_party/icu -licui18n -licuuc
|
||||
|
||||
QMAKE_CXXFLAGS += -Wall -Wno-inconsistent-missing-override
|
||||
QMAKE_CFLAGS += -Wall -Wno-inconsistent-missing-override
|
||||
}
|
||||
|
||||
DEFINES += NEW_V8_ENGINE
|
||||
|
||||
@ -40,11 +40,6 @@ HEADERS += doctrenderer.h \
|
||||
memorystream.h \
|
||||
nativecontrol.h
|
||||
|
||||
unix {
|
||||
target.path = /usr/lib
|
||||
INSTALLS += target
|
||||
}
|
||||
|
||||
# downloader
|
||||
DEFINES += BUIDLER_OPEN_DOWNLOAD_ENABLED
|
||||
DEFINES += BUIDLER_OPEN_BASE64_ENABLED
|
||||
|
||||
@ -468,26 +468,6 @@ v8::Handle<v8::ObjectTemplate> CreateNativeControlTemplate(v8::Isolate* isolate)
|
||||
v8::Handle<v8::ObjectTemplate> CreateNativeControlTemplateBuilder(v8::Isolate* isolate);
|
||||
// --------------------------
|
||||
|
||||
// create work with arraytypes
|
||||
class MallocArrayBufferAllocator : public v8::ArrayBuffer::Allocator
|
||||
{
|
||||
public:
|
||||
virtual void* Allocate(size_t length)
|
||||
{
|
||||
void* ret = malloc(length);
|
||||
memset(ret, 0, length);
|
||||
return ret;
|
||||
}
|
||||
virtual void* AllocateUninitialized(size_t length)
|
||||
{
|
||||
return malloc(length);
|
||||
}
|
||||
virtual void Free(void* data, size_t length)
|
||||
{
|
||||
free(data);
|
||||
}
|
||||
};
|
||||
|
||||
class CChangesWorker
|
||||
{
|
||||
private:
|
||||
@ -1061,42 +1041,39 @@ class CV8Initializer
|
||||
{
|
||||
private:
|
||||
v8::Platform* m_platform;
|
||||
MallocArrayBufferAllocator m_oAllocator;
|
||||
v8::ArrayBuffer::Allocator* m_pAllocator;
|
||||
|
||||
public:
|
||||
CV8Initializer() : m_oAllocator()
|
||||
CV8Initializer()
|
||||
{
|
||||
std::wstring sPrW = NSFile::GetProcessPath();
|
||||
std::string sPrA = U_TO_UTF8(sPrW);
|
||||
|
||||
v8::V8::InitializeICUDefaultLocation(sPrA.c_str());
|
||||
v8::V8::InitializeExternalStartupData(sPrA.c_str());
|
||||
m_platform = v8::platform::CreateDefaultPlatform();
|
||||
v8::V8::InitializePlatform(m_platform);
|
||||
|
||||
v8::V8::Initialize();
|
||||
v8::V8::InitializeICU();
|
||||
|
||||
#ifndef NEW_V8_ENGINE
|
||||
v8::V8::SetArrayBufferAllocator(&m_oAllocator);
|
||||
#endif
|
||||
}
|
||||
~CV8Initializer()
|
||||
{
|
||||
v8::V8::Dispose();
|
||||
v8::V8::ShutdownPlatform();
|
||||
delete m_platform;
|
||||
delete m_pAllocator;
|
||||
}
|
||||
|
||||
v8::ArrayBuffer::Allocator* getAllocator()
|
||||
{
|
||||
return &m_oAllocator;
|
||||
return m_pAllocator;
|
||||
}
|
||||
|
||||
v8::Isolate* CreateNew()
|
||||
{
|
||||
#ifdef NEW_V8_ENGINE
|
||||
v8::Isolate::CreateParams create_params;
|
||||
create_params.array_buffer_allocator = &m_oAllocator;
|
||||
m_pAllocator = v8::ArrayBuffer::Allocator::NewDefaultAllocator();
|
||||
create_params.array_buffer_allocator = m_pAllocator;
|
||||
return v8::Isolate::New(create_params);
|
||||
#else
|
||||
return v8::Isolate::New();
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -14,41 +14,13 @@ CONFIG -= app_bundle
|
||||
|
||||
TEMPLATE = app
|
||||
|
||||
############### destination path ###############
|
||||
DESTINATION_SDK_PATH = $$PWD/../../../build/lib
|
||||
|
||||
# WINDOWS
|
||||
win32:contains(QMAKE_TARGET.arch, x86_64):{
|
||||
CONFIG(debug, debug|release) {
|
||||
DESTINATION_SDK_PATH_DOCTRENDERER = $$DESTINATION_SDK_PATH/win_64/DEBUG
|
||||
} else {
|
||||
DESTINATION_SDK_PATH_DOCTRENDERER = $$DESTINATION_SDK_PATH/win_64
|
||||
}
|
||||
}
|
||||
win32:!contains(QMAKE_TARGET.arch, x86_64):{
|
||||
CONFIG(debug, debug|release) {
|
||||
DESTINATION_SDK_PATH_DOCTRENDERER = $$DESTINATION_SDK_PATH/win_32/DEBUG
|
||||
} else {
|
||||
DESTINATION_SDK_PATH_DOCTRENDERER = $$DESTINATION_SDK_PATH/win_32
|
||||
}
|
||||
}
|
||||
|
||||
linux-g++:contains(QMAKE_HOST.arch, x86_64):{
|
||||
DESTINATION_SDK_PATH_DOCTRENDERER = $$DESTINATION_SDK_PATH/linux_64
|
||||
}
|
||||
linux-g++:!contains(QMAKE_HOST.arch, x86_64):{
|
||||
DESTINATION_SDK_PATH_DOCTRENDERER = $$DESTINATION_SDK_PATH/linux_32
|
||||
}
|
||||
|
||||
CONFIG(debug, debug|release) {
|
||||
DESTDIR = $$PWD/Debug
|
||||
} else {
|
||||
DESTDIR = $$PWD/Release
|
||||
}
|
||||
CORE_ROOT_DIR = $$PWD/../../../
|
||||
PWD_ROOT_DIR = $$PWD
|
||||
include(../../../Common/base.pri)
|
||||
|
||||
################################################
|
||||
|
||||
LIBS += -L$$DESTINATION_SDK_PATH_DOCTRENDERER -ldoctrenderer
|
||||
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -ldoctrenderer
|
||||
|
||||
linux-g++ {
|
||||
LIBS += -ldl
|
||||
|
||||
Reference in New Issue
Block a user