-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split out notebook into separate package
This involved: - Moving a couple REPL modules into the Cryptol library hierarchy (those that don't depend on console libraries) - Splitting up the Makefile, which unfortunately resulted in a lot of not-quite-duplication between the two Makefiles. Let's look into better abstraction...
- Loading branch information
Adam C. Foltzer
committed
Mar 2, 2015
1 parent
bf25c51
commit 9923b6f
Showing
27 changed files
with
1,288 additions
and
139 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
File renamed without changes.
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,31 @@ | ||
Name: ICryptol | ||
Version: 2.1.0 | ||
Synopsis: ICryptol: An IPython-style interface for Cryptol | ||
License: BSD3 | ||
Author: Galois, Inc. | ||
Maintainer: [email protected] | ||
Copyright: 2013-2015 Galois Inc. | ||
Category: Language | ||
Build-type: Simple | ||
Cabal-version: >= 1.18 | ||
|
||
flag static | ||
default: False | ||
description: Create a statically-linked binary | ||
|
||
executable icryptol-kernel | ||
Default-language: | ||
Haskell2010 | ||
Main-is: Main_notebook.hs | ||
hs-source-dirs: src | ||
other-modules: Notebook | ||
build-depends: base | ||
, containers | ||
, cryptol | ||
, ipython-kernel >= 0.3 | ||
, text | ||
, transformers | ||
GHC-options: -Wall -O2 | ||
|
||
if os(linux) && flag(static) | ||
ld-options: -static -pthread |
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,30 @@ | ||
Copyright (c) 2013-2014 Galois Inc. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
|
||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in | ||
the documentation and/or other materials provided with the | ||
distribution. | ||
|
||
* Neither the name of Galois, Inc. nor the names of its contributors | ||
may be used to endorse or promote products derived from this | ||
software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | ||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER | ||
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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,37 @@ | ||
{\rtf1\ansi\ansicpg1252\cocoartf1265\cocoasubrtf190 | ||
{\fonttbl\f0\fswiss\fcharset0 Helvetica;} | ||
{\colortbl;\red255\green255\blue255;} | ||
\margl1440\margr1440\vieww12600\viewh7800\viewkind0 | ||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural | ||
|
||
\f0\fs24 \cf0 Copyright (c) 2013-2014 Galois Inc.\ | ||
All rights reserved.\ | ||
\ | ||
Redistribution and use in source and binary forms, with or without\ | ||
modification, are permitted provided that the following conditions\ | ||
are met:\ | ||
\ | ||
* Redistributions of source code must retain the above copyright\ | ||
notice, this list of conditions and the following disclaimer.\ | ||
\ | ||
* Redistributions in binary form must reproduce the above copyright\ | ||
notice, this list of conditions and the following disclaimer in\ | ||
the documentation and/or other materials provided with the\ | ||
distribution.\ | ||
\ | ||
* Neither the name of Galois, Inc. nor the names of its contributors\ | ||
may be used to endorse or promote products derived from this\ | ||
software without specific prior written permission.\ | ||
\ | ||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS\ | ||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\ | ||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A\ | ||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER\ | ||
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\ | ||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\ | ||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\ | ||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\ | ||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\ | ||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\ | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\ | ||
} |
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,163 @@ | ||
HERE := $(dir $(lastword $(MAKEFILE_LIST))) | ||
|
||
UNAME := $(shell uname -s) | ||
ARCH := $(shell uname -m) | ||
REV ?= $(shell git rev-parse --short=7 HEAD || echo "unknown") | ||
VERSION := $(shell grep -i ^Version ICryptol.cabal | awk '{ print $$2}') | ||
SYSTEM_DESC ?= ${UNAME}-${ARCH}_${REV} | ||
PKG := ICryptol-${VERSION}-${SYSTEM_DESC} | ||
|
||
CABAL := cabal | ||
CABAL_BUILD := $(CABAL) build $(CABAL_BUILD_FLAGS) | ||
CABAL_INSTALL := $(CABAL) install $(CABAL_INSTALL_FLAGS) | ||
CS := $(HERE)/.cabal-sandbox | ||
CS_BIN := $(CS)/bin | ||
|
||
# Used only for windows, to find the right Program Files. | ||
PROGRAM_FILES = Program\ Files\ \(x86\) | ||
# Windows installer tools; assumes running on Cygwin and using WiX 3.8 | ||
WiX := /cygdrive/c/${PROGRAM_FILES}/WiX\ Toolset\ v3.8 | ||
CANDLE := ${WiX}/bin/candle.exe | ||
HEAT := ${WiX}/bin/heat.exe | ||
LIGHT := ${WiX}/bin/light.exe | ||
|
||
# Windows-specific stuff | ||
ifneq (,$(findstring _NT,${UNAME})) | ||
DIST := ${PKG}.msi | ||
EXE_EXT := .exe | ||
adjust-path = '$(shell cygpath -w $1)' | ||
PREFIX ?= ${PROGRAM_FILES}/Galois/ICryptol\ ${VERSION} | ||
# split this up because `cabal copy` strips drive letters | ||
PREFIX_ABS := /cygdrive/c/${PREFIX} | ||
# since Windows installs aren't overlapping like /usr/local, we | ||
# don't need this extra prefix | ||
PREFIX_SHARE := | ||
# goes under the share prefix | ||
PREFIX_DOC := /doc | ||
PKG_PREFIX := ${PKG}/${PREFIX} | ||
else | ||
DIST := ${PKG}.tar.gz ${PKG}.zip | ||
EXE_EXT := | ||
adjust-path = '$1' | ||
PREFIX ?= /usr/local | ||
PREFIX_ABS := ${PREFIX} | ||
PREFIX_SHARE := /share | ||
# goes under the share prefix | ||
PREFIX_DOC := /doc/ICryptol | ||
PKG_PREFIX := ${PKG}${PREFIX} | ||
endif | ||
|
||
ICRYPTOL_EXE := ./dist/build/cryptol/icryptol-kernel${EXE_EXT} | ||
|
||
ICRYPTOL_SRC := \ | ||
$(shell find src \ | ||
\( -name \*.hs -or -name \*.x -or -name \*.y \) \ | ||
-and \( -not -name \*\#\* \) -print) | ||
|
||
${ICRYPTOL_EXE}: ${ICRYPTOL_SRC} dist/setup-config | ||
${CABAL_BUILD} | ||
|
||
|
||
# TODO: piece this apart a bit more; if right now if something fails | ||
# during initial setup, you have to invoke this target again manually | ||
${CS}: | ||
$(CABAL) sandbox init | ||
|
||
${CS_BIN}/alex: | ${CS} | ||
$(CABAL_INSTALL) alex | ||
|
||
${CS_BIN}/happy: | ${CS} ${CS_BIN}/alex | ||
$(CABAL_INSTALL) happy | ||
|
||
dist/setup-config: ICryptol.cabal | ${CS_BIN}/alex ${CS_BIN}/happy | ||
$(CABAL_INSTALL) --only-dependencies | ||
$(CABAL) configure \ | ||
--prefix=$(call adjust-path,${PREFIX_ABS}) \ | ||
--datasubdir=ICryptol | ||
|
||
.PHONY: all | ||
all: ${ICRYPTOL_EXE} | ||
|
||
.PHONY: dist | ||
dist: ${DIST} | ||
|
||
.PHONY: tarball | ||
tarball: ${PKG}.tar.gz | ||
|
||
.PHONY: zip | ||
zip: ${PKG}.zip | ||
|
||
.PHONY: msi | ||
msi: ${PKG}.msi | ||
|
||
.PHONY: notebook | ||
notebook: ${PKG} | ||
mkdir -p $(CURDIR)/.ipython | ||
IPYTHONDIR=$(CURDIR)/.ipython \ | ||
PATH=$(call adjust-path,${CURDIR}/${PKG_BIN}):$$PATH \ | ||
CRYPTOLPATH=$(call adjust-path,$(CURDIR)/lib) \ | ||
${PKG_BIN}/icryptol --notebook-dir=$(call adjust-path,${PKG_EXAMPLES}) | ||
|
||
PROFILE_CRYPTOL_SRC := profile_cryptol/ipython_config.py \ | ||
profile_cryptol/static/base/images/ipynblogo.png \ | ||
profile_cryptol/static/custom/custom.css \ | ||
profile_cryptol/static/custom/custom.js | ||
profile.tar: ${PROFILE_CRYPTOL_SRC} | ||
tar -cvf profile.tar profile_cryptol | ||
|
||
PKG_BIN := ${PKG_PREFIX}/bin | ||
PKG_SHARE := ${PKG_PREFIX}${PREFIX_SHARE} | ||
PKG_ICRY := ${PKG_SHARE}/ICryptol | ||
PKG_DOC := ${PKG_SHARE}${PREFIX_DOC} | ||
PKG_EXAMPLES := ${PKG_DOC}/examples | ||
|
||
PKG_EXAMPLE_FILES := examples/AES.ipynb | ||
|
||
${PKG}: ${ICRYPTOL_EXE} icryptol profile.tar LICENSE \ | ||
${PKG_EXAMPLE_FILES} | ||
$(CABAL) copy --destdir=${PKG} | ||
# script not included in the copy | ||
cp icryptol ${PKG_BIN} | ||
# don't want to bundle the cryptol library in the binary distribution | ||
rm -rf ${PKG_PREFIX}/lib | ||
mkdir -p ${PKG_ICRY} | ||
mkdir -p ${PKG_DOC} | ||
mkdir -p ${PKG_EXAMPLES} | ||
cp LICENSE ${PKG_DOC} | ||
for EXAMPLE in ${PKG_EXAMPLE_FILES}; do \ | ||
cp $$EXAMPLE ${PKG_EXAMPLES}; done | ||
cp -r profile.tar ${PKG_ICRY} | ||
|
||
${PKG}.tar.gz: ${PKG} | ||
tar -czvf $@ $< | ||
|
||
${PKG}.zip: ${PKG} | ||
zip -r $@ $< | ||
|
||
${PKG}.msi: ${PKG} win32/ICryptol.wxs | ||
${HEAT} dir ${PKG_PREFIX} -o allfiles.wxs -nologo -var var.pkg \ | ||
-ag -wixvar -cg ALLFILES -srd -dr INSTALLDIR -sfrag | ||
${CANDLE} -ext WixUIExtension -ext WixUtilExtension \ | ||
-dversion=${VERSION} -dpkg=${PKG_PREFIX} win32/ICryptol.wxs | ||
${CANDLE} -ext WixUIExtension -ext WixUtilExtension \ | ||
-dversion=${VERSION} -dpkg=${PKG_PREFIX} allfiles.wxs | ||
${LIGHT} -ext WixUIExtension -ext WixUtilExtension \ | ||
-sval -o $@ ICryptol.wixobj allfiles.wixobj | ||
rm -f allfiles.wxs | ||
rm -f *.wixobj | ||
rm -f *.wixpdb | ||
|
||
.PHONY: clean | ||
clean: | ||
cabal clean | ||
rm -rf ICryptol-${VERSION}*/ | ||
rm -rf ICryptol-${VERSION}*.tar.gz | ||
rm -rf ICryptol-${VERSION}*.zip | ||
rm -rf ICryptol-${VERSION}*.msi | ||
rm -rf .ipython | ||
rm -rf profile.tar | ||
|
||
.PHONY: squeaky | ||
squeaky: clean | ||
-$(CABAL) sandbox delete | ||
rm -rf dist |
Oops, something went wrong.