diff --git a/container/Dockerfile b/container/Dockerfile deleted file mode 100644 index bc2300f1..00000000 --- a/container/Dockerfile +++ /dev/null @@ -1,62 +0,0 @@ -# Dockerfile for Morloc development environment -# This Dockerfile sets up an environment with Python, R, C++, and Haskell. - -FROM ubuntu:22.04 - -WORKDIR /app - -# set the path where morloc will be installed by stack -ENV PATH="/root/.local/bin:$PATH" - -RUN apt-get update - -# Set the timezone, this avoids hanging later on -RUN DEBIAN_FRONTEND=noninteractive TZ=Antarctica/Troll apt-get -y install tzdata - -RUN apt-get install -y r-base python3.10 python3-pip libgsl-dev git curl - -# Cleanup to reduce image size -RUN apt-get clean && rm -rf /var/lib/apt/lists/* - -# Set up Python environment -RUN pip3.10 install pymorlocinternals - -# Set up C++ environment -RUN mkdir -p $HOME/.morloc/include && git clone https://github.com/morloclib/mlccpptypes $HOME/.morloc/include/mlccpptypes - -# Set up R environment -RUN Rscript -e 'install.packages("remotes", repos = "https://cloud.r-project.org")' -RUN Rscript -e 'remotes::install_github("morloc-project/rmorlocinternals", dependencies=TRUE)' - -# Build morloc -RUN apt-get update -RUN curl -SL https://get.haskellstack.org/ | sh -RUN git clone https://github.com/morloc-project/morloc && cd morloc && stack install - -# Make yourself at home -RUN mkdir -p $HOME/.morloc/lib -RUN mkdir -p $HOME/.morloc/tmp -RUN echo "home : $HOME/.morloc" > ~/.morloc/config &&\ - echo "library : $HOME/.morloc/lib" >> $HOME/.morloc/config &&\ - echo "tmpdir : $HOME/.morloc/tmp" >> $HOME/.morloc/config &&\ - echo "lang_python3 : python3" >> $HOME/.morloc/config - -# Install the morloc modules that are required for testing -RUN morloc install prelude -RUN morloc install types -RUN morloc install conventions -RUN morloc install base -RUN morloc install rbase -RUN morloc install pybase -RUN morloc install cppbase -RUN morloc install math - -# # Run the standard morloc tests -RUN cd morloc && stack test --fast - - -# pip3 install requests -# conda install -c conda-forge biopython - -# Specify the default command to run when the container starts -CMD ["bash"] diff --git a/container/ubuntu/base/Dockerfile b/container/ubuntu/base/Dockerfile new file mode 100644 index 00000000..f430b614 --- /dev/null +++ b/container/ubuntu/base/Dockerfile @@ -0,0 +1,82 @@ +############################################################################### +# Stage 1: Build the morloc compiler +FROM alpine:3.19 as morloc-build + +RUN apk update \ + && apk add --no-cache git \ + && apk add --no-cache gmp-dev \ + && apk add --no-cache build-base \ + && apk add --no-cache ncurses \ + && apk add --no-cache curl + +# Build morloc +RUN curl -SL https://get.haskellstack.org/ | sh + +RUN git clone https://github.com/morloc-project/morloc + +# Build morloc +RUN cd morloc && stack install + + +############################################################################### +# Stage 2: Copy just the compiler binary +FROM ubuntu:22.04 AS morloc-base +COPY --from=morloc-build /root/.local/bin/morloc /bin/morloc + +WORKDIR $HOME + +RUN apt-get update + +# Set the timezone, this avoids hanging later on +RUN DEBIAN_FRONTEND=noninteractive TZ=Antarctica/Troll apt-get -y install tzdata + +RUN apt-get install -y r-base python3.10 python3-pip libgsl-dev git + +# Set up Python environment +RUN pip3.10 install pymorlocinternals + +# Set up C++ environment +RUN mkdir -p $HOME/.morloc/include \ + && git clone https://github.com/morloclib/mlccpptypes $HOME/.morloc/include/mlccpptypes + +# Set up R environment +RUN Rscript -e 'install.packages("remotes", repos = "https://cloud.r-project.org")' +RUN Rscript -e 'remotes::install_github("morloc-project/rmorlocinternals", dependencies=TRUE)' + +# Setup the morloc home +RUN mkdir -p $HOME/.morloc/lib +RUN mkdir -p $HOME/.morloc/tmp +RUN echo "home : $HOME/.morloc" > ~/.morloc/config && \ + echo "library : $HOME/.morloc/lib" >> $HOME/.morloc/config && \ + echo "tmpdir : $HOME/.morloc/tmp" >> $HOME/.morloc/config && \ + echo "lang_python3 : python3" >> $HOME/.morloc/config + +# Install the morloc modules that are required for the morloc tests to pass +RUN morloc install prelude +RUN morloc install types +RUN morloc install conventions +RUN morloc install base +RUN morloc install rbase +RUN morloc install pybase +RUN morloc install cppbase +RUN morloc install math + +RUN apt-get install -y vim + +# Copy over custom vimrc +COPY assets/vimrc /root/.vimrc +COPY assets/README /root/README + +# Set up vim highlighting for morloc +RUN git clone https://github.com/morloc-project/vimmorloc \ + && mkdir -p ~/.vim/syntax/ \ + && mkdir -p ~/.vim/ftdetect/ \ + && cp vimmorloc/loc.vim ~/.vim/syntax/ \ + && echo 'au BufRead,BufNewFile *.loc set filetype=loc' > ~/.vim/ftdetect/loc.vim \ + && rm -rf vimmorloc + +RUN git clone https://github.com/morloc-project/morloc \ + && mv morloc/test-suite/golden-tests ~/tests + +# Cleanup to reduce image size +RUN apt-get clean && rm -rf /var/lib/apt/lists/* diff --git a/container/ubuntu/base/Makefile b/container/ubuntu/base/Makefile new file mode 100644 index 00000000..39d072c0 --- /dev/null +++ b/container/ubuntu/base/Makefile @@ -0,0 +1,7 @@ +# Build the required docker image +build: + docker build -t morloc-base . + +# Open a shell +shell: + docker run -w "/root" -it morloc-base /bin/bash diff --git a/container/ubuntu/base/assets/README b/container/ubuntu/base/assets/README new file mode 100644 index 00000000..8efea5ec --- /dev/null +++ b/container/ubuntu/base/assets/README @@ -0,0 +1,5 @@ +This container has a full morloc installation and language support for R, Python3, and C++. + +The ~/tests folder contains a set of tests from the morloc test suite. These may +serve as simplistic examples of morloc scripts. Though they are designed for +testing the language not pedagogy. diff --git a/container/ubuntu/base/assets/vimrc b/container/ubuntu/base/assets/vimrc new file mode 100644 index 00000000..1d579659 --- /dev/null +++ b/container/ubuntu/base/assets/vimrc @@ -0,0 +1,16 @@ +" Jump to the last position when reopening a file +au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif + +" Load indentation rules and plugins according to the detected filetype. +filetype plugin indent on +syntax on +set showcmd " Show (partial) command in status line. +set showmatch " Show matching brackets. +set ignorecase " Do case insensitive matching +set smartcase " Do smart case matching +set incsearch " Incremental search +set autowrite " Automatically save before commands like :next and :make +set hidden " Hide buffers when they are abandoned + +" An OK colorscheme +colorscheme torte diff --git a/executable/UI.hs b/executable/UI.hs index b62f739f..6794d781 100644 --- a/executable/UI.hs +++ b/executable/UI.hs @@ -8,12 +8,16 @@ module UI ( ) where import Options.Applicative +import qualified Options.Applicative.Extra as OAE + +version :: String +version = "v0.47.2" -- FIXME: HARDCODED VERSION NUMBER!!! opts :: ParserInfo CliCommand -opts = info (cliParser <**> helper) +opts = info (cliParser <**> helper <**> OAE.simpleVersioner version) ( fullDesc <> progDesc "call 'morloc make -h', 'morloc install -h', etc for details" - <> header "morloc v0.47.1" -- FIXME: HARDCODED VERSION NUMBER!!! + <> header ("morloc " <> version) ) diff --git a/library/Morloc/Config.hs b/library/Morloc/Config.hs index a73ebca4..1faddb6c 100644 --- a/library/Morloc/Config.hs +++ b/library/Morloc/Config.hs @@ -20,10 +20,10 @@ module Morloc.Config import Morloc.Data.Doc import Morloc.Namespace import qualified Morloc.Language as ML -import qualified Data.HashMap.Strict as H import qualified Data.Yaml.Config as YC import qualified Morloc.Data.Text as MT import qualified Morloc.System as MS +import qualified Data.Aeson.KeyMap as K getDefaultConfigFilepath :: IO Path @@ -35,10 +35,10 @@ loadDefaultMorlocConfig = do defaults <- defaultFields return $ Config - (MT.unpack $ defaults H.! "home") - (MT.unpack $ defaults H.! "source") - (MT.unpack $ defaults H.! "plane") - (MT.unpack $ defaults H.! "tmpdir") + (MT.unpack . fromJust $ defaults K.!? "home") + (MT.unpack . fromJust $ defaults K.!? "source") + (MT.unpack . fromJust $ defaults K.!? "plane") + (MT.unpack . fromJust $ defaults K.!? "tmpdir") "python3" -- lang_python3 "Rscript" -- lang_R "perl" -- lang_perl @@ -86,12 +86,12 @@ buildPoolCallBase c (Just Python3Lang) i = buildPoolCallBase _ _ _ = Nothing -- FIXME: add error handling -- A key value map -defaultFields :: IO (H.HashMap MT.Text MT.Text) +defaultFields :: IO (K.KeyMap MT.Text) defaultFields = do home <- MT.pack <$> getDefaultMorlocHome lib <- MT.pack <$> getDefaultMorlocSource tmp <- MT.pack <$> getDefaultMorlocTmpDir - return $ H.fromList [("home", home), ("source", lib), ("plane", "morloclib"), ("tmpdir", tmp)] + return $ K.fromList [("home", home), ("source", lib), ("plane", "morloclib"), ("tmpdir", tmp)] -- | Get the Morloc home directory (absolute path) getDefaultMorlocHome :: IO Path diff --git a/package.yaml b/package.yaml index 894d94d1..11a8c38b 100644 --- a/package.yaml +++ b/package.yaml @@ -1,5 +1,5 @@ name: morloc -version: 0.47.1 +version: 0.47.2 homepage: https://github.com/morloc-project/morloc synopsis: A multi-lingual, typed, workflow language description: See GitHub README @@ -16,6 +16,9 @@ extra-source-files: - README.md - ChangeLog.md +default-extensions: + - TypeOperators + dependencies: - base - aeson @@ -68,7 +71,16 @@ executables: - -threaded - -rtsopts - -with-rtsopts=-N + - -O2 + # The static build requires a static `libgmp.a` file + # On arch, this requires libgmp-static from AUR + # On debian systems, libgmp-dev should cover it + - -static - -haddock + cc-options: + - -static + ld-options: + - -static dependencies: - morloc - base diff --git a/stack.yaml b/stack.yaml index 68757173..57aa0642 100644 --- a/stack.yaml +++ b/stack.yaml @@ -15,7 +15,7 @@ # resolver: # name: custom-snapshot # location: "./custom-snapshot.yaml" -resolver: lts-18.28 +resolver: lts-22.18 # User packages to be built. # Various formats can be used as shown in the example below. @@ -37,10 +37,10 @@ resolver: lts-18.28 # will not be run. This is useful for tweaking upstream packages. packages: - . -# Dependency packages to be pulled from upstream that are not in the resolver -# (e.g., acme-missiles-0.3) -extra-deps: - - partial-order-0.2.0.0@sha256:a0d6ddc9ebcfa965a5cbcff1d06d46a79d44ea5a0335c583c2a51bcb41334487,2275 +# # Dependency packages to be pulled from upstream that are not in the resolver +# # (e.g., acme-missiles-0.3) +# extra-deps: +# - partial-order-0.2.0.0@sha256:a0d6ddc9ebcfa965a5cbcff1d06d46a79d44ea5a0335c583c2a51bcb41334487,2275 # Override default flag values for local packages and extra-deps # flags: {} diff --git a/vim-syntax/loc.vim b/vim-syntax/loc.vim deleted file mode 100644 index 337ce5b9..00000000 --- a/vim-syntax/loc.vim +++ /dev/null @@ -1,139 +0,0 @@ -" Vim syntax file -" Language: morloc -" Maintainer: Zebulun Arendsee -" ----------------------------------------------------------------------------- -" INSTALLATION -" Run the following in your UNIX terminal -" $ mkdir -p ~/.vim/syntax/ -" $ mkdir -p ~/.vim/ftdetect/ -" $ cp loc.vim ~/.vim/syntax/ -" $ echo 'au BufRead,BufNewFile *.loc set filetype=loc' > ~/.vim/ftdetect/loc.vim - - - -" ============================================================================= -" P R E A M B L E -" ----------------------------------------------------------------------------- -if exists("b:current_syntax") - finish -endif - -let b:current_syntax = "loc" - - - -" ============================================================================= -" K E Y W O R D S -" ----------------------------------------------------------------------------- - - -syn keyword reserved where -syn keyword reserved module -syn keyword reserved from -syn keyword reserved as -syn keyword reserved source -syn keyword reserved export -syn keyword reserved True -syn keyword reserved False - -" ----------------------------------------------------------------------------- -hi def link reserved Keyword - - - -" ============================================================================= -" P R I M A T I V E S -" ----------------------------------------------------------------------------- -syn region s_string start=/"/ end=/"/ -syn region s_execute start=/`/ end=/`/ -syn region s_execute start=/\[[a-zA-Z0-9]*|/ end=/|\]/ -syn match s_num '\([a-zA-Z_]\)\@\([a-zA-Z_]\)\@!' -syn match s_dbl '\([a-zA-Z_]\)\@\([a-zA-Z_]\)\@!' - -" syn match s_num '\v(\h)@/ -syn match operator /=>/ - -" operators allowed in constraints -syn match operator />/ -syn match operator /=/ -syn match operator /<=/ -syn match operator /+/ -syn match operator /-/ -syn match operator /\// -syn match operator /\/\// " integer division -syn match operator /%/ " modulus -syn match operator /^/ " exponentiation - -syn match operator /;/ -syn match operator /@/ - -" ----------------------------------------------------------------------------- -hi def link operator Operator - - - -" ============================================================================= -" M I S C E L L A N I A -" ----------------------------------------------------------------------------- -syn match s_varlabel '\w\+:' -syn match s_varlabel '<\w\+>' -" ----------------------------------------------------------------------------- -hi def link s_varlabel Special - - - -" ============================================================================= -" C O M M E N T S -" ----------------------------------------------------------------------------- -" define todo highlighting -syn match s_todo /\(TODO\|NOTE\|FIXME\):/ contained -syn keyword s_todo XXX contained -syn match s_tag /\(Author\|Email\|Github\|Bugs\|Website\|Maintainer\|Description\):/ contained - -" define comments -" syn match comment '\/\/.*$' contains=tag -" syn region comment start='\/\*' end='\*\/' contains=tag -syn match s_comment '--.*' contains=s_todo,s_tag -syn region s_comment start="{-" end="-}" contains=s_todo,s_tag - -" ============================================================================= -" E R R O R S -" ----------------------------------------------------------------------------- -syn match s_error '^#' - -syn match reserved '\' -syn match reserved '\' -syn match reserved '\' -syn match reserved '\' -syn match reserved '\' -syn match reserved '\' -syn match reserved '\' - -" ----------------------------------------------------------------------------- -hi def link s_comment Comment -hi def link s_todo Todo -hi def link s_tag SpecialComment -hi def link s_error Error