Skip to content

Commit

Permalink
Merge pull request mame#104 from japonophile/improve-doc-and-portability
Browse files Browse the repository at this point in the history
Improve README and minor improvements
  • Loading branch information
mame authored Jul 19, 2020
2 parents faab6c8 + 3f85a37 commit 7b1b8af
Showing 5 changed files with 34 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
/qr*
/tmp
/nimcache
/.curry
!QR.rb
gst.im
/src/lazyk-boot.dat
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -820,8 +820,10 @@ QR.ls: qr.li
@echo "## 93: Lisaac -> LiveScript ##"
@echo "################################"
@echo
@mv QR.c QR.c.bak
lisaac qr.li
./qr > QR.ls
@mv QR.c.bak QR.c

QR.ll: QR.ls
@echo
@@ -880,9 +882,9 @@ QR.mzn: QR.mac
@echo "## 100: Maxima -> MiniZinc ##"
@echo "###############################"
@echo
@if [ $(CI) = "true" ]; then mv /tmp /tmp.bak && ln -s /dev/shm /tmp; fi
@if [ "$(CI)" = "true" ]; then mv /tmp /tmp.bak && ln -s /dev/shm /tmp; fi
maxima -q --init-mac=QR.mac > QR.mzn
@if [ $(CI) = "true" ]; then rm /tmp && mv /tmp.bak /tmp; fi
@if [ "$(CI)" = "true" ]; then rm /tmp && mv /tmp.bak /tmp; fi

QR.il: QR.mzn
@echo
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -195,6 +195,19 @@ Alternatively, just type `make`.

Note: It may require huge memory to compile some files.

### Docker

Simply build the image and run a container as follows:

$ docker build -t qr .
$ docker run --privileged --rm -e CI=true qr

Note: you need to run in privileged mode otherwise the `maxima` command will fail.

If you want to check generated files, you can mount the local directory in the Docker container (but keep using the `vendor` directory of the container), as follows:

$ docker run --privileged --rm -e CI=true -v $(pwd):/usr/local/share/quine-relay -v /usr/local/share/quine-relay/vendor qr

### Other platforms

You may find [instructions for other platforms in the wiki](https://github.com/mame/quine-relay/wiki/Installation).
13 changes: 13 additions & 0 deletions src/README.md.gen.rb
Original file line number Diff line number Diff line change
@@ -109,6 +109,19 @@

Note: It may require huge memory to compile some files.

### Docker

Simply build the image and run a container as follows:

$ docker build -t qr .
$ docker run --privileged --rm -e CI=true qr

Note: you need to run in privileged mode otherwise the `maxima` command will fail.

If you want to check generated files, you can mount the local directory in the Docker container (but keep using the `vendor` directory of the container), as follows:

$ docker run --privileged --rm -e CI=true -v $(pwd):/usr/local/share/quine-relay -v /usr/local/share/quine-relay/vendor qr

### Other platforms

You may find [instructions for other platforms in the wiki](https://github.com/mame/quine-relay/wiki/Installation).
5 changes: 3 additions & 2 deletions src/code-gen.rb
Original file line number Diff line number Diff line change
@@ -358,8 +358,8 @@ class Maxima < CodeGen
Cmd = "maxima -q --init-mac=QR.mac > OUTFILE"
Apt = "maxima"
Backup = [[
%(if [ $(CI) = "true" ]; then mv /tmp /tmp.bak && ln -s /dev/shm /tmp; fi),
%(if [ $(CI) = "true" ]; then rm /tmp && mv /tmp.bak /tmp; fi),
%(if [ "$(CI)" = "true" ]; then mv /tmp /tmp.bak && ln -s /dev/shm /tmp; fi),
%(if [ "$(CI)" = "true" ]; then rm /tmp && mv /tmp.bak /tmp; fi),
]]
Code = %q("linel:99999;print#{E[PREV]};quit();")
end
@@ -440,6 +440,7 @@ class Ksh_LazyK_Lisaac < CodeGen
"lisaac qr.li && ./qr > OUTFILE",
]
Apt = ["ksh", nil, "lisaac"]
Backup = [nil, nil, "QR.c"]
def code
lazyk = ::File.read(::File.join(__dir__, "lazyk-boot.dat"))
lazyk = lazyk.tr("ski`","0123").scan(/.{1,3}/).map do |n|

0 comments on commit 7b1b8af

Please sign in to comment.