diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..13bbfb98 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.github/ +.git/ +appimage/ \ No newline at end of file diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml new file mode 100644 index 00000000..4a46b896 --- /dev/null +++ b/.github/workflows/appimage.yml @@ -0,0 +1,30 @@ + +on: + push: + tags: + - '*' + +name: CI + +jobs: + build_linux: + name: Build/Linux + runs-on: ubuntu-20.04 + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Get the version + id: get_version + run: | + export VERSION_NUM=$(ruby -e "print '$GITHUB_REF'.split('/')[2]") + echo ::set-output name=value::${VERSION_NUM} + - name: Build project + run: | + cd appimage + make + cp Magic-x86_64.AppImage /tmp/Magic-${{ steps.get_version.outputs.value }}-x86_64.AppImage + - name: Upload Release Asset + uses: softprops/action-gh-release@v1 + with: + files: + /tmp/Magic-${{ steps.get_version.outputs.value }}-x86_64.AppImage \ No newline at end of file diff --git a/appimage/.gitignore b/appimage/.gitignore new file mode 100644 index 00000000..9d40765d --- /dev/null +++ b/appimage/.gitignore @@ -0,0 +1,4 @@ +*.tar.gz +prefix/ +*.AppImage +appimagetool \ No newline at end of file diff --git a/appimage/Dockerfile b/appimage/Dockerfile new file mode 100644 index 00000000..fbf13aa9 --- /dev/null +++ b/appimage/Dockerfile @@ -0,0 +1,36 @@ +FROM donnio/python3:centos6 + +# Tcl/Tk +WORKDIR /tcl +RUN curl -L https://prdownloads.sourceforge.net/tcl/tcl8.6.12-src.tar.gz | tar --strip-components=1 -xzC . \ + && cd unix \ + && ./configure --prefix=/prefix \ + && make -j$(nproc) \ + && make install + +WORKDIR /tk +RUN curl -L https://prdownloads.sourceforge.net/tcl/tk8.6.12-src.tar.gz | tar --strip-components=1 -xzC . \ + && cd unix \ + && ./configure --prefix=/prefix --with-tcl=/prefix/lib\ + && make \ + && make install + +WORKDIR /prefix/bin +RUN cp ./wish8.6 ./wish +RUN cp ./tclsh8.6 ./tclsh + +WORKDIR /magic +COPY . . + +RUN ./configure \ + --prefix=/prefix \ + --with-tcl=/prefix/lib \ + --with-tk=/prefix/lib \ + && make database/database.h \ + && make -j$(nproc) \ + && make install + +WORKDIR / +RUN tar -czf /prefix.tar.gz -C ./prefix . + +CMD ["/bin/bash"] \ No newline at end of file diff --git a/appimage/Makefile b/appimage/Makefile new file mode 100644 index 00000000..3a505c99 --- /dev/null +++ b/appimage/Makefile @@ -0,0 +1,31 @@ +all: appimage + +RESOURCES = $(shell find rsc/ -type f) +ARCH = $(shell uname -i) +APPIMAGE = Magic-$(ARCH).AppImage + +prefix.tar.gz: + docker build -t magic_build -f ./Dockerfile .. + id=$$(docker create magic_build) ; \ + docker cp $$id:/prefix.tar.gz ./prefix.tar.gz ; \ + docker rm -v $$id + +prefix: prefix.tar.gz Makefile $(RESOURCES) + rm -rf $@ + mkdir -p $@ + tar -xf $< -C $@ . + cp $(RESOURCES) ./$@ + mkdir -p $@/lib/tcl8.6.12 + cp -r $@/lib/tcl8.6 $@/lib/tcl8.6.12/library + +appimagetool: + curl -L https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage > ./appimagetool + chmod +x ./appimagetool + +appimage: $(APPIMAGE) +$(APPIMAGE): prefix appimagetool + ./appimagetool prefix + +PREFIX ?= /usr/local +install: + install $(APPIMAGE) $(PREFIX)/bin/magic \ No newline at end of file diff --git a/appimage/README.md b/appimage/README.md new file mode 100644 index 00000000..bf01797b --- /dev/null +++ b/appimage/README.md @@ -0,0 +1,23 @@ +This is an AppImage that runs on all GNU/Linux platforms with: + +* FUSE + * This excludes non-privileged Docker containers unfortunately, unless pre-extracted. +* GLIBC 2.3+ + +That's a number of them. + +# Build Info +A Dockerfile on CentOS 6 (needed for older glibc) image builds Tcl, Tk and Magic. + +The final build is then packaged into an AppImage using AppImageTool on the host machine. + +# Building Requirements +* A reasonably recent GNU/Linux host +* Docker 20+ +* curl + +# Build Instructions +`make` + +# Installation Instructions +`make install` diff --git a/appimage/rsc/AppRun b/appimage/rsc/AppRun new file mode 100755 index 00000000..24c7fa09 --- /dev/null +++ b/appimage/rsc/AppRun @@ -0,0 +1,7 @@ +#!/bin/sh +export CURDIR=$(dirname $(readlink -f "${0}")) # Needs to be 6 characters to replace /prefix :) +export PATH="${CURDIR}/bin":$PATH +export LD_LIBRARY_PATH=${CURDIR}/lib:$LD_LIBRARY_PATH +export CAD_ROOT="${CURDIR}/lib" +cd "${CURDIR}" +exec "./bin/magic" $@ \ No newline at end of file diff --git a/appimage/rsc/magic.desktop b/appimage/rsc/magic.desktop new file mode 100644 index 00000000..697c6c83 --- /dev/null +++ b/appimage/rsc/magic.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=Magic +Icon=magic +Exec=magic +Comment=Magic - A VLSI Layout System +Categories=Development; +Terminal=true \ No newline at end of file diff --git a/appimage/rsc/magic.svg b/appimage/rsc/magic.svg new file mode 100644 index 00000000..9eec7f9c --- /dev/null +++ b/appimage/rsc/magic.svg @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +