From e445863dcabceca23cc3957885b762fe59855c5f Mon Sep 17 00:00:00 2001 From: CapCreeperGR Date: Wed, 10 Jul 2024 09:48:42 +0300 Subject: [PATCH] Added Makefile and changed module name --- Makefile | 38 ++++++++++++++++++++++++++++++++++++++ README.md | 17 +++++++++-------- config/bpm.conf | 4 ++++ go.mod | 2 +- main.go | 4 ++-- 5 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 Makefile create mode 100644 config/bpm.conf diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f9a3fd7 --- /dev/null +++ b/Makefile @@ -0,0 +1,38 @@ +ifeq ($(PREFIX),) + PREFIX := /usr/local +endif +ifeq ($(BINDIR),) + BINDIR := $(PREFIX)/bin +endif +ifeq ($(SYSCONFDIR),) + SYSCONFDIR := $(PREFIX)/etc +endif +ifeq ($(GO),) + GO := $(shell type -a -P go | head -n 1) +endif + +build: + mkdir -p build + $(GO) build -ldflags "-w" -o build/bpm gitlab.com/bubble-package-manager/bpm + +install: build/bpm config/ + mkdir -p $(DESTDIR)$(BINDIR) + mkdir -p $(DESTDIR)$(SYSCONFDIR) + cp build/bpm $(DESTDIR)$(BINDIR)/bpm + cp config/bpm.conf $(DESTDIR)$(SYSCONFDIR)/bpm.conf + +compress: build/bpm config/ + mkdir -p bpm/$(BINDIR) + mkdir -p bpm/$(SYSCONFDIR) + cp build/bpm bpm/$(BINDIR)/bpm + cp config/bpm.conf bpm/$(SYSCONFDIR)/bpm.conf + tar --owner=root --group=root -czf bpm.tar.gz bpm + rm -r bpm + +run: build/bpm + build/bpm + +clean: + rm -r build/ + +.PHONY: build \ No newline at end of file diff --git a/README.md b/README.md index 8f319e1..637e170 100644 --- a/README.md +++ b/README.md @@ -15,15 +15,16 @@ BPM is still in very early development. It should not be installed on any system ## Build from source -BPM requires go 1.22 or above to be built properly - -```sh -git clone https://gitlab.com/bubble-package-manager/bpm.git -cd bpm -mkdir build -go build -o ./build/bpm capcreepergr.me/bpm +- Download `go` from your package manager or from the go website +- Download `make` from your package manager +- Run the following command to compile the project +``` +make +``` +- Run the following command to install stormfetch into your system. You may also append a DESTDIR variable at the end of this line if you wish to install in a different location +``` +make install PREFIX=/usr SYSCONFDIR=/etc ``` -You are now able to copy the executable in the ./build directory in a VM or container's /usr/bin/ directory ## How to use diff --git a/config/bpm.conf b/config/bpm.conf new file mode 100644 index 0000000..d2649af --- /dev/null +++ b/config/bpm.conf @@ -0,0 +1,4 @@ +compilation_env: [] +silent_compilation: false +compilation_dir: "/var/tmp/" +binary_output_dir: "/var/lib/bpm/compiled/" \ No newline at end of file diff --git a/go.mod b/go.mod index de36652..a287598 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module capcreepergr.me/bpm +module gitlab.com/bubble-package-manager/bpm go 1.22 diff --git a/main.go b/main.go index 99f668e..9c9bf54 100644 --- a/main.go +++ b/main.go @@ -2,9 +2,9 @@ package main import ( "bufio" - "capcreepergr.me/bpm/bpm_utils" "flag" "fmt" + "gitlab.com/bubble-package-manager/bpm/bpm_utils" "log" "os" "path/filepath" @@ -17,7 +17,7 @@ import ( /* A simple-to-use package manager */ /* ---------------------------------- */ -var bpmVer = "0.3.1" +var bpmVer = "0.3.2" var subcommand = "help" var subcommandArgs []string