Skip to content

Commit

Permalink
Merge branch 'master' of github.com:donomii/portprog
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Price committed Jul 23, 2023
2 parents aa8f872 + 5f527d8 commit e38c519
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 36 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
all: build

build:
go get "github.com/probandula/figlet4go"
go build .
13 changes: 9 additions & 4 deletions json_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@ import (
)

type Package struct {
Name, Zip, Url, Fetch, Plan string
Branch, Command string // If this is git repository, what branch/tag do we check out before building?
BinDir, LibDir string //Where do we find the binary files, relative to the top level directory of the installed package?
BinDirs, Deletes []string
Name string //Name of the package
Zip string //Full archive name, including extension
Url string //URL to download the archive from
Fetch string //Fetch method (e.g. wget, curl, git, svn, etc)
Plan string //Build plan (e.g. make, cmake, etc)
Branch, Command string // If this is git repository, what branch/tag do we check out before building?
BinDir, LibDir string //Where do we find the binary files after the build, relative to the top level directory of the installed package?
BinDirs []string //If there are multiple directories to add to the path. Both BinDir and BinDirs are added to the path.
Deletes []string
}

func LoadJSON(filename string) Package {
Expand Down
8 changes: 8 additions & 0 deletions packages-osx/racketprogs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Name" : "racketprogs",
"Zip" : "",
"Url" : "https://gitlab.com/donomii/racketprogs",
"Fetch" : "git",
"Branch" : "master",
"Plan" : "gitAndMake"
}
8 changes: 0 additions & 8 deletions packages-windows/dcss-git.json

This file was deleted.

9 changes: 0 additions & 9 deletions packages-windows/go-1.10.3.json

This file was deleted.

8 changes: 8 additions & 0 deletions packages-windows/racketprogs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Name" : "racketprogs",
"Zip" : "",
"Url" : "https://gitlab.com/donomii/racketprogs",
"Fetch" : "git",
"Branch" : "master",
"Plan" : "gitAndMake"
}
37 changes: 22 additions & 15 deletions updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/kardianos/osext"
"github.com/donomii/goof"
"github.com/probandula/figlet4go"
"github.com/donomii/goof"
)

var wg sync.WaitGroup
Expand Down Expand Up @@ -229,19 +230,13 @@ func makeOpt(optName, optVal string) string {
}

func unTar(b Config, zipPath string) {
p2 := strings.Replace(zipPath, ".gz", "", -1)
p2 = strings.Replace(zipPath, ".tgz", ".tar", -1)
p2 = strings.Replace(p2, ".lzma", "", -1)
p2 = strings.Replace(p2, ".bz2", "", -1)
splits := strings.Split(p2, "/")
zipPath = strings.ReplaceAll(zipPath, "\\", "/")
splits := strings.Split(zipPath, "/")
fname := splits[len(splits)-1]
if _, err := os.Stat(zipPath); err == nil {
if isWindows() {
unSevenZ(b, zipPath)
} else {
doCommand("tar", []string{"-xzvf", zipPath})
doCommand("tar", []string{"-xjvf", zipPath})
}
unSevenZ(b, zipPath)
doCommand("tar", []string{"-xzvf", zipPath, "--force-local"})
doCommand("tar", []string{"-xjvf", zipPath, "--force-local"})
} else {
log.Println("Could not find ", fname)
}
Expand All @@ -257,7 +252,8 @@ func unTgzLib(b Config, zipPath string) {

//unSevenZ(b, fname)
} else {
doCommand("tar", []string{"-xzvf", zipPath})
doCommand("tar", []string{"-xzvf", zipPath, "--force-local"})
doCommand("tar", []string{"-xjvf", zipPath, "--force-local"})
}
} else {
log.Println("Could not extract ", fname)
Expand Down Expand Up @@ -473,6 +469,7 @@ func doFetch(p Package, b Config) {
doCommand("git", []string{"clone", url, name, "--recursive"})
os.Chdir(name)
doCommand("git", []string{"checkout", branch})
doCommand("git", []string{"pull"})
doCommand("git", []string{"submodule", "foreach", "--recursive", "git", "checkout", "master"})
os.Chdir(cwd)
}
Expand Down Expand Up @@ -525,14 +522,14 @@ func doAll(p Package, b Config) {
targetDir := b.InstallDir
doFetch(p, b)

cwd, _ := os.Getwd()
initialDir, _ := os.Getwd()
os.Chdir(targetDir)

//unBzLib(b, p.Name)
//unTgzLib(b, p.Name)

plan := p.Plan
os.Chdir(cwd)
os.Chdir(initialDir)
if plan == "standardConfigure" {
standardConfigureBuild(b, p.Name, ".", []string{makeOpt("prefix", targetDir)}) //, makeOpt("with-sysroot", targetDir)
} else if plan == "goGetAndMake" {
Expand All @@ -556,14 +553,24 @@ func doAll(p Package, b Config) {
}

if p.BinDir != "" {
subPaths = append(subPaths, b.InstallDir+"/"+p.Name+"/"+p.BinDir)
subPaths = append(subPaths, b.SourceDir+"/"+p.Name+"/"+p.BinDir)
}

for _, v := range p.BinDirs {
subPaths = append(subPaths, b.InstallDir+"/"+p.Name+"/"+v)
}

//Cleanup build files, if required
for _, v := range p.Deletes {
os.Remove(b.InstallDir + "/" + p.Name + "/" + v)
}

os.Chdir(b.InstallDir+"/"+p.Name)
fmt.Println("Current directory: ", goof.Cwd())
distZipPath := "dist.zip"
//Package up the binaries from the dist/ directory into a zip file
doCommand("zip", []string{"-r", distZipPath, "dist/"})
os.Chdir(initialDir)
}

func figSay(s string) {
Expand Down

0 comments on commit e38c519

Please sign in to comment.