Skip to content

Commit

Permalink
Support ppc64le architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
Trung Le committed May 26, 2020
1 parent b53cba4 commit f22641f
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/npm/esbuild-darwin-64/bin/esbuild
/npm/esbuild-linux-64/bin/esbuild
/npm/esbuild-linux-arm64/bin/esbuild
/npm/esbuild-linux-ppc64le/bin/esbuild
/npm/esbuild-wasm/esbuild.wasm
/npm/esbuild-wasm/lib/
/npm/esbuild-wasm/wasm_exec.js
Expand Down
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
golang 1.14.1
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ update-version-go:
echo "package main\n\nconst esbuildVersion = \"$(ESBUILD_VERSION)\"" > cmd/esbuild/version.go

platform-all: update-version-go test test-wasm
make -j6 platform-windows platform-darwin platform-linux platform-linux-arm64 platform-wasm platform-neutral
make -j6 platform-windows platform-darwin platform-linux platform-linux-arm64 platform-linux-ppc64le platform-wasm platform-neutral

platform-windows:
cd npm/esbuild-windows-64 && npm version "$(ESBUILD_VERSION)" --allow-same-version
Expand All @@ -44,6 +44,11 @@ platform-linux-arm64:
cd npm/esbuild-linux-arm64 && npm version "$(ESBUILD_VERSION)" --allow-same-version
GOOS=linux GOARCH=arm64 go build -o npm/esbuild-linux-arm64/bin/esbuild ./cmd/esbuild

platform-linux-ppc64le:
mkdir -p npm/esbuild-linux-ppc64le/bin
cd npm/esbuild-linux-ppc64le && npm version "$(ESBUILD_VERSION)" --allow-same-version
GOOS=linux GOARCH=ppc64le go build -o npm/esbuild-linux-ppc64le/bin/esbuild ./cmd/esbuild

platform-wasm:
GOOS=js GOARCH=wasm go build -o npm/esbuild-wasm/esbuild.wasm ./cmd/esbuild
cd npm/esbuild-wasm && npm version "$(ESBUILD_VERSION)" --allow-same-version
Expand All @@ -55,7 +60,7 @@ platform-neutral:
cd npm/esbuild && npm version "$(ESBUILD_VERSION)" --allow-same-version

publish-all: update-version-go test test-wasm
make -j6 publish-windows publish-darwin publish-linux publish-linux-arm64 publish-wasm publish-neutral
make -j6 publish-windows publish-darwin publish-linux publish-linux-arm64 publish-linux-ppc64le publish-wasm publish-neutral
git commit -am "publish $(ESBUILD_VERSION) to npm"
git tag "v$(ESBUILD_VERSION)"
git push origin master "v$(ESBUILD_VERSION)"
Expand All @@ -72,6 +77,9 @@ publish-linux: platform-linux
publish-linux-arm64: platform-linux-arm64
[ ! -z "$(OTP)" ] && cd npm/esbuild-linux-arm64 && npm publish --otp="$(OTP)"

publish-linux-ppc64le: platform-linux-ppc64le
[ ! -z "$(OTP)" ] && cd npm/esbuild-linux-ppc64le && npm publish --otp="$(OTP)"

publish-wasm: platform-wasm
[ ! -z "$(OTP)" ] && cd npm/esbuild-wasm && npm publish --otp="$(OTP)"

Expand All @@ -83,6 +91,8 @@ clean:
rm -f npm/esbuild-windows-64/esbuild.exe
rm -rf npm/esbuild-darwin-64/bin
rm -rf npm/esbuild-linux-64/bin
rm -rf npm/esbuild-linux-arm64/bin
rm -rf npm/esbuild-linux-ppc64le/bin
rm -f npm/esbuild-wasm/esbuild.wasm npm/esbuild-wasm/wasm_exec.js
rm -rf npm/esbuild-wasm/lib
go clean -testcache ./internal/...
Expand Down
3 changes: 3 additions & 0 deletions npm/esbuild-linux-ppc64le/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# esbuild

This is the Linux PowerPC 64-bit Little Endian binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details.
16 changes: 16 additions & 0 deletions npm/esbuild-linux-ppc64le/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "esbuild-linux-ppc64le",
"version": "0.4.1",
"description": "The Linux PowerPC 64-bit Little Endian binary for esbuild, a JavaScript bundler.",
"repository": "https://github.com/evanw/esbuild",
"license": "MIT",
"os": [
"linux"
],
"cpu": [
"ppc64"
],
"directories": {
"bin": "bin"
}
}
2 changes: 2 additions & 0 deletions npm/esbuild/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ if (process.platform === 'linux' && os.arch() === 'x64') {
installOnUnix('esbuild-linux-64');
} else if (process.platform === 'linux' && os.arch() === 'arm64') {
installOnUnix('esbuild-linux-arm64');
} else if (process.platform === 'linux' && os.arch() === 'ppc64' && os.endianness() === 'LE') {
installOnUnix('esbuild-linux-ppc64le');
} else if (process.platform === 'darwin' && os.arch() === 'x64') {
installOnUnix('esbuild-darwin-64');
} else if (process.platform === 'win32' && os.arch() === 'x64') {
Expand Down
7 changes: 7 additions & 0 deletions npm/esbuild/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ function esbuildSpawn({ flags, stdio }) {
});
}

if (process.platform === 'linux' && os.arch() === 'ppc64' && os.endianness() === 'LE') {
return child_process.spawn(path.join(__dirname, '..', 'bin', 'esbuild'), flags, {
cwd: process.cwd(),
stdio,
});
}

if (process.platform === 'win32' && os.arch() === 'x64') {
if (WASM) {
return child_process.spawn('node', [path.join(__dirname, '..', 'bin', 'esbuild')].concat(flags), {
Expand Down

0 comments on commit f22641f

Please sign in to comment.