(url, ref, archive string)
| 585 | } |
| 586 | |
| 587 | func (b *BuildConfig) Install(url, ref, archive string) error { |
| 588 | // Setup envs. |
| 589 | b.setupEnvs() |
| 590 | defer b.rollbackEnvs() |
| 591 | |
| 592 | // Expand variables in options, like ${HOST}, ${SYSROOT} etc. |
| 593 | b.expandOptions() |
| 594 | |
| 595 | toolchain := b.Ctx.Platform().GetToolchain() |
| 596 | rootfs := b.Ctx.Platform().GetRootFS() |
| 597 | |
| 598 | // nobuild config do not have crosstool. |
| 599 | if toolchain != nil { |
| 600 | // Create a symlink in the sysroot that points to the installed directory, |
| 601 | // then the pc file would be found by other libraries. |
| 602 | if rootfs != nil { |
| 603 | // This symblink is used to find library via toolchain_file.cmake |
| 604 | sysrootDir := rootfs.GetAbsDir() |
| 605 | if err := b.checkSymlink(dirs.InstalledDir, filepath.Join(sysrootDir, "installed")); err != nil { |
| 606 | return err |
| 607 | } |
| 608 | |
| 609 | // Create tmp dir in rootfs if not exist. |
| 610 | rootfsTmp := filepath.Join(sysrootDir, "tmp") |
| 611 | if err := os.MkdirAll(rootfsTmp, os.ModePerm); err != nil { |
| 612 | return err |
| 613 | } |
| 614 | |
| 615 | // This symblink is used to find library during build. |
| 616 | if err := b.checkSymlink(dirs.TmpDepsDir, |
| 617 | filepath.Join(sysrootDir, "tmp", "deps")); err != nil { |
| 618 | return err |
| 619 | } |
| 620 | } |
| 621 | |
| 622 | // Keep the host-side tool runtime closure isolated under tmp/deps for every |
| 623 | // build. Host-side tools must be prepared explicitly into tmp/deps instead of |
| 624 | // silently falling back to the installed directory. |
| 625 | devTmpDepsDir := filepath.Join(dirs.TmpDepsDir, b.PortConfig.HostName+"-dev") |
| 626 | |
| 627 | // Create parent directory if not exists |
| 628 | if err := os.MkdirAll(filepath.Dir(devTmpDepsDir), os.ModePerm); err != nil { |
| 629 | return fmt.Errorf("failed to create tmp deps parent dir -> %w", err) |
| 630 | } |
| 631 | } |
| 632 | |
| 633 | // Apply patches. |
| 634 | if err := b.buildSystem.ApplyPatches(); err != nil { |
| 635 | return fmt.Errorf("patch %s -> %w", b.PortConfig.nameVersion(), err) |
| 636 | } |
| 637 | |
| 638 | // Update submodules if exist and not ignored that configured in port.toml. |
| 639 | if err := b.buildSystem.UpdateSubmodules(); err != nil { |
| 640 | return fmt.Errorf("update submodules %s -> %w", b.PortConfig.nameVersion(), err) |
| 641 | } |
| 642 | |
| 643 | // Configure related steps. |
| 644 | if !b.buildSystem.configured() { |
nothing calls this directly
no test coverage detected