Skip to content

Commit

Permalink
chore: Facilitate building binary rocks
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Oct 18, 2024
1 parent 758d918 commit 2a6fa04
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ LUAROCKS_ARGS ?= --tree lua_modules
DEV_SPEC = $(PACKAGE_NAME)-dev-$(ROCKREV).rockspec
DEV_SPEC_NVIM = $(PACKAGE_NAME).nvim-dev-$(ROCKREV).rockspec
DEV_ROCK = $(PACKAGE_NAME)-dev-$(ROCKREV).src.rock
DEV_ROCK_BIN = $(PACKAGE_NAME)-dev-$(ROCKREV).$(CARCH).rock
DEV_ROCK_NVIM = $(PACKAGE_NAME).nvim-dev-$(ROCKREV).src.rock
REL_SPEC = rockspecs/$(PACKAGE_NAME)-$(SEMVER)-$(ROCKREV).rockspec
REL_SPEC_NVIM = rockspecs/$(PACKAGE_NAME).nvim-$(SEMVER)-$(ROCKREV).rockspec
REL_ROCK = $(PACKAGE_NAME)-$(SEMVER)-$(ROCKREV).src.rock
REL_ROCK_BIN = $(PACKAGE_NAME)-$(SEMVER)-$(ROCKREV).$(CARCH).rock
REL_ROCK_NVIM = $(PACKAGE_NAME).nvim-$(SEMVER)-$(ROCKREV).src.rock

EXTRA_decasify_SOURCES += $(REL_SPEC) $(DEV_SPEC)
Expand All @@ -73,6 +75,8 @@ rockspecs: $(DEV_SPEC) $(DEV_SPEC_NVIM) $(REL_SPEC) $(REL_SPEC_NVIM)

srcrocks: $(DEV_ROCK) $(DEV_ROCK_NVIM) $(REL_ROCK) $(REL_ROCK_NVIM)

rocks: $(DEV_ROCK_BIN) $(REL_ROCK_BIN)

install-luarock: $(DEV_SPEC)
$(LUAROCKS) $(LUAROCKS_ARGS) make $<

Expand All @@ -95,26 +99,26 @@ define rockpec_template =
$< > $@
endef

$(DEV_SPEC): SEMVER = dev
$(DEV_SPEC): TAG = master
$(DEV_SPEC): private SEMVER = dev
$(DEV_SPEC): private TAG = master
$(DEV_SPEC): $(PACKAGE_NAME).rockspec.in
$(rockpec_template)
$(SED) -i \
-e '/tag =/s/tag/branch/' \
-e "1i -- DO NOT EDIT! Modify template $< and rebuild with \`make $@\`\n" \
$@

$(DEV_SPEC_NVIM): SEMVER = dev
$(DEV_SPEC_NVIM): TAG = master
$(DEV_SPEC_NVIM): private SEMVER = dev
$(DEV_SPEC_NVIM): private TAG = master
$(DEV_SPEC_NVIM): $(PACKAGE_NAME).nvim.rockspec.in
$(rockpec_template)
$(SED) -i \
-e '/tag =/s/tag/branch/' \
-e "1i -- DO NOT EDIT! Modify template $< and rebuild with \`make $@\`\n" \
$@

rockspecs/$(PACKAGE_NAME)-%-$(ROCKREV).rockspec: SEMVER = $*
rockspecs/$(PACKAGE_NAME)-%-$(ROCKREV).rockspec: TAG = v$*
rockspecs/$(PACKAGE_NAME)-%-$(ROCKREV).rockspec: private SEMVER = $*
rockspecs/$(PACKAGE_NAME)-%-$(ROCKREV).rockspec: private TAG = v$*
rockspecs/$(PACKAGE_NAME)-%-$(ROCKREV).rockspec: $(PACKAGE_NAME).rockspec.in
$(rockpec_template)
$(SED) -i \
Expand All @@ -125,8 +129,8 @@ rockspecs/$(PACKAGE_NAME)-%-$(ROCKREV).rockspec: $(PACKAGE_NAME).rockspec.in
-e '/labels/d' \
$@

rockspecs/$(PACKAGE_NAME).nvim-%-$(ROCKREV).rockspec: SEMVER = $*
rockspecs/$(PACKAGE_NAME).nvim-%-$(ROCKREV).rockspec: TAG = v$*
rockspecs/$(PACKAGE_NAME).nvim-%-$(ROCKREV).rockspec: private SEMVER = $*
rockspecs/$(PACKAGE_NAME).nvim-%-$(ROCKREV).rockspec: private TAG = v$*
rockspecs/$(PACKAGE_NAME).nvim-%-$(ROCKREV).rockspec: $(PACKAGE_NAME).nvim.rockspec.in
$(rockpec_template)
$(SED) -i \
Expand All @@ -138,16 +142,22 @@ rockspecs/$(PACKAGE_NAME).nvim-%-$(ROCKREV).rockspec: $(PACKAGE_NAME).nvim.rocks
$@

$(PACKAGE_NAME)-dev-$(ROCKREV).src.rock: $(DEV_SPEC)
$(LUAROCKS) $(LUAROCKS_ARGS) pack $<
$(LUAROCKS) $(LUAROCKS_ARGS) pack --sign -- $<

$(PACKAGE_NAME)-dev-$(ROCKREV).$(CARCH).rock: $(DEV_SPEC)
$(LUAROCKS) $(LUAROCKS_ARGS) make --sign --pack-binary-rock -- $<

$(PACKAGE_NAME).nvim-dev-$(ROCKREV).nvim.src.rock: $(DEV_SPEC)
$(LUAROCKS) $(LUAROCKS_ARGS) pack $<
$(LUAROCKS) $(LUAROCKS_ARGS) pack --sign -- $<

$(PACKAGE_NAME)-%.src.rock: rockspecs/$(PACKAGE_NAME)-%.rockspec
$(LUAROCKS) $(LUAROCKS_ARGS) pack $<
$(LUAROCKS) $(LUAROCKS_ARGS) pack --sign -- $<

$(PACKAGE_NAME)-%.$(CARCH).rock: rockspecs/$(PACKAGE_NAME)-%.rockspec
$(LUAROCKS) $(LUAROCKS_ARGS) make --sign --pack-binary-rock -- $<

$(PACKAGE_NAME).nvim-%.src.rock: rockspecs/$(PACKAGE_NAME).nvim-%.rockspec
$(LUAROCKS) $(LUAROCKS_ARGS) pack $<
$(LUAROCKS) $(LUAROCKS_ARGS) pack --sign -- $<

else !DEVELOPER_MODE

Expand Down

0 comments on commit 2a6fa04

Please sign in to comment.