From 03873ea208fb112f055c732051de106845cad4de Mon Sep 17 00:00:00 2001 From: rumtid Date: Fri, 10 May 2024 11:00:27 +0800 Subject: [PATCH] Update osx.md and windows.md for building seafile (#287) * Update osx.md and windows.md for building seafile * Improve documents --- manual/build_seafile/osx.md | 216 ++++++++++---------------------- manual/build_seafile/windows.md | 208 +++++++++++++++--------------- mkdocs.yml | 6 +- 3 files changed, 182 insertions(+), 248 deletions(-) diff --git a/manual/build_seafile/osx.md b/manual/build_seafile/osx.md index 6b71e45b..6dbe1c86 100644 --- a/manual/build_seafile/osx.md +++ b/manual/build_seafile/osx.md @@ -1,162 +1,84 @@ -# Mac OS X +# macOS -## Requirements +## Environment Setup -The following software packages are required for building Seafile client on macOS: +The following setups are required for building and packaging Sync Client on macOS: -* XCode (10.2 or later) - - Newer versions of XCode may work, but not tested. Some tweaks may be applied to the build scripts in order to compile or package the application. - -* Qt 5.15 (official package) +* XCode 13.2 (or later) + * After installing XCode, you can start XCode once so that it automatically installs the rest of the components. +* Qt 6.2 * MacPorts -* Other dependencies - - The following packages are required to be installed via MacPorts: - - $ sudo port install autoconf automake pkgconfig libtool glib2 libevent vala openssl git jansson cmake curl libwebsockets - -Also, add following lines to the *~/.bash_profile* file: - -```bash -export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig:/usr/local/lib/pkgconfig -export LIBTOOL=glibtool -export LIBTOOLIZE=glibtoolize -export CPPFLAGS="-I/opt/local/include" -export LDFLAGS="-L/opt/local/lib -L/usr/local/lib -Wl,-headerpad_max_install_names" - -QT_BASE=$HOME/Qt5.15.2/5.15.2/clang_64 -export PATH=$QT_BASE/bin:$PATH -export PKG_CONFIG_PATH=$QT_BASE/lib/pkgconfig:$PKG_CONFIG_PATH - -``` - -## Compile & Run - -### Clone Source Code - -We assume the workspace is located at *~/seafile-workspace*. Then, run following commands in a shell: - -```bash -$ cd ~/seafile-workspace -$ git clone https://github.com/haiwen/libsearpc.git -$ git clone https://github.com/haiwen/seafile.git -$ git clone https://github.com/haiwen/seafile-client.git - -``` - -### Compile libsearpc - -```bash -$ cd ~/seafile-workspace/libsearpc - -$ ./autogen.sh -$ ./configure -$ make -$ sudo make install - -``` - -In order to compile universal, you can specify the following option through configure: -``` -$ ./configure --enable-compile-universal=yes -``` - -### Compile seafile - -```bash -$ cd ~/seafile-workspace/seafile - -$ ./autogen.sh -$ ./configure -$ make -$ sudo make install - -``` - -In order to compile universal, you can specify the following option through configure: -``` -$ ./configure --enable-compile-universal=yes -``` - -### Compile seafile-client - -```bash -$ cd ~/seafile-workspace/seafile-client - -cmake -G "Unix Makefiles" -B build -S . -cmake --build build --target seafile-applet - -``` - -In order to compile universal, you can specify the following option through cmake to generate makefiles: -``` -cmake -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -G "Unix Makefiles" -B build -S . -``` - -### Run seafile-applet - -```bash -$ cd ~/seafile-workspace/seafile-client/build -$ ./seafile-applet - -``` - -## Package Application - -Additonal setups are required for packing Seafile client on macOS: - + * Modify __/opt/local/etc/macports/macports.conf__ to add configuration `universal_archs arm64 x86_64`. Specifies the architecture on which MapPorts is compiled. + * Modify __/opt/local/etc/macports/variants.conf__ to add configuration `+universal`. MacPorts installs universal versions of all ports. + * Install other dependencies: `sudo port install autoconf automake pkgconfig libtool glib2 libevent vala openssl git jansson cmake libwebsockets`. +* Certificates + * Create certificate signing requests for certification, see [https://developer.apple.com/help/account/create-certificates/create-a-certificate-signing-request](). + * Create a _Developer ID Application_ certificate and a _Developer ID Installer_ certificate, see [https://developer.apple.com/help/account/create-certificates/create-developer-id-certificates](). Install them to the login keychain. + * Install the Developer ID Intermediate Certificate (Developer ID - G2), from [https://www.apple.com/certificateauthority/]() * dropDMG -* certifications -* notarization username and password +* bash environments + * add following lines to the __~/.bash_profile__ file: -### Code Signing + export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/local/lib/pkgconfig:/usr/local/lib/pkgconfig + export PATH=/opt/local/bin:/usr/local/bin:/opt/local/Library/Frameworks/Python.framework/Versions/3.10/bin:$PATH + export LDFLAGS="-L/opt/local/lib -L/usr/local/lib" + export CFLAGS="-I/opt/local/include -I/usr/local/include" + export CPPFLAGS="-I/opt/local/include -I/usr/local/include" + export LD_LIBRARY_PATH=/opt/lib:/usr/local/lib:/opt/local/lib/:/usr/local/lib/:$LD_LIBRARY_PATH -A mac application must be distribution-signed before shipping. More technical details can be found from the [post](https://developer.apple.com/forums/thread/701514#701514021) at developer forums. + QT_BASE=$HOME/Qt/6.2.4/macos + export PATH=$QT_BASE/bin:$PATH + export PKG_CONFIG_PATH=$QT_BASE/lib/pkgconfig:$PKG_CONFIG_PATH + export NOTARIZE_APPLE_ID="Your notarize account" + export NOTARIZE_PASSWORD="Your notarize password" + export NOTARIZE_TEAM_ID="Your notarize team id" -Before signing, please make sure to import the distribution certification. Then, the permission of imported key should be changed: right click the imported key in Keychain Access -> select "Get Info" -> select "Access Control" -> choose "Allow all applications to access this item". +## Building Sync Client -Now, executables and frameworks inside the bundle can be signed with the `codesign` command. See the *seafile/scripts/build/build_mac_local.py* script for actual signing commands. - -### Notarization - -Notarization is the final step before shipping a DMG installer. The `notarytool` command can be used to submit or staple the installer. See the *seafile/scripts/build/notarize.sh* script for actual notarizing commands. - -### Run Packaging Script - -Some changes need to be applied to the *seafile/scripts/build/build_mac_local.py* script before running it. - -* change `'BUILD_SPARKLE_SUPPORT': 'ON',` to `'BUILD_SPARKLE_SUPPORT': 'OFF',` -* comment out sparkle related lines: - - # for fn in _glob('Contents/Frameworks/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/MacOS/*'): - # do_sign(fn, preserve_entitlemenets=False) - - # for fn in ( - # 'Contents/Frameworks/Sparkle.framework/Versions/A/Resources/Autoupdate.app', - # 'Contents/Frameworks/Sparkle.framework/Versions/A/Sparkle', - # ): - # do_sign(join(appdir, fn)) - - # copy_sparkle_framework() - -* Update altool path in *seafile/scripts/build/notarize.sh*: - - _altool() { - xcrun altool "$@" - } - -Then, run following commands in a shell: - -```bash -$ cd ~/seafile-workspace/seafile/scripts/build -$ python build-mac-local.py --brand="" --version=1.0.0 --nostrip +Following directory structures are expected when building Sync Client: +``` +seafile-workspace/ +seafile-workspace/libsearpc/ +seafile-workspace/seafile/ +seafile-workspace/seafile-client/ ``` -In order to build an universal package, you can specify the following option through python script: +The source code of these projects can be downloaded at [github.com/haiwen/libsearpc](https://github.com/haiwen/libsearpc), [github.com/haiwen/seafile](https://github.com/haiwen/seafile), and [github.com/haiwen/seafile-client](https://github.com/haiwen/seafile-client). + +### Building + +Note: the building commands have been included in the packaging script, you can skip building commands while packaging. + +To build libsearpc: ``` -# This script depends on python3 -$ python build-mac-local-py3.py --brand="" --version=1.0.0 --nostrip --universal +$ cd seafile-workspace/libsearpc/ +$ ./autogen.sh +$ ./configure --disable-compile-demo --enable-compile-universal=yes +$ make +$ make install ``` + +To build seafile: + +``` +$ cd seafile-workspace/seafile/ +$ ./autogen.sh +$ ./configure --disable-fuse --enable-compile-universal=yes +$ make +$ make install +``` + +To build seafile-client: + +``` +$ cd seafile-workspace/seafile-client/ +$ cmake -GXcode -B. -S. +$ xcodebuild -target seafile-applet -configuration Release +``` + +### Packaging + +1. Update the CERT_ID in __seafile-workspace/seafile/scripts/build/build-mac-local-py3.py__ to the ID of _Developer ID Application_. +2. Run the packaging script: `python3 build-mac-local-py3.py --brand="" --version=1.0.0 --nostrip --universal` diff --git a/manual/build_seafile/windows.md b/manual/build_seafile/windows.md index d7473c56..696c478c 100644 --- a/manual/build_seafile/windows.md +++ b/manual/build_seafile/windows.md @@ -1,130 +1,142 @@ -# Build Seafile Client for Windows +# Windows -The following compilation steps are only valid for versions 8.0 and above. +## Environment Setup -## The development environment +The following setups are required for building and packaging Sync Client on Windows: -Before compiling and developing, you need to install and configure the development environment +* Visual Studio 2019 + * Desktop development with C++ + * MSVC v142 + * Windows 10 SDK (10.0.19041.0) (installed by default, not used) + * Windows 10 SDK (10.0.18362.0) + * Universal Windows Platform development + * Windows 10 SDK (10.0.18362.0) +* Qt 6.5 + * MSVC 2019 64-bit + * Qt 5 Compatibility Module + * Qt Positioning + * Qt Serial Port + * Qt WebChannel + * Qt WebEngine +* Qt VS Tools +* vcpkg + * curl\[openssl\]:x64-windows + * getopt:x64-windows + * glib:x64-windows + * jansson:x64-windows + * libevent:x64-windows + * libwebsockets:x64-windows + * openssl:x64-windows + * pthreads:x64-windows + * sqlite3:x64-windows + * zlib:x64-windows -1. Microsoft Visual Studio 2019 (Windows SDK 10.0.18362.0) including modules: MSVC v142 Build ToolsMSVC v142 Build Tools and C++ 2019 Redistributable-MSMs -2. Package manager tools: [vcpkg](https://docs.microsoft.com/en-us/cpp/build/vcpkg?view=vs-2019) -3. Install wix[wix](https://github.com/wixtoolset/wix3/releases/tag/wix3111rtm) to c:/wix -4. Install paraffin [paraffin](https://github.com/Wintellect/Paraffin/releases) and copy Paraffin.exe to c:/wix/bin -5. Prepare signing certificate seafile.pfx to c:/certs -6. Create a workspace folder such as c:/workspace, all souce code will be downloaded to this folder. + # Example of the install command: + $ ./vcpkg.exe install curl[core,openssl]:x64-windows -## Installing third-party libraries +* Python 3.7 +* [wix](https://github.com/wixtoolset/wix3/releases/tag/wix3111rtm) + * install to C:\wix +* [Paraffin](https://github.com/Wintellect/Paraffin/releases) + * copy Paraffin.exe to C:\wix\bin +* Breakpad +* Certificates + * install to C:\certs -Third-party libraries include: glib, curl, openssl(version1.1.1d), openssl-windows(version1.1.1d-1), libevent, jansson, sqlite3, pthreads, getopt-win32 + Note: certificates for Windows application are issued by third-party certificate authority. + +### Breakpad + +Support for Breakpad can be added by running following steps: + +* install gyp tool + + $ git clone --depth=1 git@github.com:chromium/gyp.git + $ python setup.py install + +* compile breakpad + + $ git clone --depth=1 git@github.com:google/breakpad.git + $ cd breakpad + $ git clone https://github.com/google/googletest.git testing + $ cd .. + # create vs solution, this may throw an error "module collections.abc has no attribute OrderedDict", you should open the msvs.py and replace 'collections.abc' with 'collections'. + $ gyp –-no-circular-check breakpad\src\client\windows\breakpad_client.gyp + + * open breakpad_client.sln and configure C++ Language Standard to C++17 and C/C++ ---> Code Generation ---> Runtime Library to Multi-threaded DLL (/MD) + * build breakpad + +* compile dump_syms tool + + create vs solution + + gyp –-no-circular-check breakpad\src\tools\windows\tools_windows.gyp + + * open tools_windows.sln and build tools_windows + * Insert #include in the source file about unique_ptr compilation error and recompile. + * build dump_syms + * Copy C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Remote Debugger\x64\msdia140.dll to breakpad\src\tools\windows\Release. + +* copy VC merge modules + + copy C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\v142\MergeModules\MergeModules\Microsoft_VC142_CRT_x64.msm C:\packagelib + +## Building Sync Client + +Following directory structures are expected when building Sync Client: ``` -Install example:`vcpkg.exe install curl[core,openssl]:x64-windows` - +seafile-workspace/ +seafile-workspace/libsearpc/ +seafile-workspace/seafile/ +seafile-workspace/seafile-client/ +seafile-workspace/seafile-shell-ext/ ``` -Install and configure Qt: +The source code of these projects can be downloaded at [github.com/haiwen/libsearpc](https://github.com/haiwen/libsearpc), [github.com/haiwen/seafile](https://github.com/haiwen/seafile), [github.com/haiwen/seafile-client](https://github.com/haiwen/seafile-client), and [github.com/haiwen/seafile-shell-ext](https://github.com/haiwen/seafile-shell-ext). -1. Search and install Qt Visual Studio tools in the Visual Studio plugin repository -2. Install Qt5.15.1 ([QT download link](http://download.qt.io/archive/qt/)). -3. Configure Qt Visual Studio Tools. This will tell VS about Qt installation path. In VS menu, open Extension -> Qt VS -> Qt Options. Here you can setup Qt versions and the corresponding installation paths. You should set the path to the parent folder of Qt "bin" folder.Configure Qt Visual Studio Tools. This will tell VS about Qt installation path. In VS menu, open Extension -> Qt VS -> Qt Options. Here you can setup Qt versions and the corresponding installation paths. You should set the path to the parent folder of Qt "bin" folder. -4. Choose Qt version to be used in your project. In VS navigation pane, right click on seafile-client project and choose "Properties". Then click "Qt Project Settings" in the properties dialog. You should select the Qt version you just setup in the last step.Choose Qt version to be used in your project. In VS navigation pane, right click on seafile-client project and choose "Properties". Then click "Qt Project Settings" in the properties dialog. You should select the Qt version you just setup in the last step. +### Building -## Install and configure breakpad: +Note: the building commands have been included in the packaging script, you can skip building commands while packaging. -### Install gyp tool - -Clone gyp +To build libsearpc: ``` -git clone --depth=1 git@github.com:chromium/gyp.git - +$ cd seafile-workspace/libsearpc/ +$ devenv libsearpc.sln /build "Release|x64" ``` -Install gyp +To build seafile ``` -python setup.py install - +$ cd seafile-workspace/seafile/ +$ devenv seafile.sln /build "Release|x64" +$ devenv msi/custom/seafile_custom.sln /build "Release|x64" ``` -### Compile breakpad - -```bash -#clone breakpad -git clone --depth=1 git@github.com:google/breakpad.git -cd breakpad -git clone testing -cd .. -#create vs solution, this may throw an error "module collections.abc has no attribute OrderedDict", -#you should open the msvs.py and replace 'collections.abc' with 'collections'. -gyp –-no-circular-check breakpad\\src\\client\\windows\\breakpad_client.gyp +To build seafile-client ``` - -1. open breakpad_client.sln and configure C++ Language Standard to C++17 and C/C++ ---> Code Generation ---> Runtime Library to Multi-threaded DLL (/MD) -2. build breakpad - -### Compile dump_syms tool - -create vs solution - -``` -gyp –-no-circular-check breakpad\\src\\tools\\windows\\tools_windows.gyp - +$ cd seafile-workspace/seafile-client/ +$ devenv third_party/quazip/quazip.sln /build "Release|x64" +$ devenv seafile-client.sln /build "Release|x64" ``` -1. open tools_windows.sln and build tools_windows -2. Insert #include\ in the source file about unique_ptr compilation error and recompile. -3. build dump_syms -4. Copy C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\IDE\\Remote Debugger\\x64\\msdia140.dll to breakpad\\src\\tools\\windows\\Release. - -### Copy VC merge modules +To build seafile-shell-ext ``` -copy C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Redist\\MSVC\\v142\\MergeModules\\MergeModules\\Microsoft_VC142_CRT_x64.msm C:\\packagelib - +$ cd seafile-workspace/seafile-shell-ext/ +$ devenv extensions/seafile_ext.sln /build "Release|x64" +$ devenv seadrive-thumbnail-ext/seadrive_thumbnail_ext.sln /build "Release|x64" ``` -## How to make msi +### Packaging -For example, if you want to compile seafile 8.0.9, you can package it like this. - -First clone the libsearpc seafile seafile-client code to a directory. - -```bash -git clone git@github.com:haiwen/libsearpc.git -git clone git@github.com:haiwen/seafile.git -git clone git@github.com:haiwen/seafile-client.git -git clone git@github.com:haiwen/seafile-shell-ext.git - -``` - -Modify build scripts: - -1. open seafile/scripts/build/build-msi-vs.py and modify QT_DIR to your directory of qt. - -Then pull the code of the specified tag and build. - -```bash -cd libsearpc -git pull origin master:master -git reset v3.3-latest --hard - -cd ../seafile-client -git pull origin master:master -git reset v8.0.9 --hard - -cd ../seafile-shell-ext -git pull origin master:master -git reset seafile-v8.0.9 --hard - -cd ../seafile -git pull origin master:master -git reset v8.0.9 --hard - -cd scripts/build -python build-msi-vs.py 8.0.0 - -``` +1. Update the CERTFILE configure in __seafile-workspace/seafile/scripts/build/build-msi-vs.py__ . +2. Run commands: + $ cd seafile-workspace/seafile-client/third_party/quazip + $ devenv quazip.sln /build Release|x64 + $ cd seafile-workspace/seafile/scripts/build + $ python build-msi-vs.py 1.0.0 diff --git a/mkdocs.yml b/mkdocs.yml index 793706d2..f518bf0a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -60,7 +60,7 @@ nav: - Seafile Professional Setup on Linux: - Outline: deploy_pro/README.md - Installation: deploy_pro/download_and_setup_seafile_professional_server.md - - Migration from Seafile Community: deploy_pro/migrate_from_seafile_community_server.md + - Migration from Seafile Community: deploy_pro/migrate_from_seafile_community_server.md - Storage Backends: - Amazon S3 Backend: deploy_pro/setup_with_amazon_s3.md - Ceph Backend: deploy_pro/setup_with_ceph.md @@ -81,7 +81,7 @@ nav: - Migration from Seafile Community: docker/pro-edition/migrate_ce_to_pro_with_docker.md - Migrate from non-docker deployment: docker/non_docker_to_docker.md - Advanced Setup Options: - - LDAP/AD Integration: + - LDAP/AD Integration: - LDAP Integration: deploy/using_ldap.md - LDAP Configuration for Seafile Pro: deploy_pro/using_ldap_pro.md - Importing Groups from LDAP (Pro): deploy_pro/ldap_group_sync.md @@ -162,7 +162,7 @@ nav: - How to Build Seafile: - Outline: build_seafile/README.md - Linux: build_seafile/linux.md - - Mac OS X: build_seafile/osx.md + - macOS: build_seafile/osx.md - Windows: build_seafile/windows.md - Server development: build_seafile/server.md - Server binary package: build_seafile/rpi.md