summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-12-20 16:30:39 -0500
committerjoe <joe@jerkface.net>2017-12-20 16:30:39 -0500
commit3d3327ffa257b7b58e6d5c4b83a13d55071720a4 (patch)
tree4765b5531d893de0ab8f8c62b62eb5a44f6298ae
Initial commit.
-rw-r--r--c2haskell.hs169
1 files changed, 169 insertions, 0 deletions
diff --git a/c2haskell.hs b/c2haskell.hs
new file mode 100644
index 0000000..8397f98
--- /dev/null
+++ b/c2haskell.hs
@@ -0,0 +1,169 @@
1
2import Language.C
3import Language.C.System.GCC
4import System.Environment
5import System.IO
6
7hack_incs = [ "-I." ]
8
9-- pkg-config --cflags clutter-1.0
10clutter_incs =
11 [ "-pthread"
12 , "-I/usr/include/clutter-1.0"
13 , "-I/usr/include/cogl"
14 , "-I/usr/include/atk-1.0"
15 , "-I/usr/include/cogl"
16 , "-I/usr/include/libdrm"
17 , "-I/usr/include/json-glib-1.0"
18 , "-I/usr/include/gtk-3.0"
19 , "-I/usr/include/gio-unix-2.0/"
20 , "-I/usr/include/cairo"
21 , "-I/usr/include/pango-1.0"
22 , "-I/usr/include/harfbuzz"
23 , "-I/usr/include/pango-1.0"
24 , "-I/usr/include/gdk-pixbuf-2.0"
25 , "-I/usr/include/libpng16"
26 , "-I/usr/include/cairo"
27 , "-I/usr/include/pixman-1"
28 , "-I/usr/include/freetype2"
29 , "-I/usr/include/libpng16"
30 , "-I/usr/include/glib-2.0"
31 , "-I/usr/lib/x86_64-linux-gnu/glib-2.0/include"
32 ]
33
34
35-- pkg-config --cflags cogl-pango-2.0-experimental
36cogl_pango2_incs =
37 [ "-D COGL_ENABLE_EXPERIMENTAL_2_0_API"
38 , "-pthread"
39 , "-I/usr/include/cogl"
40 , "-I/usr/include/cairo"
41 , "-I/usr/include/pixman-1"
42 , "-I/usr/include/freetype2"
43 , "-I/usr/include/libpng16"
44 , "-I/usr/include/gdk-pixbuf-2.0"
45 , "-I/usr/include/libpng16"
46 , "-I/usr/include/glib-2.0"
47 , "-I/usr/lib/x86_64-linux-gnu/glib-2.0/include"
48 , "-I/usr/include/libdrm"
49 ]
50
51
52-- pkg-config cogl-pango-1.0 --cflags
53cogl_pango_incs =
54 [ "-pthread"
55 , "-I/usr/include/cogl"
56 , "-I/usr/include/cairo"
57 , "-I/usr/include/pixman-1"
58 , "-I/usr/include/freetype2"
59 , "-I/usr/include/libpng16"
60 , "-I/usr/include/gdk-pixbuf-2.0"
61 , "-I/usr/include/libpng16"
62 , "-I/usr/include/glib-2.0"
63 , "-I/usr/lib/x86_64-linux-gnu/glib-2.0/include"
64 , "-I/usr/include/libdrm" ]
65
66-- pkg-config gtk+-3.0 --cflags
67gtk_incs =
68 [ "-pthread"
69 , "-I/usr/include/gtk-3.0"
70 , "-I/usr/include/at-spi2-atk/2.0"
71 , "-I/usr/include/at-spi-2.0"
72 , "-I/usr/include/dbus-1.0"
73 , "-I/usr/lib/x86_64-linux-gnu/dbus-1.0/include"
74 , "-I/usr/include/gtk-3.0"
75 , "-I/usr/include/gio-unix-2.0/"
76 , "-I/usr/include/cairo"
77 , "-I/usr/include/pango-1.0"
78 , "-I/usr/include/harfbuzz"
79 , "-I/usr/include/pango-1.0"
80 , "-I/usr/include/atk-1.0"
81 , "-I/usr/include/cairo"
82 , "-I/usr/include/pixman-1"
83 , "-I/usr/include/freetype2"
84 , "-I/usr/include/libpng16"
85 , "-I/usr/include/gdk-pixbuf-2.0"
86 , "-I/usr/include/libpng16"
87 , "-I/usr/include/glib-2.0"
88 , "-I/usr/lib/x86_64-linux-gnu/glib-2.0/include"
89 ]
90
91-- pkg-config --cflags gobject-introspection-1.0
92gobj_incs =
93 [ "-pthread"
94 , "-I/usr/include/gobject-introspection-1.0"
95 , "-I/usr/include/glib-2.0"
96 , "-I/usr/lib/x86_64-linux-gnu/glib-2.0/include"
97 ]
98
99-- pkg-config --cflags libmutter-1
100mutter_incs =
101 [ "-pthread"
102 , "-I/usr/include/mutter"
103 , "-I/usr/include/gtk-3.0"
104 , "-I/usr/include/at-spi2-atk/2.0"
105 , "-I/usr/include/at-spi-2.0"
106 , "-I/usr/include/dbus-1.0"
107 , "-I/usr/lib/x86_64-linux-gnu/dbus-1.0/include"
108 , "-I/usr/include/gtk-3.0"
109 , "-I/usr/include/gio-unix-2.0/"
110 , "-I/usr/include/cairo"
111 , "-I/usr/include/mutter/clutter-1"
112 , "-I/usr/include/cairo"
113 , "-I/usr/include/atk-1.0"
114 , "-I/usr/include/pango-1.0"
115 , "-I/usr/include/harfbuzz"
116 , "-I/usr/include/pango-1.0"
117 , "-I/usr/include/json-glib-1.0"
118 , "-I/usr/include/mutter/cogl"
119 , "-I/usr/include/cairo"
120 , "-I/usr/include/pixman-1"
121 , "-I/usr/include/freetype2"
122 , "-I/usr/include/libpng16"
123 , "-I/usr/include/gdk-pixbuf-2.0"
124 , "-I/usr/include/libpng16"
125 , "-I/usr/include/glib-2.0"
126 , "-I/usr/lib/x86_64-linux-gnu/glib-2.0/include"
127 , "-I/usr/include/libdrm"
128 , "-I/usr/include/gsettings-desktop-schemas"
129 ]
130
131-- pkg-config --cflags gjs-1.0
132gjs_incs =
133 [ "-pthread"
134 , "-include"
135 , "/usr/include/mozjs-52/js/RequiredDefines.h"
136 , "-pthread"
137 , "-I/usr/include/gobject-introspection-1.0"
138 , "-I/usr/include/mozjs-52"
139 , "-I/usr/include/gtk-3.0"
140 , "-I/usr/include/at-spi2-atk/2.0"
141 , "-I/usr/include/at-spi-2.0"
142 , "-I/usr/include/dbus-1.0"
143 , "-I/usr/lib/x86_64-linux-gnu/dbus-1.0/include"
144 , "-I/usr/include/gtk-3.0"
145 , "-I/usr/include/gio-unix-2.0/"
146 , "-I/usr/include/cairo"
147 , "-I/usr/include/pango-1.0"
148 , "-I/usr/include/harfbuzz"
149 , "-I/usr/include/pango-1.0"
150 , "-I/usr/include/atk-1.0"
151 , "-I/usr/include/cairo"
152 , "-I/usr/include/pixman-1"
153 , "-I/usr/include/freetype2"
154 , "-I/usr/include/libpng16"
155 , "-I/usr/include/gdk-pixbuf-2.0"
156 , "-I/usr/include/libpng16"
157 , "-I/usr/include/glib-2.0"
158 , "-I/usr/lib/x86_64-linux-gnu/glib-2.0/include"
159 , "-I/usr/include/gjs-1.0"
160 ]
161
162
163main = do
164 args <- getArgs
165 let fname = last args
166 opts = ["-DGETTEXT_PACKAGE=c2haskell"] ++ init args
167 incs = "-I." : gjs_incs ++ gobj_incs ++ mutter_incs ++ clutter_incs ++ cogl_pango2_incs ++ gtk_incs
168 r <- parseCFile (newGCC "gcc") Nothing (incs ++ opts) fname
169 print (fmap prettyUsingInclude r)