Skip to content

Commit

Permalink
first release
Browse files Browse the repository at this point in the history
  • Loading branch information
xdoardo committed Oct 16, 2024
0 parents commit 7a9d897
Show file tree
Hide file tree
Showing 5 changed files with 307 additions and 0 deletions.
165 changes: 165 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
name: Build

on: [push]

jobs:
build:
name: Build
permissions: write-all
strategy:
matrix:
target:
- id: 'linux-amd64'
os: 'ubuntu-20.04'
- id: 'darwin-amd64'
os: 'macos-13'
- id: 'darwin-aarch64'
os: 'macos-latest'
- id: 'windows-amd64'
os: 'windows-2022'
# When unpacking an archive on Windows, the symlinks can't be
# created unless the target path already exists. This causes
# problems when the linked file is ordered after the link
# inside the archive. Dereferencing the files when packing them
# adds an additional copy per link, but it reliably works and
# the additional size is not too large on Windows.
tar_extra_args: '--dereference'
tag: ['11.6']
fail-fast: true

runs-on: ${{ matrix.target.os }}

steps:
- name: Check out the code
uses: actions/checkout@v3

- name: Install `ninja` on Ubuntu
if: startsWith(matrix.target.id, 'linux-')
shell: bash
run: |
sudo apt-get install ninja-build -y
- name: Install `ninja` on macOS
if: startsWith(matrix.target.id, 'darwin-')
shell: bash
run: |
brew install ninja
- name: Install `ninja` on Windows
if: startsWith(matrix.target.id, 'windows-')
shell: bash
run: |
choco install ninja
- name: Setup MSVC (Windows)
uses: ilammy/msvc-dev-cmd@v1
if: matrix.target.id == 'windows-amd64'

- name: Build
if: matrix.target.id != 'windows-amd64'
shell: bash
run: |
./build.sh
- name: Build (Windows)
if: matrix.target.id == 'windows-amd64'
run: |
./build.ps1
- name: Zip
if: matrix.target.id != 'windows-amd64'
shell: bash
run: |
mkdir -p dist
tar --directory v8-cmake/build --create --xz --verbose ${{ matrix.target.tar_extra_args }} --file dist/wee8.tar.xz libv8_base_without_compiler.a libv8_compiler.a libv8_initializers.a libv8_libbase.a libv8_libplatform.a libv8_libsampler.a libv8_snapshot.a libv8_torque_generated.a libwee8.a
ls -lh dist/wee8.tar.xz
- name: Zip (Windows)
if: matrix.target.id == 'windows-amd64'
shell: bash
run: |
mkdir -p dist
tar --directory v8-cmake/build --create --xz --verbose ${{ matrix.target.tar_extra_args }} --file dist/wee8.tar.xz v8_base_without_compiler.lib v8_compiler.lib v8_initializers.lib v8_libbase.lib v8_libplatform.lib v8_libsampler.lib v8_snapshot.lib v8_torque_generated.lib wee8.lib
ls -lh dist/wee8.tar.xz
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target.id }}-${{ matrix.tag }}
path: dist
if-no-files-found: error
retention-days: 1

release:
name: Release
runs-on: ubuntu-latest
permissions: write-all
needs: [build]
strategy:
matrix:
tag: ['11.6']


steps:
- name: Download the Artifacts
uses: actions/download-artifact@v3
with:
path: artifacts

