Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add(main): new package esbuild #11895

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions packages/esbuild/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
TERMUX_PKG_HOMEPAGE=https://esbuild.github.io/
TERMUX_PKG_DESCRIPTION="An extremely fast JavaScript and CSS bundler and minifier"
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="0.15.12"
TERMUX_PKG_SRCURL=https://github.com/evanw/esbuild/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=3b00894d38b077e0a92928b4ac9018d44249b94d515b73f7da009aa87dab7d63
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_AUTO_UPDATE=true

termux_step_pre_configure() {
termux_setup_golang
termux_setup_nodejs
}

termux_step_make() {
if [ $TERMUX_ARCH = "arm" ]; then
export GOOS="android"
export GOARCH=arm
make platform-android-arm
elif [ $TERMUX_ARCH = "aarch64" ]; then
export GOOS="android"
export GOARCH=arm64
make platform-android-arm64
elif [ $TERMUX_ARCH = "i686" ]; then
export GOARCH=386
make
elif [ $TERMUX_ARCH = "x86_64" ]; then
export GOARCH=amd64
make
fi
}

termux_step_make_install() {
if [ $TERMUX_ARCH = "arm" ]; then
install -Dm755 -t "${TERMUX_PREFIX}"/bin npm/esbuild-android-arm/bin/esbuild
elif [ $TERMUX_ARCH = "aarch64" ]; then
install -Dm755 -t "${TERMUX_PREFIX}"/bin npm/esbuild-android-arm64/bin/esbuild
elif [ $TERMUX_ARCH = "i686" ]; then
install -Dm755 -t "${TERMUX_PREFIX}"/bin esbuild
elif [ $TERMUX_ARCH = "x86_64" ]; then
install -Dm755 -t "${TERMUX_PREFIX}"/bin esbuild
fi
}
23 changes: 23 additions & 0 deletions packages/esbuild/set-cc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff -uNr esbuild-0.15.7/Makefile esbuild-0.15.7.mod/Makefile
--- esbuild-0.15.7/Makefile 2022-09-04 20:31:27.000000000 +0800
+++ esbuild-0.15.7.mod/Makefile 2022-09-12 13:09:37.228822827 +0800
@@ -7,7 +7,7 @@
GO_FLAGS += -trimpath

esbuild: version-go cmd/esbuild/*.go pkg/*/*.go internal/*/*.go go.mod
- CGO_ENABLED=0 go build $(GO_FLAGS) ./cmd/esbuild
+ CGO_ENABLED=0 CC=${CC} go build $(GO_FLAGS) ./cmd/esbuild

test:
@$(MAKE) --no-print-directory -j6 test-common
@@ -296,7 +296,7 @@
@test -n "$(GOARCH)" || (echo "The environment variable GOARCH must be provided" && false)
@test -n "$(NPMDIR)" || (echo "The environment variable NPMDIR must be provided" && false)
node scripts/esbuild.js "$(NPMDIR)/package.json" --version
- CGO_ENABLED=0 GOOS="$(GOOS)" GOARCH="$(GOARCH)" go build $(GO_FLAGS) -o "$(NPMDIR)/bin/esbuild" ./cmd/esbuild
+ CGO_ENABLED=0 CC=${CC} GOOS="$(GOOS)" GOARCH="$(GOARCH)" go build $(GO_FLAGS) -o "$(NPMDIR)/bin/esbuild" ./cmd/esbuild

platform-android: platform-wasm
node scripts/esbuild.js npm/esbuild-android-64/package.json --version
Binary files esbuild-0.15.7/esbuild and esbuild-0.15.7.mod/esbuild differ
Binary files esbuild-0.15.7/npm/esbuild-android-arm64/bin/esbuild and esbuild-0.15.7.mod/npm/esbuild-android-arm64/bin/esbuild differ