Added Makefile and changed module name

This commit is contained in:
CapCreeperGR 2024-07-10 09:48:42 +03:00
parent f9ef17cd66
commit e445863dca
5 changed files with 54 additions and 11 deletions

38
Makefile Normal file
View File

@ -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

View File

@ -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

4
config/bpm.conf Normal file
View File

@ -0,0 +1,4 @@
compilation_env: []
silent_compilation: false
compilation_dir: "/var/tmp/"
binary_output_dir: "/var/lib/bpm/compiled/"

2
go.mod
View File

@ -1,4 +1,4 @@
module capcreepergr.me/bpm
module gitlab.com/bubble-package-manager/bpm
go 1.22

View File

@ -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