-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
91 additions
and
36 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Main makefile for building distributable packages of fif executable | ||
|
||
FIF_EXISTS := $(shell which fif >/dev/null && echo "True" || echo "False") | ||
|
||
# Use fif to retrieve the project version, since it's faster | ||
ifeq ($(FIF_EXISTS), True) | ||
FIF_VERSION := $(shell fif -e \"project.clj\" read-file first 2 nth println) | ||
else | ||
FIF_VERSION := $(shell lein project-version) | ||
endif | ||
|
||
FIF_EXE_NAME := fif-$(FIF_VERSION) | ||
|
||
PROJ_FIF_EXE := bin/$(FIF_EXE_NAME) | ||
|
||
# default | ||
all: clean build-native | ||
|
||
|
||
# Generate `fif` native executable | ||
build-native: $(PROJ_FIF_EXE) | ||
|
||
|
||
$(PROJ_FIF_EXE): | ||
./build-native.sh | ||
|
||
|
||
# Generate .deb Package for native executable | ||
dpkg: $(PROJ_FIF_EXE) | ||
make -C dist_config/dpkg/ dpkg | ||
|
||
|
||
install: $(PROJ_FIF_EXE) | ||
cp $(PROJ_FIF_EXE) /usr/bin/$(FIF_EXE_NAME) | ||
rm -f /usr/bin/fif | ||
ln -s /usr/bin/$(FIF_EXE_NAME) fif | ||
|
||
|
||
clean: | ||
rm -f $(PROJ_FIF_EXE) | ||
|
||
|
||
distclean: | ||
rm -f /usr/bin/$(FIF_EXE_NAME) | ||
rm -f /usr/bin/fif |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# Makefile for generating dpkgs for the native-image compiled 'fif' executable | ||
# Requires: leiningen | ||
# Optional: fif | ||
|
||
EMAIL := [email protected] | ||
|
||
|
@@ -21,47 +23,57 @@ endif | |
|
||
FIF_EXE_NAME := fif-$(FIF_VERSION) | ||
|
||
DMAKE_DIR := $(DIST_DIR)/dpkg/$(ARCH)/$(FIF_EXE_NAME) | ||
|
||
DEB_NAME := $(FIF_EXE_NAME)-$(ARCH) | ||
DEB_VERSION := 1 | ||
|
||
DMAKE_DIR := $(DIST_DIR)/dpkg/$(DEB_NAME) | ||
PROJ_FIF_EXE := $(PROJECT_ROOT_DIR)/bin/$(FIF_EXE_NAME) | ||
DPKG_FIF_EXE := $(DMAKE_DIR)/$(FIF_EXE_NAME) | ||
DPKG_FIF_EXE := $(DMAKE_DIR)/usr/bin/$(FIF_EXE_NAME) | ||
|
||
init: | ||
mkdir -p $(DMAKE_DIR) | ||
cd $(DMAKE_DIR) && dh_make --copyright custom \ | ||
--copyrightfile $(PROJECT_ROOT_DIR)/LICENSE \ | ||
--email $(EMAIL) \ | ||
--single --native --yes | ||
rm -f $(DMAKE_DIR)/debian/README | ||
rm -f $(DMAKE_DIR)/debian/*.ex | ||
cp dbuild.mk.template $(DMAKE_DIR)/Makefile | ||
sed -i "s/FIF_NAME_EXE/$(FIF_EXE_NAME)/g" $(DMAKE_DIR)/Makefile | ||
|
||
sed -i "s/Section:.*/Section: interpreters/" $(DMAKE_DIR)/debian/control | ||
sed -i "s/Homepage:.*/Homepage: http:\/\/github.com\/benzap\/fif/" $(DMAKE_DIR)/debian/control | ||
sed -i "s/Architecture:.*/Architecture: any-$(ARCH)/" $(DMAKE_DIR)/debian/control | ||
sed -i "s/Description:.*/Description: Interpreter and Repl for the fif language/" \ | ||
$(DMAKE_DIR)/debian/control | ||
sed -i "s/ <insert long description.*//g" $(DMAKE_DIR)/debian/control | ||
|
||
mkdir -p $(DMAKE_DIR)/DEBIAN | ||
touch $(DMAKE_DIR)/DEBIAN/control | ||
echo "Package: fif" >> $(DMAKE_DIR)/DEBIAN/control | ||
echo "Version: $(FIF_VERSION)-$(DEB_VERSION)" >> $(DMAKE_DIR)/DEBIAN/control | ||
echo "Section: interpreters" >> $(DMAKE_DIR)/DEBIAN/control | ||
echo "Priority: optional" >> $(DMAKE_DIR)/DEBIAN/control | ||
echo "Homepage: http://github.com/benzap/fif" >> $(DMAKE_DIR)/DEBIAN/control | ||
echo "Architecture: $(ARCH)" >> $(DMAKE_DIR)/DEBIAN/control | ||
echo "Maintainer: Benjamin Zaporzan <[email protected]>" >> $(DMAKE_DIR)/DEBIAN/control | ||
echo "Description: Interpreter and Repl for the fif language" >> $(DMAKE_DIR)/DEBIAN/control | ||
|
||
cp prerm.template $(DMAKE_DIR)/DEBIAN/prerm | ||
chmod 775 $(DMAKE_DIR)/DEBIAN/prerm | ||
sed -i "s/FIF_EXE_NAME/$(FIF_EXE_NAME)/g" $(DMAKE_DIR)/DEBIAN/prerm | ||
|
||
cp postinst.template $(DMAKE_DIR)/DEBIAN/postinst | ||
chmod 775 $(DMAKE_DIR)/DEBIAN/postinst | ||
sed -i "s/FIF_EXE_NAME/$(FIF_EXE_NAME)/g" $(DMAKE_DIR)/DEBIAN/postinst | ||
|
||
cp $(PROJECT_ROOT_DIR)/LICENSE $(DMAKE_DIR)/DEBIAN/license | ||
|
||
$(PROJ_FIF_EXE): | ||
echo "Building Native Image..." | ||
cd $(PROJECT_ROOT_DIR) && ./build-native.sh | ||
|
||
|
||
$(DPKG_FIF_EXE): $(PROJ_FIF_EXE) | ||
mkdir -p $(DMAKE_DIR)/usr/bin | ||
cp $(PROJ_FIF_EXE) $(DPKG_FIF_EXE) | ||
chmod 755 $(DPKG_FIF_EXE) | ||
|
||
|
||
prepare: $(DPKG_FIF_EXE) | ||
find $(DMAKE_DIR) -type d | xargs chmod 755 | ||
|
||
|
||
|
||
|
||
build: | ||
dpkg-deb --build $(DMAKE_DIR) | ||
|
||
clean: | ||
rm -rf $(DMAKE_DIR) | ||
|
||
|
||
dpkg: clean init prepare | ||
dpkg: clean init prepare build | ||
|
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
set -e | ||
chmod 755 /usr/bin/FIF_EXE_NAME | ||
rm -f /usr/bin/fif | ||
ln -s /usr/bin/FIF_EXE_NAME /usr/bin/fif |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
set -e | ||
rm -f /usr/bin/FIF_EXE_NAME | ||
rm -f /usr/bin/fif | ||
|