diff --git a/_demo/cppintf/foo/llgo_autogen.lla b/_demo/cppintf/foo/llgo_autogen.lla deleted file mode 100644 index ecc48cee..00000000 Binary files a/_demo/cppintf/foo/llgo_autogen.lla and /dev/null differ diff --git a/_demo/cppmintf/foo/llgo_autogen.lla b/_demo/cppmintf/foo/llgo_autogen.lla deleted file mode 100644 index 86c4cc60..00000000 Binary files a/_demo/cppmintf/foo/llgo_autogen.lla and /dev/null differ diff --git a/c/bdwgc/llgo_autogen.lla b/c/bdwgc/llgo_autogen.lla deleted file mode 100644 index 3a3a4ea8..00000000 Binary files a/c/bdwgc/llgo_autogen.lla and /dev/null differ diff --git a/c/bitcast/llgo_autogen.lla b/c/bitcast/llgo_autogen.lla deleted file mode 100644 index e495204a..00000000 Binary files a/c/bitcast/llgo_autogen.lla and /dev/null differ diff --git a/c/cjson/llgo_autogen.lla b/c/cjson/llgo_autogen.lla deleted file mode 100644 index 68eceb56..00000000 Binary files a/c/cjson/llgo_autogen.lla and /dev/null differ diff --git a/c/clang/llgo_autogen.lla b/c/clang/llgo_autogen.lla deleted file mode 100644 index 3a5e839a..00000000 Binary files a/c/clang/llgo_autogen.lla and /dev/null differ diff --git a/c/llama2/llgo_autogen.lla b/c/llama2/llgo_autogen.lla deleted file mode 100644 index 8dfaa7d6..00000000 Binary files a/c/llama2/llgo_autogen.lla and /dev/null differ diff --git a/c/pthread/sync/llgo_autogen.lla b/c/pthread/sync/llgo_autogen.lla deleted file mode 100644 index e1b6d0eb..00000000 Binary files a/c/pthread/sync/llgo_autogen.lla and /dev/null differ diff --git a/c/raylib/llgo_autogen.lla b/c/raylib/llgo_autogen.lla deleted file mode 100644 index 63425947..00000000 Binary files a/c/raylib/llgo_autogen.lla and /dev/null differ diff --git a/c/setjmp/trycatch/llgo_autogen.lla b/c/setjmp/trycatch/llgo_autogen.lla deleted file mode 100644 index 700769e6..00000000 Binary files a/c/setjmp/trycatch/llgo_autogen.lla and /dev/null differ diff --git a/c/sqlite/llgo_autogen.lla b/c/sqlite/llgo_autogen.lla deleted file mode 100644 index 736d703b..00000000 Binary files a/c/sqlite/llgo_autogen.lla and /dev/null differ diff --git a/c/zlib/llgo_autogen.lla b/c/zlib/llgo_autogen.lla deleted file mode 100644 index f21d0302..00000000 Binary files a/c/zlib/llgo_autogen.lla and /dev/null differ diff --git a/cl/compile_test.go b/cl/compile_test.go index ad15268c..5267e554 100644 --- a/cl/compile_test.go +++ b/cl/compile_test.go @@ -58,10 +58,6 @@ func TestFromTestdata(t *testing.T) { cltest.FromDir(t, "", "./_testdata", false) } -func TestSqlite(t *testing.T) { - cltest.Pkg(t, "github.com/goplus/llgo/c/sqlite", "../c/sqlite/llgo_autogen.ll") -} - func TestFromTestpymath(t *testing.T) { cltest.Pkg(t, ssa.PkgPython+"/math", "../py/math/llgo_autogen.ll") } diff --git a/internal/build/build.go b/internal/build/build.go index e0082c12..58d5f1ad 100644 --- a/internal/build/build.go +++ b/internal/build/build.go @@ -17,12 +17,10 @@ package build import ( - "archive/zip" "fmt" "go/constant" "go/token" "go/types" - "io" "log" "os" "os/exec" @@ -253,7 +251,8 @@ func buildAllPkgs(ctx *context, initial []*packages.Package, verbose bool) (pkgs pkg.ExportFile = "" case cl.PkgLinkIR, cl.PkgLinkExtern, cl.PkgPyModule: if isPkgInLLGo(pkg.PkgPath) { - pkg.ExportFile = concatPkgLinkFiles(pkg, verbose) + buildPkg(ctx, aPkg, verbose) + pkg.ExportFile = " " + concatPkgLinkFiles(pkg, verbose) + " " + pkg.ExportFile } else { // panic("todo") // TODO(xsw): support packages out of llgo @@ -611,7 +610,7 @@ func concatPkgLinkFiles(pkg *packages.Package, verbose bool) string { var b strings.Builder var ret string var n int - llgoPkgLinkFiles(pkg, "", func(linkFile string) { + llgoPkgLinkFiles(pkg, func(linkFile string) { if n == 0 { ret = linkFile } else { @@ -629,14 +628,13 @@ func concatPkgLinkFiles(pkg *packages.Package, verbose bool) string { } // const LLGoFiles = "file1; file2; ..." -func llgoPkgLinkFiles(pkg *packages.Package, llFile string, procFile func(linkFile string), verbose bool) { +func llgoPkgLinkFiles(pkg *packages.Package, procFile func(linkFile string), verbose bool) { if o := pkg.Types.Scope().Lookup("LLGoFiles"); o != nil { val := o.(*types.Const).Val() if val.Kind() == constant.String { clFiles(constant.StringVal(val), pkg, procFile, verbose) } } - unzipPkgLinkFiles(pkg.PkgPath, llFile, procFile) } // files = "file1; file2; ..." @@ -660,30 +658,6 @@ func clFile(cFile, expFile string, procFile func(linkFile string), verbose bool) procFile(llFile) } -func unzipPkgLinkFiles(pkgPath string, llFile string, procFile func(linkFile string)) { - dir := llgoRoot() + pkgPath[len(llgoModPath):] + "/" - if llFile == "" { - llFile = "llgo_autogen.ll" - } - llPath := dir + llFile - llaPath := llPath + "a" - zipf, err := zip.OpenReader(llaPath) - if err != nil { - procFile(llPath) - return - } - defer zipf.Close() - - for _, f := range zipf.File { - procFile(dir + f.Name) - } - if _, err := os.Stat(llPath); os.IsNotExist(err) { - for _, f := range zipf.File { - decodeFile(dir+f.Name, f) - } - } -} - const ( llgoModPath = "github.com/goplus/llgo" ) @@ -700,19 +674,6 @@ func isPkgInMod(pkgPath, modPath string) bool { return false } -func decodeFile(outFile string, zipf *zip.File) (err error) { - f, err := zipf.Open() - if err != nil { - return - } - defer f.Close() - data, err := io.ReadAll(f) - if err == nil { - err = os.WriteFile(outFile, data, 0644) - } - return -} - func pkgExists(initial []*packages.Package, pkg *packages.Package) bool { for _, v := range initial { if v == pkg { diff --git a/py/inspect/llgo_autogen.lla b/py/inspect/llgo_autogen.lla deleted file mode 100644 index 59f54cdf..00000000 Binary files a/py/inspect/llgo_autogen.lla and /dev/null differ diff --git a/py/json/llgo_autogen.lla b/py/json/llgo_autogen.lla deleted file mode 100644 index c3c0e317..00000000 Binary files a/py/json/llgo_autogen.lla and /dev/null differ diff --git a/py/matplotlib/llgo_autogen.lla b/py/matplotlib/llgo_autogen.lla deleted file mode 100644 index d43278e0..00000000 Binary files a/py/matplotlib/llgo_autogen.lla and /dev/null differ diff --git a/py/matplotlib/pyplot/llgo_autogen.lla b/py/matplotlib/pyplot/llgo_autogen.lla deleted file mode 100644 index b0fa8f5b..00000000 Binary files a/py/matplotlib/pyplot/llgo_autogen.lla and /dev/null differ diff --git a/py/numpy/llgo_autogen.lla b/py/numpy/llgo_autogen.lla deleted file mode 100644 index 75fd8a24..00000000 Binary files a/py/numpy/llgo_autogen.lla and /dev/null differ diff --git a/py/os/llgo_autogen.lla b/py/os/llgo_autogen.lla deleted file mode 100644 index 671ed3de..00000000 Binary files a/py/os/llgo_autogen.lla and /dev/null differ diff --git a/py/pandas/llgo_autogen.lla b/py/pandas/llgo_autogen.lla deleted file mode 100644 index fbac999d..00000000 Binary files a/py/pandas/llgo_autogen.lla and /dev/null differ diff --git a/py/statistics/llgo_autogen.lla b/py/statistics/llgo_autogen.lla deleted file mode 100644 index fceb77ab..00000000 Binary files a/py/statistics/llgo_autogen.lla and /dev/null differ diff --git a/py/std/llgo_autogen.lla b/py/std/llgo_autogen.lla deleted file mode 100644 index 6ff86313..00000000 Binary files a/py/std/llgo_autogen.lla and /dev/null differ diff --git a/py/sys/llgo_autogen.lla b/py/sys/llgo_autogen.lla deleted file mode 100644 index a53792f2..00000000 Binary files a/py/sys/llgo_autogen.lla and /dev/null differ diff --git a/py/torch/llgo_autogen.lla b/py/torch/llgo_autogen.lla deleted file mode 100644 index f07655f6..00000000 Binary files a/py/torch/llgo_autogen.lla and /dev/null differ