From 2302d3ee17b3dee696e11a7d1a6c24d597d65d5a Mon Sep 17 00:00:00 2001 From: xinlu Date: Tue, 9 Sep 2025 11:00:58 +0800 Subject: [PATCH 1/3] build: add macOS 15.4+ strchrnul compatibility fix Add build environment configuration to handle strchrnul availability on macOS 15.4+. This ensures proper compilation on newer macOS versions by setting the appropriate deployment target and CGO flags when needed. --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 894a38df78..7e213cfb03 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,16 @@ CGO_ENABLED = 1 COMMIT_HASH := $(shell git --no-pager describe --tags --always --dirty) LDFLAGS = "-X github.com/sqlc-dev/sqlc/internal/info.Version=$(COMMIT_HASH)-wicked-fork" +# macOS 15.4+ needs strchrnul fix +BUILD_ENV = $(shell [ "$$(uname -s)" = "Darwin" ] && [ "$$(sw_vers -productVersion | cut -d. -f1)" -ge 15 ] && echo 'MACOSX_DEPLOYMENT_TARGET=15.4 CGO_CFLAGS="-DHAVE_STRCHRNUL"') .PHONY: build build-endtoend test test-ci test-examples test-endtoend regen start psql mysqlsh proto build: - CGO_ENABLED=$(CGO_ENABLED) go build -ldflags=$(LDFLAGS) -o bin/ ./cmd/... + $(BUILD_ENV) CGO_ENABLED=$(CGO_ENABLED) go build -ldflags=$(LDFLAGS) -o bin/ ./cmd/... install: - CGO_ENABLED=$(CGO_ENABLED) go install -ldflags=$(LDFLAGS) ./cmd/... + $(BUILD_ENV) CGO_ENABLED=$(CGO_ENABLED) go install -ldflags=$(LDFLAGS) ./cmd/... test: CGO_ENABLED=$(CGO_ENABLED) go test ./... From 6d2cf32cf442a66cc09ef67d1b3a6772d4b5d9ca Mon Sep 17 00:00:00 2001 From: xinlu Date: Tue, 9 Sep 2025 11:02:05 +0800 Subject: [PATCH 2/3] fix: update version variable path in release script Update the ldflags version variable path from internal/cmd.version to internal/info.Version to match the current codebase structure. --- scripts/release.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release.go b/scripts/release.go index a8651a6ee7..682ebed7aa 100755 --- a/scripts/release.go +++ b/scripts/release.go @@ -32,7 +32,7 @@ func main() { } if *docker { - x := "-extldflags \"-static\" -X github.com/sqlc-dev/sqlc/internal/cmd.version=" + version + x := "-extldflags \"-static\" -X github.com/sqlc-dev/sqlc/internal/info.Version=" + version args := []string{ "build", "-a", From 40720573ea8d820b947351d058b0c769f0c07b43 Mon Sep 17 00:00:00 2001 From: xinlu Date: Tue, 14 Oct 2025 15:14:46 +0800 Subject: [PATCH 3/3] refactor: update wpgx import path to one2x-ai organization - Change wpgx import from github.com/stumble/wpgx to github.com/one2x-ai/wpgx - Update driver.go SQLDriverWPGX constant - Update imports.go wpgx package references in db and batch imports - Required for organization-specific wpgx fork with SSL support --- internal/codegen/golang/driver.go | 2 +- internal/codegen/golang/imports.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/codegen/golang/driver.go b/internal/codegen/golang/driver.go index 5b89f2db8c..42e8f5486f 100644 --- a/internal/codegen/golang/driver.go +++ b/internal/codegen/golang/driver.go @@ -16,7 +16,7 @@ const ( SQLDriverPGXV5 = "github.com/jackc/pgx/v5" SQLDriverLibPQ = "github.com/lib/pq" SQLDriverGoSQLDriverMySQL = "github.com/go-sql-driver/mysql" - SQLDriverWPGX = "github.com/stumble/wpgx" + SQLDriverWPGX = "github.com/one2x-ai/wpgx" ) func parseDriver(sqlPackage string) SQLDriver { diff --git a/internal/codegen/golang/imports.go b/internal/codegen/golang/imports.go index c961cd5349..79ca92d4bf 100644 --- a/internal/codegen/golang/imports.go +++ b/internal/codegen/golang/imports.go @@ -130,7 +130,7 @@ func (i *importer) dbImports() fileImports { pkg = append(pkg, ImportSpec{Path: "github.com/jackc/pgx/v5"}) case SQLDriverWPGX: std = []ImportSpec{} - pkg = append(pkg, ImportSpec{Path: "github.com/stumble/wpgx"}) + pkg = append(pkg, ImportSpec{Path: "github.com/one2x-ai/wpgx"}) pkg = append(pkg, ImportSpec{Path: "github.com/stumble/dcache"}) default: std = append(std, ImportSpec{Path: "database/sql"}) @@ -496,7 +496,7 @@ func (i *importer) batchImports() fileImports { case SQLDriverPGXV5: pkg[ImportSpec{Path: "github.com/jackc/pgx/v5"}] = struct{}{} case SQLDriverWPGX: - pkg[ImportSpec{Path: "github.com/stumble/wpgx"}] = struct{}{} + pkg[ImportSpec{Path: "github.com/one2x-ai/wpgx"}] = struct{}{} } return sortedImports(std, pkg)