clayrisser / mkpm

makefile package manager

Home Page:https://gitlab.com/bitspur/mkpm/mkpm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mkpm

makefile package manager

You can find an example project using mkpm at the link below

https://gitlab.com/risserlabs/community/mkpm-example

Requirements

Install

The mkpm binary is not required to use mkpm. However, it does provides several utilities for initializing new mkpm projects, installing new mkpm packages and updating mkpm packages.

You can install it with the following command.

$(curl --version >/dev/null 2>/dev/null && echo curl -L || echo wget -O-) https://gitlab.com/api/v4/projects/48207162/packages/generic/mkpm/1.0.0/install.sh 2>/dev/null | sh

Usage

  1. Create a file called mkpm.mk in the root of your project with the following content. This file contains the mkpm configuration for a given project, such as the list of mkpm packages.

    mkpm.mk

    export MKPM_PACKAGES_DEFAULT := \
    	hello=0.1.0
    
    export MKPM_REPO_DEFAULT := \
    	https://gitlab.com/risserlabs/community/mkpm-stable.git
    
    ############# MKPM BOOTSTRAP SCRIPT BEGIN #############
    MKPM_BOOTSTRAP := https://gitlab.com/api/v4/projects/29276259/packages/generic/mkpm/0.3.0/bootstrap.mk
    export PROJECT_ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
    NULL := /dev/null
    TRUE := true
    ifneq ($(patsubst %.exe,%,$(SHELL)),$(SHELL))
    	NULL = nul
    	TRUE = type nul
    endif
    include $(PROJECT_ROOT)/.mkpm/.bootstrap.mk
    $(PROJECT_ROOT)/.mkpm/.bootstrap.mk:
    	@mkdir $(@D) 2>$(NULL) || $(TRUE)
    	@$(shell curl --version >$(NULL) 2>$(NULL) && \
    		echo curl -Lo || echo wget -O) \
    		$@ $(MKPM_BOOTSTRAP) >$(NULL)
    ############## MKPM BOOTSTRAP SCRIPT END ##############

    you can also initialize mkpm.mk with the mkpm cli instead

    mkpm init
  2. Add mkpm packages to the MKPM_PACKAGES_DEFAULT config. Below is an example.

    export MKPM_PACKAGES_DEFAULT := \
    	hello=0.1.0

    you can also add packages with the mkpm cli instead

    mkpm install hello

    or

    mkpm i hello
  3. To include packages in a Makefile, simply prefix them with the MKPM variable. Be sure to include mkpm.mk. Also wrap the file with ifneq (,$(MKPM_READY)) and endif to prevent code from executing before mkpm is loaded. The packages MUST be included after the mkpm.mk file and after the MKPM_READY check. Below is an example.

    Makefile

    include mkpm.mk # load mkpm
    ifneq (,$(MKPM_READY)) # prevent code from executing before mkpm is ready
    include $(MKPM)/hello # import an mkpm package
    
    # makefile logic here . . .
    
    endif

Repos

The default repo is set to https://gitlab.com/risserlabs/community/mkpm-stable.git. Feel free to use any mkpm packages from this repo.

export MKPM_REPO_DEFAULT := \
	https://gitlab.com/risserlabs/community/mkpm-stable.git

However, you can change the repo to point to your own repo, or you can use multiple repos. For example, if you wanted to use the packages from the risserlabs default repo, but you also wanted to bring your own packages, you would simply add a new repo with a new name.

For example, you could call it howdy.

mkpm.mk

export MKPM_REPO_HOWDY := \ # the name of the repo must be post-fixed to the end in all caps
	https://gitlab.com/risserlabs/howdy-mkpm-packages.git

export MKPM_PACKAGES_HOWDY := \ # don't forget to also add the packages variable

You can then install pacakges from this custom repo by running the following.

mkpm install <REPO_NAME> <PACKAGE_NAME>

For example, let's say you wanted to install the texas package from howdy repo. You would simply run the following.

mkpm install howdy texas

About

makefile package manager

https://gitlab.com/bitspur/mkpm/mkpm

License:Apache License 2.0


Languages

Language:Shell 90.2%Language:Makefile 9.5%Language:Nix 0.3%