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

Core/multiplatform binaries #21

Merged
merged 16 commits into from
May 12, 2024
Merged
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
56 changes: 45 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# TODO: Look into way for `sub-makes` to maintain
# variable references to the root make. For now I've
# used `TGOOS`, `TGOARCH`, and `TNPMDIR` in the
# `platform-unixlike` target to solve this issue
VERSION := $(shell go run scripts/version.go)
# Strip debug info (symbol table and DWARF)
# Also add version info to binary
Expand All @@ -19,20 +23,29 @@ clean:
rm -rf \
darwin-arm64/bin \
darwin-x64/bin \
linux-x64/bin
linux-x64/bin \
windows-arm64/bin \
windows-ia32/bin \
windows-x64/bin

cd npm/@tmplts && \
rm -f\
darwin-arm64/README.md darwin-arm64/LICENSE \
darwin-x64/README.md darwin-x64/LICENSE \
linux-x64/README.md linux-x64/LICENSE
linux-x64/README.md linux-x64/LICENSE \
windows-arm64/README.md windows-arm64/LICENSE \
windows-ia32/README.md windows-ia32/LICENSE \
windows-x64/README.md windows-x64/LICENSE

.PHONY copy-files:
copy-files:
cp README.md LICENSE npm/
cp README.md LICENSE npm/@tmplts/darwin-arm64/
cp README.md LICENSE npm/@tmplts/darwin-x64/
cp README.md LICENSE npm/@tmplts/linux-x64/
cp README.md LICENSE npm/@tmplts/windows-arm64/
cp README.md LICENSE npm/@tmplts/windows-ia32/
cp README.md LICENSE npm/@tmplts/windows-x64/

##############
# Publishing #
Expand All @@ -53,7 +66,10 @@ publish-all: copy-files
publish-default \
publish-darwin-arm64 \
publish-darwin-x64 \
publish-linux-x64
publish-linux-x64 \
publish-windows-arm64 \
publish-windows-ia32 \
publish-windows-x64

publish-default: platform-default
cd npm && npm publish
Expand All @@ -67,24 +83,42 @@ publish-darwin-x64: platform-darwin-x64
publish-linux-x64: platform-linux-x64
cd npm/@tmplts/linux-x64 && npm publish

publish-windows-arm64: platform-windows-arm64
cd npm/@tmplts/windows-arm64 && npm publish

publish-windows-ia32: platform-windows-ia32
cd npm/@tmplts/windows-ia32 && npm publish

publish-windows-x64: platform-windows-x64
cd npm/@tmplts/windows-x64 && npm publish


##################
# Platform Build #
##################
platform-unixlike:
@test -n "$(GOOS)" || (echo "The environment variable GOOS must be provided" && false)
@test -n "$(GOARCH)" || (echo "The environment variable GOARCH must be provided" && false)
@test -n "$(NPMDIR)" || (echo "The environment variable NPMDIR must be provided" && false)
CGO_ENABLED=0 GOOS="$(GOOS)" GOARCH="$(GOARCH)" go build $(GO_FLAGS) -o "$(NPMDIR)/bin/tmplts"
@test -n "$(TGOOS)" || (echo "The environment variable GOOS must be provided" && false)
@test -n "$(TGOARCH)" || (echo "The environment variable GOARCH must be provided" && false)
@test -n "$(TNPMDIR)" || (echo "The environment variable NPMDIR must be provided" && false)
CGO_ENABLED=0 GOOS="$(TGOOS)" GOARCH="$(TGOARCH)" go build $(GO_FLAGS) -o "$(TNPMDIR)/bin/tmplts"

platform-default:
@$(MAKE) --no-print-directory GOOS=darwin GOARCH=arm64 NPMDIR=npm platform-unixlike
@$(MAKE) --no-print-directory TGOOS=darwin TGOARCH=arm64 TNPMDIR=npm platform-unixlike

platform-darwin-arm64:
@$(MAKE) --no-print-directory GOOS=darwin GOARCH=arm64 NPMDIR=npm/@tmplts/darwin-arm64 platform-unixlike
@$(MAKE) --no-print-directory TGOOS=darwin TGOARCH=arm64 TNPMDIR=npm/@tmplts/darwin-arm64 platform-unixlike

