Skip to content

Commit

Permalink
Renamed project to wasienv
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary committed Oct 17, 2019
1 parent 97cf45b commit 1bd7e53
Show file tree
Hide file tree
Showing 20 changed files with 74 additions and 62 deletions.
4 changes: 2 additions & 2 deletions MANIFEST.in
@@ -1,5 +1,5 @@
include wasic/wasic.cmake
include wasienv/wasienv.cmake
include README.md
include LICENSE

recursive-include wasic/stubs *
recursive-include wasienv/stubs *
54 changes: 33 additions & 21 deletions README.md
@@ -1,20 +1,32 @@
# Wasic: The WASI Compiler Toolchain
<p align="center">
<a href="https://github.com/wasienv/wasienv" target="_blank" rel="noopener noreferrer">
<img height="90" src="https://raw.githubusercontent.com/wasienv/wasienv/master/logo.png" alt="Wasienv logo">
</a>
</p>

Wasic is a toolchain for compiling to WebAssembly WASI, that let you compile C/C++ projects easily to WASI, so you can run them anywhere (in the Browsers, or with any Standalone WASI WebAssembly runtime).
<p align="center">
<a href="https://github.com/wasmerio/wasmer/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/wasienv/wasienv.svg?style=flat-square" alt="License">
</a>
</p>

# Wasienv: WASI Development Workflow for Humans

Wasienv is a tool that aims to bring all projects to WebAssembly WASI. With `wasienv` you can compile C/C++ projects easily to WASI, so you can run them anywhere (with any Standalone WASI WebAssembly runtime, or [in the Browser](https://webassembly.sh)).

> Note: If you aim to use the WebAssembly files in the web directly (using graphics, audio or other tools that are not supported in WASI) then [Emscripten](https://emscripten.org/) is probably a much better choice.
## Install

You can install `wasic` with:
You can install `wasienv` with:

```
curl https://raw.githubusercontent.com/wasic-core/wasic/master/install.sh | sh
curl https://raw.githubusercontent.com/wasienv/wasienv/master/install.sh | sh
```

## Using Wasic
## Using wasienv

If you want to compile a file to a WebAssembly WASI:
If you want to compile a C file to a WebAssembly WASI:

```bash
# To compile to a WebAssembly WASI file
Expand All @@ -32,22 +44,22 @@ wasimake cmake .

## Commands

When installing `wasic`, the following commands will be automatically avialable:
When installing `wasienv`, the following commands will be automatically avialable:

### `wasic`
### `wasienv`

This is the compiler toolchain. You have two commands available:

For installing a SDK (`wasic install-sdk`):
For installing a SDK (`wasienv install-sdk`):

```bash
wasic install-sdk 7
wasienv install-sdk 7
```

For setting a SDK as the default (`wasic default-sdk`):
For setting a SDK as the default (`wasienv default-sdk`):

```bash
wasic default-sdk 7
wasienv default-sdk 7
```

### `wasicc`
Expand All @@ -62,7 +74,7 @@ It also detects autoexecutables in the output and wraps to execute them with a W

### `wasiconfigure`

It's a helper that adds the Wasic environment vars (`CC`, `CXX`, `RUNLIB`, ...) to the following command (`./configure`).
It's a helper that adds the wasienv environment vars (`CC`, `CXX`, `RUNLIB`, ...) to the following command (`./configure`).

Example:

Expand All @@ -72,7 +84,7 @@ wasiconfigure ./configure

### `wasimake`

It's a helper that adds the Wasic environment vars (`CC`, `CXX`, `RUNLIB`, ...) for the make (`make` or `cmake`).
It's a helper that adds the wasienv environment vars (`CC`, `CXX`, `RUNLIB`, ...) for the make (`make` or `cmake`).

Example:

Expand Down Expand Up @@ -100,10 +112,10 @@ After cloning this repo, ensure dependencies are installed by running:
python setup.py develop
```

After that, all the commands will be available on your shell and you should be able to start seeing the changes directly without re-installing wasic.
After that, all the commands will be available on your shell and you should be able to start seeing the changes directly without re-installing wasienv.


## How Wasic compares to ...?
## How wasienv compares to ...?

### Emscripten

Expand All @@ -116,7 +128,7 @@ Because of that, adopting the WASI ABI is a much easier path for standalone seve
Right now Emscripten is moving towards WASI adoption. However is not yet possible to create WASI-only Wasm files since they are doing a gradual approach.
Emscripten has also some tools that are not needed in the case of sever-side Standalone WebAssembly runtimes, such as [`EM_JS` and `EM_ASM`](https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html#calling-javascript-from-c-c).

Wasic learns a lot from Emscripten, since they figured out the perfect ergonomics for having C/C++ projects to adopt WebAssembly. Alon, the creator of Emscripten is without any doubt, one of the brilliant minds behind WebAssembly and he inspired us with his work to keep improving the ergonomics of WASI.
wasienv learns a lot from Emscripten, since they figured out the perfect ergonomics for having C/C++ projects to adopt WebAssembly. Alon, the creator of Emscripten, is without any doubt one of the brilliant minds behind WebAssembly and he inspired us with his work to keep improving the ergonomics of WASI.

### WASI-libc

Expand All @@ -126,8 +138,8 @@ WASI-libc is the "frontend ABI" for WASI. By itself, it only provide header file

WASI-SDK is the union between `WASI-libc` and the compiler binaries `clang`, `wasm-ld`, ...

Wasic is using WASI-SDK under the hood to compile to WebAssembly, however it differs from it in two major ways:
* Wasic is designed to work with **multiple SDKs** versions at the same time
* Wasic is completely focused on the **ergonomics**, exposing very simple to use CLI tools so projects can adopt it easily.
wasienv is using WASI-SDK under the hood to compile to WebAssembly, however it differs from it in two major ways:
* wasienv is designed to work with **multiple SDKs** versions at the same time
* wasienv is completely focused on the **ergonomics**, exposing very simple to use CLI tools so projects can adopt it easily.

We can see of Wasic as the merge between Emscripten and the WASI-SDK.
We can see of wasienv as the merge between Emscripten and the WASI-SDK.
12 changes: 6 additions & 6 deletions install.sh
@@ -1,19 +1,19 @@
#!/bin/sh

# This install script is intended to download and install the latest available
# release of Wasic.
# release of wasienv.

# You can install using this script:
# $ curl https://raw.githubusercontent.com/wasic-core/wasic/master/install.sh | sh
# $ curl https://raw.githubusercontent.com/wasienv-core/wasienv/master/install.sh | sh

set -e
echo "Installing Wasic"
pip install --user wasic --upgrade
echo "Installing wasienv"
pip install --user wasienv --upgrade

echo "Installing a WebAssembly WASI Runtime"
curl https://get.wasmer.io -sSfL | sh

echo "Installing the required WASI SDKs"
# unstable is the most stable version of the WASI sdk for now
wasic install-sdk unstable
wasic default-sdk unstable
wasienv install-sdk unstable
wasienv default-sdk unstable
Binary file added logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 15 additions & 15 deletions setup.py
Expand Up @@ -15,29 +15,29 @@ def get_long_description():


setup(
name='wasic',
description="Wasic is a C/C++ Compiler toolchain for WASI",
name='wasienv',
description="wasienv is a C/C++ Compiler toolchain for WASI",
# long_description=get_long_description(),
long_description_content_type="text/markdown",
keywords="webassembly wasi wasic wasmer",
keywords="webassembly wasi wasienv wasmer",
author="Syrus Akbary",
author_email="syrus@wasmer.io",
url="https://github.com/wasic-core/wasic",
url="https://github.com/wasienv-core/wasienv",
version='0.1.6',
packages=['wasic'],
packages=['wasienv'],
include_package_data=True,
license="MIT",
zip_safe=False,
entry_points={'console_scripts': [
'wasiar = wasic.wasiar:run',
'wasic = wasic.wasic:run',
'wasicc = wasic.wasicc:run',
'wasic++ = wasic.wasicc:run',
'wasiconfigure = wasic.wasiconfigure:run',
'wasild = wasic.wasild:run',
'wasimake = wasic.wasimake:run',
'wasirun = wasic.wasirun:run',
'wasinm = wasic.wasinm:run',
'wasiranlib = wasic.wasiranlib:run',
'wasiar = wasienv.wasiar:run',
'wasienv = wasienv.wasienv:run',
'wasicc = wasienv.wasicc:run',
'wasic++ = wasienv.wasicc:run',
'wasiconfigure = wasienv.wasiconfigure:run',
'wasild = wasienv.wasild:run',
'wasimake = wasienv.wasimake:run',
'wasirun = wasienv.wasirun:run',
'wasinm = wasienv.wasinm:run',
'wasiranlib = wasienv.wasiranlib:run',
]},
)
File renamed without changes.
6 changes: 3 additions & 3 deletions wasic/constants.py → wasienv/constants.py
Expand Up @@ -2,7 +2,7 @@

from sdk import WASI_SDK_DIR

WASIC_DIR = os.path.dirname(__file__)
wasienv_DIR = os.path.dirname(__file__)

# The location of the underlying binaries
CC = os.path.join(WASI_SDK_DIR, "bin/clang")
Expand All @@ -23,7 +23,7 @@
WASI_RANLIB = "wasiranlib"
WASI_RUN = "wasirun"

WASI_CMAKE = os.path.abspath(os.path.join(WASIC_DIR, "wasic.cmake"))
WASI_CMAKE = os.path.abspath(os.path.join(wasienv_DIR, "wasienv.cmake"))

STUBS_SYSTEM_LIB = os.path.join(WASIC_DIR, "stubs")
STUBS_SYSTEM_LIB = os.path.join(wasienv_DIR, "stubs")
STUBS_SYSTEM_PREAMBLE = os.path.join(STUBS_SYSTEM_LIB, "preamble.h")
4 changes: 2 additions & 2 deletions wasic/sdk.py → wasienv/sdk.py
Expand Up @@ -10,8 +10,8 @@
# Where the python packages live
PACKAGES_DIR = os.path.dirname(os.path.dirname(__file__))

# Where the Wasic storage lives
WASI_STORAGE_DIR = os.path.join(PACKAGES_DIR, "wasic-storage")
# Where the wasienv storage lives
WASI_STORAGE_DIR = os.path.join(PACKAGES_DIR, "wasienv-storage")
WASI_SDKS_DIR = os.path.join(WASI_STORAGE_DIR, "sdks")

CURRENT_SDK = "7"
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions wasic/tools.py → wasienv/tools.py
Expand Up @@ -9,7 +9,7 @@
import shutil
import stat

logger = logging.getLogger('wasic')
logger = logging.getLogger('wasienv')


class Py2CalledProcessError(subprocess.CalledProcessError):
Expand Down Expand Up @@ -41,7 +41,7 @@ def check_returncode(self):


def run_process(cmd, check=True, input=None, *args, **kw):
logger.debug("Wasic run process: {}".format(" ".join(cmd)))
logger.debug("wasienv run process: {}".format(" ".join(cmd)))
debug_text = '%sexecuted %s' % ('successfully ' if check else '', ' '.join(cmd))

if hasattr(subprocess, "run"):
Expand Down
File renamed without changes.
16 changes: 8 additions & 8 deletions wasic/wasic.cmake → wasienv/wasic.cmake
Expand Up @@ -10,11 +10,11 @@ set(CMAKE_SYSTEM_PROCESSOR x86)

set(CMAKE_C_COMPILER $ENV{WASI_CC})
set(CMAKE_CXX_COMPILER $ENV{WASI_CXX})
set(CMAKE_LINKER $ENV{WASI_LD} CACHE STRING "Wasic build")
set(CMAKE_AR $ENV{WASI_AR} CACHE STRING "Wasic build")
set(CMAKE_RANLIB $ENV{WASI_RANLIB} CACHE STRING "Wasic build")
set(CMAKE_LINKER $ENV{WASI_LD} CACHE STRING "wasienv build")
set(CMAKE_AR $ENV{WASI_AR} CACHE STRING "wasienv build")
set(CMAKE_RANLIB $ENV{WASI_RANLIB} CACHE STRING "wasienv build")

set(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-threads" CACHE STRING "Wasic build")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-threads" CACHE STRING "wasienv build")

# Don't look in the sysroot for executables to run during the build
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
Expand Down Expand Up @@ -51,8 +51,8 @@ endif()

# set(CMAKE_C_COMPILER_TARGET ${triple} CACHE STRING "wasi-sdk build")
# set(CMAKE_CXX_COMPILER_TARGET ${triple} CACHE STRING "wasi-sdk build")
# set(CMAKE_C_FLAGS "-v" CACHE STRING "Wasic build")
# set(CMAKE_CXX_FLAGS "-v -std=c++11" CACHE STRING "Wasic build")
# set(CMAKE_C_FLAGS "-v" CACHE STRING "wasienv build")
# set(CMAKE_CXX_FLAGS "-v -std=c++11" CACHE STRING "wasienv build")

# set(CMAKE_SYSROOT ${WASI_SDK_PREFIX}/share/wasi-sysroot CACHE STRING "Wasic build")
# set(CMAKE_STAGING_PREFIX ${WASI_SDK_PREFIX}/share/wasi-sysroot CACHE STRING "Wasic build")
# set(CMAKE_SYSROOT ${WASI_SDK_PREFIX}/share/wasi-sysroot CACHE STRING "wasienv build")
# set(CMAKE_STAGING_PREFIX ${WASI_SDK_PREFIX}/share/wasi-sysroot CACHE STRING "wasienv build")
4 changes: 2 additions & 2 deletions wasic/wasicc.py → wasienv/wasicc.py
Expand Up @@ -13,12 +13,12 @@
def run(args):
main_program = CXX if args[0].endswith("wasic++") else CC
if '--version' in args:
print('''wasic (Wasic gcc/clang-like replacement)''')
print('''wasienv (wasienv gcc/clang-like replacement)''')
return 0

if len(args) == 1 and args[0] == '-v': # -v with no inputs
# autoconf likes to see 'GNU' in the output to enable shared object support
print('wasic (Wasic gcc/clang-like replacement + linker emulating GNU ld)', file=sys.stderr)
print('wasienv (wasienv gcc/clang-like replacement + linker emulating GNU ld)', file=sys.stderr)
code = run_process([main_program, '-v'], check=False).returncode
return code

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion wasic/wasic.py → wasienv/wasienv.py
Expand Up @@ -11,7 +11,7 @@
@wrap_run
def run(args):
if len(args) <= 1:
print("Wasic command line tool")
print("wasienv command line tool")
return
if args[1] == "install-sdk":
sdk_version = args[2]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 1bd7e53

Please sign in to comment.