{"action":"created","issue":{"url":"https://api.github.com/repos/crystal-lang/crystal/issues/3582","repository_url":"https://api.github.com/repos/crystal-lang/crystal","labels_url":"https://api.github.com/repos/crystal-lang/crystal/issues/3582/labels{/name}","comments_url":"https://api.github.com/repos/crystal-lang/crystal/issues/3582/comments","events_url":"https://api.github.com/repos/crystal-lang/crystal/issues/3582/events","html_url":"https://github.com/crystal-lang/crystal/pull/3582","id":191811971,"number":3582,"title":"[WIP] Windows","user":{"login":"lbguilherme","id":546954,"avatar_url":"https://avatars.githubusercontent.com/u/546954?v=3","gravatar_id":"","url":"https://api.github.com/users/lbguilherme","html_url":"https://github.com/lbguilherme","followers_url":"https://api.github.com/users/lbguilherme/followers","following_url":"https://api.github.com/users/lbguilherme/following{/other_user}","gists_url":"https://api.github.com/users/lbguilherme/gists{/gist_id}","starred_url":"https://api.github.com/users/lbguilherme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lbguilherme/subscriptions","organizations_url":"https://api.github.com/users/lbguilherme/orgs","repos_url":"https://api.github.com/users/lbguilherme/repos","events_url":"https://api.github.com/users/lbguilherme/events{/privacy}","received_events_url":"https://api.github.com/users/lbguilherme/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-11-26T15:43:08Z","updated_at":"2016-11-26T19:35:08Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/crystal-lang/crystal/pulls/3582","html_url":"https://github.com/crystal-lang/crystal/pull/3582","diff_url":"https://github.com/crystal-lang/crystal/pull/3582.diff","patch_url":"https://github.com/crystal-lang/crystal/pull/3582.patch"},"body":"> **Warning: This is very very initial.**\r\n\r\nFixes #26 \r\n\r\n## Roadmap:\r\n\r\n- [x] Make it compile code\r\n- [ ] Add `{% if flag?(:windows) %}` all over the core library and make the prelude portable\r\n  - [ ] Basic IO\r\n  - [ ] Fibers & concurrent IO\r\n  - [ ] Exceptions (backtraces)\r\n  - [ ] Threads & Mutex\r\n  - [ ] Process\r\n  - [ ] Regex\r\n  - [ ] LibEvent's DNS\r\n  - [ ] GC (Calling `GC.init` crashes with \"fork() handling unsupported\"\r\n  - [ ] ...\r\n- [ ] Remove dependency on `wine clang.exe` hack\r\n- [ ] Port rest of std library\r\n  - [ ] Networking\r\n  - [ ] ...\r\n- [ ] Compile `crystal.exe` and self-host it\r\n- [ ] Pass all specs\r\n- [ ] Figure out how to do CI testing for Windows\r\n- [ ] Add support for 32-bit Windows as well\r\n- [ ] Release Crystal for Windows!\r\n\r\n## How to use it: (from Linux)\r\n\r\n1. Get the branch `win` from this fork:\r\n\r\n       git clone https://github.com/lbguilherme/crystal.git\r\n       git checkout win\r\n\r\n2. Install Wine: https://www.winehq.org/\r\n3. Download Clang 3.9 for Windows x64. Install it somewhere with Wine. Make sure this works:\r\n\r\n       $ wine bin/clang.exe --version\r\n       clang version 3.9.0 (branches/release_39)\r\n       Target: x86_64-pc-windows-msvc\r\n\r\n4. Install MXE from my fork (I'll get this patch upstream at some point https://github.com/mxe/mxe/pull/1539)\r\n\r\n       git clone https://github.com/lbguilherme/mxe.git\r\n       git checkout updated-gc\r\n       # Check http://mxe.cc/#requirements for a list of dependencies\r\n       # (or just run the comand below and get an error listing what is missing)\r\n       make MXE_TARGETS=x86_64-w64-mingw32.static gcc gc libevent libiconv # This will take some considerable time\r\n\r\n5. Write some simple Crystal:\r\n\r\n       # foo.cr\r\n\r\n       puts \"Hello Windows!\"\r\n\r\n6. And finally: Build code!\r\n\r\n  ```sh\r\n  ./bin/crystal build foo.cr --ll --single-module --cross-compile --target x86_64-windows-gnu\r\n  wine /clang-path/bin/clang.exe -g3 foo.ll -c -o foo.o\r\n  /mxe-path/usr/bin/x86_64-w64-mingw32.static-gcc -g3 foo.o -o foo.exe -liconv -lkernel32 -lgc -levent -lws2_32\r\n  ```\r\n\r\n7. And run:\r\n\r\n      $ wine foo.exe\r\n      Hello Windows!\r\n\r\n## FAQ\r\n\r\n- **When will it be ready?** I'm doing it in my free time, so I really have no idea. \r\n\r\n- **Why not use CYGWIN?** I really believe Windows should be a first-class target and that this is fundamental for Crystal's future as a language. The more native the better. I would ditch even glibc if it were possible (at some point it will be).\r\n\r\n- **How can I help?** Pick a very small Crystal code. Try to compile it. See a lot of errors and crashes. Do whatever it takes to make them go away. Send a patch with your changes."},"comment":{"url":"https://api.github.com/repos/crystal-lang/crystal/issues/comments/263081472","html_url":"https://github.com/crystal-lang/crystal/pull/3582#issuecomment-263081472","issue_url":"https://api.github.com/repos/crystal-lang/crystal/issues/3582","id":263081472,"user":{"login":"RX14","id":2788811,"avatar_url":"https://avatars.githubusercontent.com/u/2788811?v=3","gravatar_id":"","url":"https://api.github.com/users/RX14","html_url":"https://github.com/RX14","followers_url":"https://api.github.com/users/RX14/followers","following_url":"https://api.github.com/users/RX14/following{/other_user}","gists_url":"https://api.github.com/users/RX14/gists{/gist_id}","starred_url":"https://api.github.com/users/RX14/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RX14/subscriptions","organizations_url":"https://api.github.com/users/RX14/orgs","repos_url":"https://api.github.com/users/RX14/repos","events_url":"https://api.github.com/users/RX14/events{/privacy}","received_events_url":"https://api.github.com/users/RX14/received_events","type":"User","site_admin":false},"created_at":"2016-11-26T19:35:08Z","updated_at":"2016-11-26T19:35:08Z","body":"How about being able to mark a file as ignored or not at the top of a file, similar to surrounding the whole file in a macro `if flags`, then simply require every platform's files?"}}
{"actor":{"display_login":"RX14"}}