platform-darwin-x64:
@$(MAKE) --no-print-directory GOOS=darwin GOARCH=amd64 NPMDIR=npm/@tmplts/darwin-x64 platform-unixlike
@$(MAKE) --no-print-directory TGOOS=darwin TGOARCH=amd64 TNPMDIR=npm/@tmplts/darwin-x64 platform-unixlike

platform-linux-x64:
@$(MAKE) --no-print-directory GOOS=linux GOARCH=amd64 NPMDIR=npm/@tmplts/linux-x64 platform-unixlike
@$(MAKE) --no-print-directory TGOOS=linux TGOARCH=amd64 TNPMDIR=npm/@tmplts/linux-x64 platform-unixlike

platform-windows-arm64:
CGO_ENABLED=0 GOOS="windows" GOARCH="arm64" go build $(GO_FLAGS) -o "npm/@tmplts/windows-arm64/bin/tmplts.exe"

platform-windows-ia32:
CGO_ENABLED=0 GOOS="windows" GOARCH="386" go build $(GO_FLAGS) -o "npm/@tmplts/windows-ia32/bin/tmplts.exe"

platform-windows-x64:
CGO_ENABLED=0 GOOS="windows" GOARCH="amd64" go build $(GO_FLAGS) -o "npm/@tmplts/windows-x64/bin/tmplts.exe"
2 changes: 1 addition & 1 deletion npm/@tmplts/darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tmplts/darwin-arm64",
"author": "ev-the-dev",
"version": "0.1.2",
"version": "0.1.3",
"description": "MacOS ARM 64-bit (Mac Silicon) binary for TmplTS",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion npm/@tmplts/darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tmplts/darwin-x64",
"author": "ev-the-dev",
"version": "0.1.2",
"version": "0.1.3",
"description": "MacOS AMD 64-bit (Intel) binary for TmplTS",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion npm/@tmplts/linux-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tmplts/linux-x64",
"author": "ev-the-dev",
"version": "0.1.2",
"version": "0.1.3",
"description": "Linux 64-bit (Intel) binary for TmplTS",
"license": "Apache-2.0",
"repository": {
Expand Down
20 changes: 20 additions & 0 deletions npm/@tmplts/windows-arm64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@tmplts/windows-arm64",
"author": "ev-the-dev",
"version": "0.1.3",
"description": "Windows ARM 64-bit binary for TmplTS",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/ev-the-dev/tmplts.git"
},
"publishConfig": {
"access": "public"
},
"os": [
"win32"
],
"cpu": [
"arm64"
]
}
20 changes: 20 additions & 0 deletions npm/@tmplts/windows-ia32/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@tmplts/windows-ia32",
"author": "ev-the-dev",
"version": "0.1.3",
"description": "Windows 32-bit binary for TmplTS",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/ev-the-dev/tmplts.git"
},
"publishConfig": {
"access": "public"
},
"os": [
"win32"
],
"cpu": [
"ia32"
]
}
20 changes: 20 additions & 0 deletions npm/@tmplts/windows-x64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@tmplts/windows-x64",
"author": "ev-the-dev",
"version": "0.1.3",
"description": "Windows 64-bit binary for TmplTS",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/ev-the-dev/tmplts.git"
},
"publishConfig": {
"access": "public"
},
"os": [
"win32"
],
"cpu": [
"x64"
]
}
11 changes: 7 additions & 4 deletions npm/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ev-the-dev/tmplts",
"author": "ev-the-dev",
"version": "0.1.2",
"version": "0.1.3",
"description": "TypeScript Project Configuration Bootstrapper",
"license": "Apache-2.0",
"bin": {
Expand Down Expand Up @@ -29,9 +29,12 @@
"url": "https://github.com/ev-the-dev/tmplts/issues"
},
"optionalDependencies": {
"@tmplts/darwin-arm64": "0.1.2",
"@tmplts/darwin-x64": "0.1.2",
"@tmplts/linux-x64": "0.1.2"
"@tmplts/darwin-arm64": "0.1.3",
"@tmplts/darwin-x64": "0.1.3",
"@tmplts/linux-x64": "0.1.3",
"@tmplts/win32-arm64": "0.1.3",
"@tmplts/win32-ia32": "0.1.3",
"@tmplts/win32-x64": "0.1.3"
},
"keywords": [
"typescript",
Expand Down
Loading