- name: Inspect
shell: bash
run: |
ls -laGiR ./*
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ matrix.tag }}
name: Release ${{ matrix.tag }}
allowUpdates: true
draft: false
prerelease: false

- name: Upload Release Asset Linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/linux-amd64-${{matrix.tag}}/wee8.tar.xz
asset_name: wee8-linux-amd64.tar.xz
asset_content_type: application/gzip

- name: Upload Release Asset Darwin
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/darwin-amd64-${{matrix.tag}}/wee8.tar.xz
asset_name: wee8-darwin-amd64.tar.xz
asset_content_type: application/gzip

- name: Upload Release Asset Darwin (aarch64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/darwin-aarch64-${{matrix.tag}}/wee8.tar.xz
asset_name: wee8-darwin-aarch64.tar.xz
asset_content_type: application/gzip

- name: Upload Release Asset Windows
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/windows-amd64-${{matrix.tag}}/wee8.tar.xz
asset_name: wee8-windows-amd64.tar.xz
asset_content_type: application/gzip
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019-present Wasmer, Inc. and its affiliates.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<div align="center">
<a href="https://wasmer.io" target="_blank" rel="noopener noreferrer">
<img width="300" src="https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/logo.png" alt="Wasmer logo">
</a>

<h1>wee8 Custom Builds</h1>

<p>
<a href="https://github.com/xdoardo/wee8-custom-builds/actions?query=workflow%3A%22Build%22">
<img src="https://github.com/wasmerio/llvm-custom-builds/workflows/Build/badge.svg" alt="Build Status">
</a>
<a href="https://github.com/xdoardo/wee8-custom-builds/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/wasmerio/llvm-custom-builds.svg" alt="License">
</a>
</p>

<h3>
<a href="https://wasmer.io/">Website</a>
<span> • </span>
<a href="https://docs.wasmer.io">Docs</a>
<span> • </span>
<a href="https://slack.wasmer.io/">Slack Channel</a>
</h3>

</div>

<hr/>

> Go along your path, this is a dangerous place.
36 changes: 36 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
$V8_REPO_URL = $args[1]

if ([string]::IsNullOrEmpty($V8_REPO_URL)) {
$V8_REPO_URL = "https://github.com/laper32/v8-cmake.git"
}

# Clone the LLVM project.
if (-not (Test-Path -Path "v8-cmake" -PathType Container)) {
git clone -b "msvc" --single-branch --depth=1 "$V8_REPO_URL" v8-cmake
}

Set-Location v8-cmake
git fetch origin

# Create a directory to build the project.
New-Item -Path "build" -Force -ItemType "directory"
Set-Location build

# Create a directory to receive the complete installation.
New-Item -Path "install" -Force -ItemType "directory"

# Adjust compilation based on the OS.
$CMAKE_ARGUMENTS = ""

# Adjust cross compilation
$CROSS_COMPILE = ""

# Run `cmake` to configure the project, using MSVC.
$CMAKE_CXX_COMPILER="cl.exe"
$CMAKE_C_COMPILER="cl.exe"
$CMAKE_LINKER_TYPE="MSVC"

cmake -G "Ninja" -DCMAKE_BUILD_TYPE=MinSizeRel ..

# Showtime!
cmake --build . --config MinSizeRel --target wee8
56 changes: 56 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

# Display all commands before executing them.
set -o errexit
set -o errtrace

V8_REPO_URL=${2:-https://github.com/laper32/v8-cmake.git}
LLVM_CROSS="$3"

if [[ -z "$V8_REPO_URL" ]]
then
echo "Usage: $0 <v8-repository-url>"
echo
echo "# Arguments"
echo " v8-repository-url The URL used to clone v8-cmake sources (default: $V8_REPO_URL)"

exit 1
fi

if [ ! -d v8-cmake ]
then
git clone -b "msvc" --single-branch --depth=1 "$V8_REPO_URL" v8-cmake
fi

cd v8-cmake

# Create a directory to build the project.
mkdir -p build
cd build

# Create a directory to receive the complete installation.
mkdir -p install

# Adjust compilation based on the OS.
CMAKE_ARGUMENTS=""

case "${OSTYPE}" in
darwin*) ;;
linux*) ;;
*) ;;
esac

## Adjust cross compilation
#CROSS_COMPILE=""
#
#case "${LLVM_CROSS}" in
# aarch64*) CROSS_COMPILE="-DLLVM_HOST_TRIPLE=aarch64-linux-gnu" ;;
# riscv64*) CROSS_COMPILE="-DLLVM_HOST_TRIPLE=riscv64-linux-gnu" ;;
# *) ;;
#esac

# Run `cmake` to configure the project.
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=MinSizeRel ..

# Showtime!
cmake --build . --config MinSizeRel --target wee8

0 comments on commit 7a9d897

Please sign in to comment.