Skip to content

Commit

Permalink
Merge pull request #5 from Glavo/linux-arm64
Browse files Browse the repository at this point in the history
Build for Linux ARM64
  • Loading branch information
tonsky authored Feb 27, 2023
2 parents 82cfc18 + e13234f commit 48b6820
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,26 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
target_machine: ["x64", "arm64"]
build_type: [Release, Debug]
fail-fast: false
steps:
- uses: actions/checkout@v2
- run: sudo ./script/prepare_linux.sh
- run: python3 script/check_release.py --version ${{ env.version }} --build-type ${{ matrix.build_type }}
- run: sudo apt-get install g++-9-aarch64-linux-gnu -y
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 }}
- run: PATH=/usr/lib/binutils-2.26/bin:$PATH python3 script/archive.py --version ${{ env.version }} --build-type ${{ matrix.build_type }}
- 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
with:
name: Skia-${{ env.version }}-linux-${{ matrix.build_type }}-x64.zip
name: Skia-${{ env.version }}-linux-${{ matrix.build_type }}-${{ matrix.target_machine }}.zip
path: '*.zip'
- run: python3 script/release.py --version ${{ env.version }} --build-type ${{ matrix.build_type }}
- run: python3 script/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 }}
Expand Down
18 changes: 15 additions & 3 deletions script/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def main():
build_type = common.build_type()
machine = common.machine()
system = common.system()
ndk = common.ndk()
ndk = common.ndk()

if build_type == 'Debug':
args = ['is_debug=true']
Expand Down Expand Up @@ -52,8 +52,20 @@ def main():
# 'skia_enable_gpu=true',
# 'skia_use_gl=true',
'extra_cflags_cc=["-frtti"]',
'cxx="g++-9"',
]

if (machine == 'arm64') and (machine != common.native_machine()):
args += [
'cc="aarch64-linux-gnu-gcc-9"',
'cxx="aarch64-linux-gnu-g++-9"',
'extra_cflags=["-I/usr/aarch64-linux-gnu/include"]'
]
else:
args += [
'cc="gcc-9"',
'cxx="g++-9"',
]

elif 'windows' == system:
args += [
'skia_use_system_freetype2=false',
Expand All @@ -64,7 +76,7 @@ def main():
elif 'android' == system:
args += [
'skia_use_system_freetype2=false',
'ndk="'+ ndk + '"'
'ndk="' + ndk + '"'
]

out = os.path.join('out', build_type + '-' + machine)
Expand Down
10 changes: 6 additions & 4 deletions script/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@ def system():
(args, _) = parser.parse_known_args()
return args.system if args.system else {'Darwin': 'macos', 'Linux': 'linux', 'Windows': 'windows'}[platform.system()]

def native_machine():
return {'AMD64': 'x64', 'x86_64': 'x64', 'arm64': 'arm64'}[platform.machine()]

def machine():
parser = create_parser()
(args, _) = parser.parse_known_args()
return args.machine if args.machine else {'AMD64': 'x64', 'x86_64': 'x64', 'arm64': 'arm64'}[platform.machine()]
return args.machine if args.machine else native_machine()

def version():
parser = create_parser()
args = parser.parse_args()

if args.version:
return args.version

Expand All @@ -44,7 +47,7 @@ def classifier():
parser = create_parser()
(args, _) = parser.parse_known_args()
return '-' + args.classifier if args.classifier else ''

def github_headers():
if os.environ.get('GITHUB_BASIC'):
auth = 'Basic ' + base64.b64encode(os.environ.get('GITHUB_BASIC').encode('utf-8')).decode('utf-8')
Expand All @@ -59,4 +62,3 @@ def ndk():
parser = create_parser()
(args, _) = parser.parse_known_args()
return args.ndk if args.ndk else ''

0 comments on commit 48b6820

Please sign in to comment.