Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
tonsky committed Aug 8, 2023
1 parent 3ee9e01 commit bea683f
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 31 deletions.
42 changes: 24 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,23 @@ env:

jobs:
macos:
runs-on: macos-10.15
runs-on: macos-11
strategy:
matrix:
machine: ["x64", "arm64"]
build_type: [Release, Debug]
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- run: python3 script/check_release.py --version ${{ env.version }} --build-type ${{ matrix.build_type }} --machine ${{ matrix.machine }}
if: ${{ github.event.inputs.skip_release != 'true' }}
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
- uses: abdes/gha-setup-ninja@660f330a40aefa8d11632b3f901e92a4adb33d65
- run: python3 script/checkout.py --version ${{ env.version }}
- run: python3 script/build.py --build-type ${{ matrix.build_type }} --machine ${{ matrix.machine }}
- run: python3 script/archive.py --version ${{ env.version }} --build-type ${{ matrix.build_type }} --machine ${{ matrix.machine }}
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: Skia-${{ env.version }}-macos-${{ matrix.build_type }}-${{ matrix.machine }}.zip
path: '*.zip'
Expand All @@ -50,20 +51,21 @@ jobs:
build_type: [Release, Debug]
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- run: python3 script/check_release.py --version ${{ env.version }} --build-type ${{ matrix.build_type }} --machine ${{ matrix.target_machine }}
if: ${{ github.event.inputs.skip_release != 'true' }}
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
- uses: abdes/gha-setup-ninja@660f330a40aefa8d11632b3f901e92a4adb33d65
- run: sudo ./script/prepare_linux.sh
- run: |
sudo apt-get update
sudo apt-get --yes install g\+\+-9-aarch64-linux-gnu
if: ${{ matrix.target_machine == 'arm64' }}
- run: python3 script/check_release.py --version ${{ env.version }} --build-type ${{ matrix.build_type }} --machine ${{ matrix.target_machine }}
if: ${{ github.event.inputs.skip_release != 'true' }}
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
- run: PATH=/usr/lib/binutils-2.26/bin:$PATH python3 script/checkout.py --version ${{ env.version }}
- run: PATH=/usr/lib/binutils-2.26/bin:$PATH python3 script/build.py --build-type ${{ matrix.build_type }} --machine ${{ matrix.target_machine }}
- run: PATH=/usr/lib/binutils-2.26/bin:$PATH python3 script/archive.py --version ${{ env.version }} --build-type ${{ matrix.build_type }} --machine ${{ matrix.target_machine }}
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: Skia-${{ env.version }}-linux-${{ matrix.build_type }}-${{ matrix.target_machine }}.zip
path: '*.zip'
Expand All @@ -73,24 +75,25 @@ jobs:
API_TOKEN: ${{ secrets.API_TOKEN }}

android:
if: false
runs-on: ubuntu-20.04
strategy:
matrix:
machine: [arm, arm64, x64, x86]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 1.8
- run: sudo ./script/prepare_linux.sh
- uses: actions/checkout@v3
- run: python3 script/check_release.py --version ${{ env.version }} --system android --machine ${{ matrix.machine }}
if: ${{ github.event.inputs.skip_release != 'true' }}
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
- uses: actions/setup-java@v1
with:
java-version: 1.8
- run: sudo ./script/prepare_linux.sh
- run: PATH=/usr/lib/binutils-2.26/bin:$PATH python3 script/checkout.py --version ${{ env.version }} --system android --machine ${{ matrix.machine }}
- run: PATH=/usr/lib/binutils-2.26/bin:$PATH python3 script/build.py --system android --machine ${{ matrix.machine }} --ndk "/usr/local/lib/android/sdk/ndk-bundle"
- run: PATH=/usr/lib/binutils-2.26/bin:$PATH python3 script/archive.py --system android --machine ${{ matrix.machine }}
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: Skia-${{ env.version }}-android-Release-${{ matrix.machine }}.zip
path: '*.zip'
Expand All @@ -100,27 +103,30 @@ jobs:
API_TOKEN: ${{ secrets.API_TOKEN }}

windows:
runs-on: windows-2019
runs-on: windows-latest
strategy:
matrix:
build_type: [Release, Debug]
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- shell: bash
run: python3 script/check_release.py --version ${{ env.version }} --build-type ${{ matrix.build_type }}
if: ${{ github.event.inputs.skip_release != 'true' }}
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
- uses: abdes/gha-setup-ninja@660f330a40aefa8d11632b3f901e92a4adb33d65
- uses: microsoft/setup-msbuild@v1
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64
- shell: bash
run: python3 script/checkout.py --version ${{ env.version }}
- shell: bash
run: python3 script/build.py --build-type ${{ matrix.build_type }}
- shell: bash
run: python3 script/archive.py --version ${{ env.version }} --build-type ${{ matrix.build_type }}
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: Skia-${{ env.version }}-windows-${{ matrix.build_type }}-x64.zip
path: '*.zip'
Expand Down
27 changes: 15 additions & 12 deletions patches/11081_SkLoadICU.cpp.patch
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
diff --git a/third_party/icu/SkLoadICU.cpp b/third_party/icu/SkLoadICU.cpp
index 5b3b153336..8696aaf927 100644
index b6107714f7..edceb98af7 100644
--- a/third_party/icu/SkLoadICU.cpp
+++ b/third_party/icu/SkLoadICU.cpp
@@ -15,39 +15,37 @@
@@ -13,41 +13,40 @@

