diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..4363cb80 --- /dev/null +++ b/.gitignore @@ -0,0 +1,32 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so +*.txt +*.cache +.DS_Store + +# gop +# gopfmt +# goptestgo + +# Folders +_obj +_test +_old +_t + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go +coverage.txt + +xgo_autogen*.go diff --git a/README.md b/README.md index 446b1356..99886104 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@ [![Test](https://github.com/goplus/llar/actions/workflows/go.yml/badge.svg)](https://github.com/goplus/llar/actions/workflows/go.yml) [![codecov](https://codecov.io/gh/goplus/llar/branch/main/graph/badge.svg)](https://codecov.io/gh/goplus/llar) -[![Language](https://img.shields.io/badge/language-XGo-blue.svg)](https://github.com/goplus/gop) +[![Language](https://img.shields.io/badge/language-XGo-blue.svg)](https://github.com/goplus/xgo) -LLAR is a cloud-based multi-language package manager built with [XGo](https://github.com/goplus/gop). It resolves dependencies, downloads source code, and builds libraries from source using declarative formulas. +LLAR is a cloud-based multi-language package manager built with [XGo](https://github.com/goplus/xgo). It resolves dependencies, downloads source code, and builds libraries from source using declarative formulas. ## Installation diff --git a/cmp/cmp.go b/cmp/cmp.go index f3d0daef..8aa2e6fb 100644 --- a/cmp/cmp.go +++ b/cmp/cmp.go @@ -6,7 +6,9 @@ package cmp import "github.com/goplus/llar/mod/module" -const GopPackage = true +const ( + XGoPackage = true +) type CmpApp struct { fCompareVer func(a, b module.Version) int @@ -14,11 +16,11 @@ type CmpApp struct { // The provided function fn will be used to compare version strings // when resolving dependencies for those versions which are not in Debian-style. -func (f *CmpApp) CompareVer(fn func(a, b module.Version) int) { - f.fCompareVer = fn +func (app *CmpApp) CompareVer(fn func(a, b module.Version) int) { + app.fCompareVer = fn } -// Gopt_CmpApp_Main is main entry of this classfile. -func Gopt_CmpApp_Main(this interface{ MainEntry() }) { +// XGot_CmpApp_Main is main entry of this classfile. +func XGot_CmpApp_Main(this interface{ MainEntry() }) { this.MainEntry() } diff --git a/formula/classfile.go b/formula/classfile.go index f9d5b91b..a3532236 100644 --- a/formula/classfile.go +++ b/formula/classfile.go @@ -13,7 +13,9 @@ import ( "github.com/qiniu/x/gsh" ) -const GopPackage = true +const ( + XGoPackage = true +) // ----------------------------------------------------------------------------- @@ -269,11 +271,13 @@ func (p *ModuleF) OnTest(f func(ctx *Context, proj *Project, out *TestResult)) { // ----------------------------------------------------------------------------- -// Gopt_ModuleF_Main is main entry of this classfile. -func Gopt_ModuleF_Main(this interface { +// XGot_ModuleF_Main is main entry of this classfile. +func XGot_ModuleF_Main(this interface { app() *gsh.App MainEntry() }) { this.MainEntry() gsh.InitApp(this.app()) } + +// ----------------------------------------------------------------------------- diff --git a/formula/classfile_test.go b/formula/classfile_test.go index 2391c571..cb8e2cc6 100644 --- a/formula/classfile_test.go +++ b/formula/classfile_test.go @@ -33,10 +33,10 @@ func (f *testFormula) MainEntry() { // the unexported app() helper it dispatches through. func TestGopt_ModuleF_Main(t *testing.T) { f := &testFormula{} - Gopt_ModuleF_Main(f) + XGot_ModuleF_Main(f) if !f.mainCalled { - t.Fatal("MainEntry was not invoked by Gopt_ModuleF_Main") + t.Fatal("MainEntry was not invoked by XGot_ModuleF_Main") } if f.modPath != "foo/bar" { t.Errorf("Id: modPath = %q, want %q", f.modPath, "foo/bar") diff --git a/formula/demo/zlib/zlib_llar.gox b/formula/demo/zlib/zlib_llar.gox new file mode 100644 index 00000000..22003d57 --- /dev/null +++ b/formula/demo/zlib/zlib_llar.gox @@ -0,0 +1,31 @@ +id "madler/zlib" + +fromVer "1.0.0" + +onBuild (ctx, proj, out) => { + installDir, err := ctx.outputDir() + if err != nil { + out.addErr err + return + } + + a := autotools.new(ctx.SourceDir, ctx.SourceDir+"/_build", installDir) + + err = a.configure("--static") + if err != nil { + out.addErr err + return + } + err = a.build() + if err != nil { + out.addErr err + return + } + err = a.install() + if err != nil { + out.addErr err + return + } + + out.setMetadata "-lz" +} diff --git a/gox.mod b/gox.mod new file mode 100644 index 00000000..c1326842 --- /dev/null +++ b/gox.mod @@ -0,0 +1,11 @@ +xgo 1.6 + +project *_llar.gox ModuleF github.com/goplus/llar/formula + +import github.com/goplus/llar/x/autotools +import github.com/goplus/llar/x/cmake + +project *_cmp.gox CmpApp github.com/goplus/llar/cmp + +import golang.org/x/mod/semver +import github.com/goplus/llar/x/gnu diff --git a/internal/ixgo/pkg/github.com/goplus/llar/formula/export.go b/internal/ixgo/pkg/github.com/goplus/llar/formula/export.go index 5d9bc4c8..5ad52b56 100755 --- a/internal/ixgo/pkg/github.com/goplus/llar/formula/export.go +++ b/internal/ixgo/pkg/github.com/goplus/llar/formula/export.go @@ -36,12 +36,12 @@ func init() { AliasTypes: map[string]reflect.Type{}, Vars: map[string]reflect.Value{}, Funcs: map[string]reflect.Value{ - "Gopt_ModuleF_Main": reflect.ValueOf(q.Gopt_ModuleF_Main), + "XGot_ModuleF_Main": reflect.ValueOf(q.XGot_ModuleF_Main), "NewContext": reflect.ValueOf(q.NewContext), }, TypedConsts: map[string]ixgo.TypedConst{}, UntypedConsts: map[string]ixgo.UntypedConst{ - "GopPackage": {"untyped bool", constant.MakeBool(bool(q.GopPackage))}, + "XGoPackage": {"untyped bool", constant.MakeBool(bool(q.XGoPackage))}, }, }) }