Created
February 8, 2017 18:06
-
-
Save niamtokik/691493472385dc0ffb734f8efbbb39a9 to your computer and use it in GitHub Desktop.
xbps template generator for erlang via erlang.mk database. This is a poc and currently doesn't work as expected.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define xbps | |
###################################################################### | |
# comment section | |
###################################################################### | |
$(1)-comment: | |
@echo | |
@echo | |
@echo "# Template file for 'erlang-$$$(1)'" | |
###################################################################### | |
# pkgname section | |
###################################################################### | |
$(1)-pkgname: | |
@echo | |
@echo pkgname="\"erlang-$$(pkg_$$$(1)_name)\"" | |
###################################################################### | |
# version section | |
###################################################################### | |
$(1)-version: | |
ifeq ($$(pkg_$$$(1)_commit), master) | |
@echo version="\"0.1\"" | |
else | |
@echo version="\"$$(pkg_$$$(1)_commit)\"" | |
endif | |
###################################################################### | |
# revision section | |
# if template file exist and doesn't have same checksum | |
# this rule will update it to new revision. | |
###################################################################### | |
$(1)-revision: | |
@echo revision="\"1\"" | |
###################################################################### | |
# build_style section | |
# this pattern need to be changed manually or with automatic | |
# methods | |
###################################################################### | |
$(1)-buildstyle: | |
@echo build_style="erlang-rebar3" | |
###################################################################### | |
# short_desc section | |
# extract description and print it. Need to shrink it to 72 chars | |
###################################################################### | |
$(1)-shortdesc: | |
@echo short_desc="\"$$(pkg_$$$(1)_description)\"" | |
###################################################################### | |
# maintainer section | |
# if MAINTAINER variable is set with use it | |
# else we add automatic message | |
###################################################################### | |
$(1)-maintainer: | |
ifdef MAINTAINER | |
@echo maintainer="\"$(MAINTAINER)\"" | |
else | |
@echo maintainer="\"Generated by erlang.mk\"" | |
endif | |
###################################################################### | |
# license section | |
# need to be automatically retrieve from project. | |
###################################################################### | |
$(1)-license: | |
ifdef LICENSE_$$(@) | |
@echo license="$(LICENSE_$$$(1))" | |
else | |
@echo license="\"no-license-set\"" | |
endif | |
###################################################################### | |
# homepage section | |
# only extract homepage. | |
###################################################################### | |
$(1)-homepage: | |
@echo homepage="\"$$(pkg_$$$(1)_homepage)\"" | |
###################################################################### | |
# distfiles section | |
# if github get from archive API: | |
# (archive/Version.tar.gz) | |
# if bitbucket: | |
# https://bitbucket.org/owner/repository/get/version.tar.gz | |
# we need to share some state here. | |
###################################################################### | |
$(1)_D := $$(pkg_$$$(1)_repo)/archive/$$(pkg_$$$(1)_commit).tar.gz | |
$(1)-distfiles: | |
@echo distfiles=\"$$($$$(1)_D)\" | |
# @echo "fetch: $$(pkg_$$$(1)_fetch)" | |
# @echo "repo: $$(pkg_$$$(1)_repo)" | |
###################################################################### | |
# checksum section: | |
# if AUTOMATIC_CHECKSUM is set we download file and update | |
# checksum with it. | |
# else we only set nothing and set flag broken="no-checksum" | |
###################################################################### | |
$(1)-checksum: | |
@echo checksum=\"\" | |
@echo broken=\"no-checksum\" | |
@echo | |
###################################################################### | |
# main rule to erlang package | |
###################################################################### | |
$(1): $(foreach i, comment \ | |
pkgname version revision buildstyle shortdesc \ | |
maintainer license homepage distfiles checksum, \ | |
$$$(1)-$(i)) | |
endef | |
$(foreach pkg, $(PACKAGES), $(eval $(call xbps, $(pkg)))) | |
#xbps: rafter-pkgname | |
xbps: $(PACKAGES) | |
# pkg_cowboy_name = cowboy | |
# pkg_cowboy_description = Small, fast and modular HTTP server. | |
# pkg_cowboy_homepage = http://ninenines.eu | |
# pkg_cowboy_fetch = git | |
# pkg_cowboy_repo = https://github.com/ninenines/cowboy | |
# pkg_cowboy_commit = 1.0.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2013-2016, Loïc Hoguin <essen@ninenines.eu> | |
# | |
# Permission to use, copy, modify, and/or distribute this software for any | |
# purpose with or without fee is hereby granted, provided that the above | |
# copyright notice and this permission notice appear in all copies. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
BUILD_CONFIG_FILE ?= $(CURDIR)/build.config | |
BUILD_CONFIG = $(shell sed "s/\#.*//" $(BUILD_CONFIG_FILE)) | |
ERLANG_MK = erlang.mk | |
ERLANG_MK_VERSION = $(shell git describe --tags --dirty) | |
.PHONY: all check | |
all: | |
export LC_COLLATE=C; \ | |
awk 'FNR==1 && NR!=1{print ""}1' $(patsubst %,%.mk,$(BUILD_CONFIG)) \ | |
| sed 's/^ERLANG_MK_VERSION = .*/ERLANG_MK_VERSION = $(ERLANG_MK_VERSION)/' > $(ERLANG_MK) | |
ifdef p | |
# Remove p from the list of variables since that conflicts with bootstrapping. | |
MAKEOVERRIDES := $(filter-out p=$p,$(MAKEOVERRIDES)) | |
check: | |
$(MAKE) -C test pkg-$p KEEP_BUILDS=1 | |
else | |
ifdef c | |
check: | |
$(MAKE) -C test $c | |
else | |
check: | |
$(MAKE) -C test | |
endif | |
endif | |
packages: | |
$(MAKE) -C test packages | |
summary: | |
@mkdir -p test/logs/ | |
@touch test/logs/latest.log test/packages/errors.log | |
-@sort test/packages/errors.log | diff test/logs/latest.log - | |
@sort test/packages/errors.log > test/logs/latest.log | |
@cp test/logs/latest.log "test/logs/$(shell date '+%F_%T%z')" | |
search: | |
@$(MAKE) --no-print-directory \ | |
-f core/core.mk $(addprefix -f,$(wildcard index/*.mk)) -f core/index.mk \ | |
search | |
clean: | |
$(MAKE) -C test clean | |
rm -rf doc/guide.pdf doc/html | |
git checkout erlang.mk | |
docs: | |
$(MAKE) -f core/core.mk -f core/docs.mk -f plugins/asciidoc.mk asciidoc DEPS=asciideck | |
up: | |
git clone git@github.com:ninenines/erlang.mk.git gh-pages | |
cd gh-pages && git checkout gh-pages | |
cd gh-pages && make | |
cd gh-pages && git push origin gh-pages | |
rm -rf gh-pages | |
xbps: | |
@$(MAKE) -f core/core.mk $(addprefix -f,$(wildcard index/*.mk)) -f core/xbps.mk \ | |
xbps |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/niamtokik/void-packages/blob/master/Manual.md
https://github.com/ninenines/erlang.mk
https://developer.github.com/v3/
https://www.gnu.org/software/make/manual/make.txt
https://www.gnu.org/software/make/manual/make.html
https://www.gnu.org/software/make/manual/html_node/Conditional-Syntax.html