Created
April 17, 2015 21:21
-
-
Save msmith-techempower/7095b5f900a14d244197 to your computer and use it in GitHub Desktop.
nim.sh - hoho, haha
This file contains hidden or 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
| #!/bin/bash | |
| NIM_VERSION="v0.10.2" | |
| NIM=$IROOT/nim | |
| RETCODE=$(fw_exists ${NIM}.installed) | |
| [ ! "$RETCODE" == 0 ] || { \ | |
| source $NIM.installed | |
| return 0; } | |
| git clone git://github.com/Araq/Nim.git nim | |
| cd nim | |
| # post version 0.10.2 - most recent as of 2014-12- | |
| git checkout $NIM_VERSION | |
| # Fixes a complex http request issue in 0.10.2: | |
| # https://github.com/Araq/Nim/pull/1848 | |
| # NOTE: this is a complete hack, please fix this. | |
| sed -i '297 c\ | |
| echo url\ | |
| headers.add(" " & r.path)\ | |
| if r.query.len > 0:\ | |
| headers.add("?" & r.query)\ | |
| echo headers' lib/pure/httpclient.nim | |
| sed -i '449 c\ | |
| result.add(" " & r.path)\ | |
| if r.query.len > 0:\ | |
| result.add("?" & r.query)' lib/pure/httpclient.nim | |
| sed -i '18 c\ | |
| hostname*, port*, path*, query*, anchor*: string\ | |
| opaque*: bool' lib/pure/uri.nim | |
| sed -i '118 c\ | |
| parseAuthority(authority, result)\ | |
| else:\ | |
| result.opaque = true' lib/pure/uri.nim | |
| sed -i '262 c\ | |
| if u.opaque:\ | |
| result.add(":")\ | |
| else:\ | |
| result.add("://")' lib/pure/uri.nim | |
| sed -i '277 c\' lib/pure/uri.nim | |
| sed -i '278 c\' lib/pure/uri.nim | |
| sed -i '278 c\ | |
| if u.query.len > 0:\ | |
| result.add("?")\ | |
| result.add(u.query)\ | |
| if u.anchor.len > 0:\ | |
| result.add("#")\ | |
| result.add(u.anchor)' lib/pure/uri.nim | |
| sed -i '287 c\ | |
| let str = "http:localhost:8080/test"\ | |
| let test = parseUri(str)' lib/pure/uri.nim | |
| sed -i '292 c\ | |
| doAssert($test == str)' lib/pure/uri.nim | |
| sed -i '296 c\' lib/pure/uri.nim | |
| sed -i '296 c\ | |
| let str = "foo://username:[email protected]:8042/over/there" &\ | |
| "/index.dtb?type=animal&name=narwhal#nose\ | |
| let test = parseUri(str)' lib/pure/uri.nim | |
| sed -i '306 c\ | |
| doAssert test.anchor == "nose"\ | |
| doAssert($test == str)' lib/pure/uri.nim | |
| sed -i '310 c\ | |
| let str = "mailto:[email protected]?subject=Topic"\ | |
| let test = parseUri(str)' lib/pure/uri.nim | |
| sed -i '322 c\ | |
| doAssert test.query == "subject=Topic"\ | |
| doAssert($test == str)' lib/pure/uri.nim | |
| sed -i '333 c\ | |
| let str = "/test/foo/bar?q=2#asdf"\ | |
| let test = parseUri(str)' lib/pure/uri.nim | |
| sed -i '338 c\ | |
| doAssert test.anchor == "asdf"\ | |
| doAssert($test == str)' lib/pure/uri.nim | |
| sed -i '342 c\ | |
| let str = "test/no/slash"\ | |
| let test = parseUri(str)' lib/pure/uri.nim | |
| sed -i '344 c\ | |
| doAssert test.path == "test/no/slash"\ | |
| doAssert($test == str)' lib/pure/uri.nim | |
| git clone git://github.com/nim-lang/csources.git | |
| cd csources | |
| sh build.sh | |
| cd .. | |
| bin/nim c koch | |
| # bootstrapping nim's compiler | |
| ./koch boot -d:release | |
| echo "export NIM_HOME=${NIM}" > $NIM.installed | |
| echo -e "export PATH=${NIM}/bin:\$PATH" >> $NIM.installed | |
| source $NIM.installed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment