Add Dockerfile fixes and change runner to bash
authorVasilij Schneidermann <v.schneidermann@gmail.com>
Tue, 9 Aug 2016 17:25:33 +0000 (19:25 +0200)
committerVasilij Schneidermann <v.schneidermann@gmail.com>
Tue, 9 Aug 2016 17:25:33 +0000 (19:25 +0200)
Thanks to @kanaka

Makefile
chuck/Dockerfile [new file with mode: 0644]
chuck/run

index 93e45bc..6404148 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -221,7 +221,7 @@ get_build_prefix = $(if $(strip $(DOCKERIZE)),docker run -it --rm -u $(shell id
 # Returns a command prefix (docker command and environment variables)
 # necessary to launch the given impl and step
 get_run_prefix = $(strip $(if $(strip $(DOCKERIZE)),\
-    docker run -e STEP=$($2) \
+    docker run -e STEP=$($2) -e MAL_IMPL=$(MAL_IMPL) \
     -it --rm -u $(shell id -u) \
     -v $(dir $(abspath $(lastword $(MAKEFILE_LIST)))):/mal \
     -w /mal/$(call actual_impl,$(1)) \
@@ -230,7 +230,7 @@ get_run_prefix = $(strip $(if $(strip $(DOCKERIZE)),\
     $(foreach env,$(3),-e $(env)) \
     $(call impl_to_image,$(call actual_impl,$(1))) \
     ,\
-    env STEP=$($2) \
+    env STEP=$($2) MAL_IMPL=$(MAL_IMPL) \
     $(if $(filter haxe,$(1)),HAXE_MODE=$(HAXE_MODE),) \
     $(if $(filter factor,$(1)),FACTOR_ROOTS=$(FACTOR_ROOTS),) \
     $(3)))
diff --git a/chuck/Dockerfile b/chuck/Dockerfile
new file mode 100644 (file)
index 0000000..b7dc623
--- /dev/null
@@ -0,0 +1,32 @@
+FROM ubuntu:vivid
+MAINTAINER Joel Martin <github@martintribe.org>
+
+##########################################################
+# General requirements for testing or common across many
+# implementations
+##########################################################
+
+RUN apt-get -y update
+
+# Required for running tests
+RUN apt-get -y install make python
+
+# Some typical implementation and test requirements
+RUN apt-get -y install curl libreadline-dev libedit-dev
+
+RUN mkdir -p /mal
+WORKDIR /mal
+
+##########################################################
+# Specific implementation requirements
+##########################################################
+
+# Chuck
+RUN apt-get -y install bison gcc g++ flex
+RUN apt-get -y install libasound2-dev libsndfile1-dev
+RUN cd /tmp && curl -O http://chuck.cs.princeton.edu/release/files/chuck-1.3.5.2.tgz \
+    && tar xvzf /tmp/chuck-1.3.5.2.tgz && cd chuck-1.3.5.2/src \
+    && make linux-alsa && make install \
+    && rm -r /tmp/chuck-1.3.5.2*
+
+ENV HOME /mal
dissimilarity index 100%
index 5567062..51d120c 100755 (executable)
--- a/chuck/run
+++ b/chuck/run
@@ -1,21 +1,5 @@
-#!/usr/bin/env ruby
-
-cmdline = ['chuck', '--caution-to-the-wind', '--silent']
-
-# HACK: makes `make MAL_IMPL=chuck "test^mal"` work
-scriptpath = File.expand_path(File.dirname(__FILE__))
-Dir.chdir(scriptpath)
-
-scriptfile = (ENV['STEP'] || 'stepA_mal') + '.ck'
-
-script = File.readlines(scriptfile)
-imports = script.grep(%r{^ *// *@import (.+)}) { $1 }
-import_files = imports.flat_map { |i| Dir[i] }
-cmdline += import_files
-cmdline << scriptfile
-
-File.write('/tmp/chuck-cmdline', cmdline.join(' '))
-File.write('/tmp/chuck-args', ARGV.join(' '))
-
-ENV['CHUCK_ARGS'] = ARGV.join("\a")
-exec(*cmdline)
+#!/bin/bash
+imports=$(grep "^ *// *@import" "$(dirname $0)/${STEP:-stepA_mal}.ck" | awk '{print $3}')
+imports=$(for i in ${imports}; do ls $(dirname $0)/${i}; done)
+old_IFS="${IFS}"; IFS=$'\a'; export CHUCK_ARGS="${*}"; IFS="${old_IFS}"
+exec chuck --caution-to-the-wind --silent ${imports} $(dirname $0)/${STEP:-stepA_mal}.ck