#include <cstdio>
#include <cstring>
+#include <iostream>
#include <mutex>
#include <string>
+#include <sstream>
Expand All @@ -14,43 +17,43 @@ index 5b3b153336..8696aaf927 100644
- if (!dataFile) {
- return nullptr;
- }
+static void* win_mmap(const std::wstring& dataFile, std::ostringstream& buffer) {
+static void* win_mmap(const std::wstring& dataFile, std::wostringstream& buffer) {
struct FCloseWrapper { void operator()(FILE* f) { fclose(f); } };
- std::unique_ptr<FILE, FCloseWrapper> stream(_wfopen(dataFile, L"rb"));
+ std::unique_ptr<FILE, FCloseWrapper> stream(_wfopen(dataFile, L"rb"));
+ std::unique_ptr<FILE, FCloseWrapper> stream(_wfopen(dataFile.c_str(), L"rb"));
if (!stream) {
- fprintf(stderr, "SkIcuLoader: datafile missing: %ls.\n", dataFile);
+ buffer << "SkLoadICU: datafile '" << dataFile << "' is missing" << std::endl;
+ buffer << L"SkLoadICU: datafile '" << dataFile << L"' is missing" << std::endl;
return nullptr;
}
int fileno = _fileno(stream.get());
if (fileno < 0) {
- fprintf(stderr, "SkIcuLoader: datafile fileno error.\n");
+ buffer << "SkLoadICU: datafile '" << dataFile << "' fileno error " << fileno << std::endl;
+ buffer << L"SkLoadICU: datafile '" << dataFile << L"' fileno error " << fileno << std::endl;
return nullptr;
}
HANDLE file = (HANDLE)_get_osfhandle(fileno);
if ((HANDLE)INVALID_HANDLE_VALUE == file) {
- fprintf(stderr, "SkIcuLoader: datafile handle error.\n");
+ buffer << "SkLoadICU: datafile '" << dataFile << "' handle error" << std::endl;
+ buffer << L"SkLoadICU: datafile '" << dataFile << L"' handle error" << std::endl;
return nullptr;
}
struct CloseHandleWrapper { void operator()(HANDLE h) { CloseHandle(h); } };
std::unique_ptr<void, CloseHandleWrapper> mmapHandle(
CreateFileMapping(file, nullptr, PAGE_READONLY, 0, 0, nullptr));
if (!mmapHandle) {
- fprintf(stderr, "SkIcuLoader: datafile mmap error.\n");
+ buffer << "SkLoadICU: datafile '" << dataFile << "' mmap error" << std::endl;
+ buffer << L"SkLoadICU: datafile '" << dataFile << L"' mmap error" << std::endl;
return nullptr;
}
void* addr = MapViewOfFile(mmapHandle.get(), FILE_MAP_READ, 0, 0, 0);
if (nullptr == addr) {
- fprintf(stderr, "SkIcuLoader: datafile view error.\n");
+ buffer << "SkLoadICU: datafile '" << dataFile << "' view error" << std::endl;
+ buffer << L"SkLoadICU: datafile '" << dataFile << L"' view error" << std::endl;
return nullptr;
}
return addr;
@@ -86,23 +84,20 @@ static std::string executable_directory() {
@@ -99,23 +98,20 @@ static std::wstring executable_directory() {
return get_module_path(hModule);
}

Expand All @@ -70,12 +73,12 @@ index 5b3b153336..8696aaf927 100644
static std::once_flag flag;
std::call_once(flag, []() {
- good = load_from(executable_directory()) || load_from(library_directory());
+ std::ostringstream buffer;
+ std::wostringstream buffer;
+ void* addr = win_mmap(library_directory() + L"\\icudtl.dat", buffer);
+ if (addr == nullptr)
+ addr = win_mmap(executable_directory() + L"\\icudtl.dat", buffer);
+ if (addr == nullptr)
+ fputs(buffer.str().c_str(), stderr);
+ std::wcerr << buffer.str() << std::endl;
+ if (addr)
+ loaded = init_icu(addr);
});
Expand Down
2 changes: 1 addition & 1 deletion script/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def main():
out = os.path.join('out', build_type + '-' + machine)
gn = 'gn.exe' if 'windows' == system else 'gn'
subprocess.check_call([os.path.join('bin', gn), 'gen', out, '--args=' + ' '.join(args)])
ninja = 'ninja.exe' if 'windows' == system else 'ninja'
ninja = 'ninja.bat' if 'windows' == system else 'ninja'
subprocess.check_call([os.path.join('..', 'depot_tools', ninja), '-C', out, 'skia', 'modules'])

return 0
Expand Down

0 comments on commit bea683f

Please sign in to comment.