11{ lib
22, buildDunePackage
33, fetchFromGitHub
4- , fetchgit
5- , ocaml
6- , stdenv
7- , gn
8- , ninja
9- , libjpeg
10- , libpng
11- , zlib
12- , python3
13- , expat
14- , darwin
154, dune-configurator
16- , SDL2
17- , libcxx
18- # TODO: try to remove?
19- , findlib
20- # TODO: try to remove?
215, pkg-config
22- , libiconv
236, reason
24- , ctypes
257, lru
268, uchar
27- , harfbuzz
28- , freetype
29- , flex
30- , fpath
31- , fmt
32- , logs
33- , re
349, ppx_deriving
3510, brisk-reconciler
3611, lwt_ppx
4015, rebez
4116, bos
4217, charInfo_width
18+ , reason-sdl2
19+ , reason-skia
20+ , reason-harfbuzz
21+ , rench
22+ , timber
4323} :
4424
4525let
46- reverySrc = fetchFromGitHub {
47- owner = "revery-ui" ;
48- repo = "revery" ;
49- # master branch as of Aug 27, 2021
50- rev = "141f70f69d6abd69674b46d805a783411b38cd79" ;
51- sha256 = "sha256-3AGdf0vcFoxcmGUHCUcmjb+VCpp2WDYmkv9Tp7VJqsw=" ;
52- } ;
53- angle2 = fetchgit {
54- url = "https://chromium.googlesource.com/angle/angle.git" ;
55- rev = "47b3db22be33213eea4ad58f2453ee1088324ceb" ;
56- sha256 = "sha256-ZF5wDOqh3cRfQGwOMay//4aWh9dBWk/cLmUsx+Ab2vw=" ;
57- } ;
58- piex = fetchgit {
59- url = "https://android.googlesource.com/platform/external/piex.git" ;
60- rev = "bb217acdca1cc0c16b704669dd6f91a1b509c406" ;
61- sha256 = "05ipmag6k55jmidbyvg5mkqm69zfw03gfkqhi9jnjlmlbg31y412" ;
62- } ;
63- esy-skia = stdenv . mkDerivation rec {
64- name = "skia" ;
65- patches = [
66- ./patches/0002-esy-skia-use-libtool.patch
67- ] ;
68- src = fetchFromGitHub {
69- owner = "revery-ui" ;
70- repo = "esy-skia" ;
71- rev = "29349b9279ed24a73ec41acd7082caea9bd8c04e" ;
72- sha256 = "sha256-VyY1clAdTEZu0cFy/+Bw19OQ4lb55s4gIV/7TsFKdnk=" ;
73- } ;
74- nativeBuildInputs = [
75- gn
76- ninja
77- libjpeg
78- libpng
79- zlib
80- python3
81- expat
82- # TODO: add optional webp support
83- #libwebp
84- darwin . apple_sdk . frameworks . ApplicationServices
85- darwin . apple_sdk . frameworks . AppKit
86- darwin . apple_sdk . frameworks . OpenGL
87- # TODO handle ios, android
88- #-framework CoreServices -framework CoreGraphics -framework CoreText -framework CoreFoundation
89- stdenv . cc
90- # needed to get libtool - TODO: double check this, add darwin flag, test on linux if ar is needed
91- darwin . cctools
92- ] ;
93-
94- preConfigure = ''
95- mkdir -p third_party/externals
96- ln -s ${ angle2 } third_party/externals/angle2
97- ln -s ${ piex } third_party/externals/piex
98- '' ;
99- #TODO: remove cc= ccx=
100- #TODO: optional xcode_sysroot
101- #TODO: built this based on feature flags, with sane defaults per os
102- #TODO: enable more features
103- configurePhase = ''
104- runHook preConfigure
105- gn gen out/Release --args='is_debug=false is_official_build=true skia_use_egl=false skia_use_dng_sdk=false skia_use_wuffs=false skia_enable_tools=false extra_asmflags=[] xcode_sysroot="${ darwin . apple_sdk_11_0 . MacOSX-SDK } " host_os="mac" skia_enable_gpu=true skia_use_metal=true skia_use_vulkan=false skia_use_angle=false skia_use_fontconfig=false skia_use_freetype=false skia_use_no_jpeg_encode=true skia_enable_pdf=false skia_use_sfntly=false skia_use_icu=false skia_use_libwebp=false skia_use_libpng=true esy_skia_enable_svg=true'
106- runHook postConfigure
107- '' ;
108- buildPhase = ''
109- runHook preBuild
110- ninja -C out/Release skia
111- runHook postBuild
112- '' ;
113-
114- # TODO: these includes were taken from alperite and can probably be simplified to include everything
115- installPhase = ''
116- mkdir -p $out
117-
118- # Glob will match all subdirs.
119- shopt -s globstar
120-
121- cp -r --parents -t $out/ \
122- include/codec \
123- include/config \
124- include/core \
125- include/effects \
126- include/gpu \
127- include/private \
128- include/utils \
129- include/c \
130- out/Release/*.a \
131- src/gpu/**/*.h \
132- third_party/externals/angle2/include \
133- third_party/skcms/**/*.h
134- '' ;
135- } ;
136- reason-sdl2 = buildDunePackage rec {
137- pname = "reason-sdl2" ;
138- version = "0.0.0" ;
139- src = reverySrc ;
140- postPatch = ''
141- substituteInPlace packages/reason-sdl2/src/sdl2_wrapper.cpp \
142- --replace "case SDL_PANEVENT:" "/* case SDL_PANEVENT:" \
143- --replace "case SDL_DROPTEXT:" "*/ case SDL_DROPTEXT:" \
144- --replace "case SDL_WINDOWEVENT_FULLSCREEN:" "/* case SDL_WINDOWEVENT_FULLSCREEN:" \
145- --replace "case SDL_WINDOWEVENT_RESTORED:" "*/ case SDL_WINDOWEVENT_RESTORED:" \
146- --replace "hash_variant" "caml_hash_variant"
147- '' ;
148- buildInputs = [
149- dune-configurator
150- SDL2
151- SDL2 . dev
152- findlib
153- darwin . apple_sdk . frameworks . Cocoa
154- darwin . apple_sdk . frameworks . ForceFeedback
155- libiconv
156- ] ;
157- nativeBuildInputs = [
158- reason
159- SDL2
160- SDL2 . dev
161- findlib
162- ] ;
163- propagatedBuildInputs = [
164- SDL2
165- SDL2 . dev
166- ctypes
167- findlib
168- ] ;
169- SDL2_LIB_PATH = ''${ ( SDL2 . override { withStatic = true ; } ) . out } /lib'' ;
170- SDL2_INCLUDE_PATH = "${ SDL2 . dev } /include" ;
171- cur__root = "${ src } " ;
172- env . NIX_CFLAGS_COMPILE = lib . optionalString stdenv . isDarwin "-I${ lib . getDev libcxx } /include/c++/v1" ;
173- } ;
17426 # This change is allows configuring initial capacity of the cache
17527 # https://github.com/pqwy/lru/pull/8/commits/f646450cc5a165bbb39121d5a456dd3f5ad4dba5
17628 lruOverride = lru . overrideAttrs ( _ : super : {
@@ -189,106 +41,16 @@ let
18941 uchar
19042 ] ;
19143 } ;
192- reason-harfbuzz = buildDunePackage {
193- pname = "reason-harfbuzz" ;
194- version = "0.0.0" ;
195- src = reverySrc ;
196- buildInputs = [
197- pkg-config
198- dune-configurator
199- stdenv
200- findlib
201- ] ;
202- nativeBuildInputs = [
203- reason
204- pkg-config
205- findlib
206- ] ;
207- HARFBUZZ_INCLUDE_PATH = "${ harfbuzz . dev } /include/harfbuzz" ;
208- HARFBUZZ_LIB_PATH = ''${ harfbuzz } /lib'' ;
209- env . NIX_CFLAGS_COMPILE = lib . optionalString stdenv . isDarwin "-I${ lib . getDev libcxx } /include/c++/v1" ;
210- } ;
211- reason-skia = buildDunePackage {
212- pname = "reason-skia" ;
213- version = "0.0.0" ;
214- src = reverySrc ;
215- postPatch = ''
216- # the cptr function was removed from ctypes, so the value now needs to be
217- # destructured to get to the pointer
218- substituteInPlace packages/reason-skia/src/Skia.re \
219- --replace "module CI = Cstubs_internals;" \
220- "module CI = { include Cstubs_internals; let cptr = (CPointer(a)) => a; };"
221- #substituteInPlace packages/reason-skia/src/wrapped/bindings/SkiaWrappedBindings.re \
222- #packages/reason-skia/src/Skia.re \
223- # --replace "module CI = Cstubs_internals;" \
224- # "module CI = { include Cstubs_internals; let cptr = (CPointer(a)) => a; };"
225- '' ;
226- buildInputs = [
227- dune-configurator
228- ] ;
229- nativeBuildInputs = [
230- reason
231- pkg-config
232- ] ;
233- propagatedBuildInputs = [
234- darwin . apple_sdk . frameworks . AppKit
235- darwin . apple_sdk . frameworks . Cocoa
236- darwin . apple_sdk . frameworks . ForceFeedback
237- libiconv
238- findlib
239- reason-sdl2
240- ctypes
241- ] ;
242- SDL2_INCLUDE_PATH = "${ SDL2 . dev } /include" ;
243- SDL2_LIB_PATH = ''${ ( SDL2 . override { withStatic = true ; } ) . out } /lib'' ;
244- SKIA_INCLUDE_PATH = "${ esy-skia } /include/c" ;
245- SKIA_LIB_PATH = "${ esy-skia } /out/Release" ;
246- JPEG_LIB_PATH = "${ ( libjpeg . override { enableStatic = true ; } ) . out } /lib" ;
247- FREETYPE2_LIB_PATH = "${ freetype } /lib" ;
248- } ;
249- rench = buildDunePackage {
250- pname = "Rench" ;
251- version = "0.0.0" ;
252- src = fetchFromGitHub {
253- owner = "revery-ui" ;
254- repo = "rench" ;
255- rev = "df44c5277ed1d3ccfa959f2623705baefd26ad99" ;
256- sha256 = "sha256-cGBYBIxVIuhbvkGxM1lAN0j5m5Fiqlc3O1xyt9OFP4U=" ;
257- } ;
258- nativeBuildInputs = [
259- reason
260- ] ;
261- propagatedBuildInputs = [
262- flex
263- fpath
264- ] ;
265- } ;
266- timber = buildDunePackage {
267- pname = "timber" ;
268- version = "0.0.0" ;
269- src = fetchFromGitHub {
270- owner = "revery-ui" ;
271- repo = "timber" ;
272- rev = "f4c40ee5d7cb93801160340ac4ac9c974ce01b66" ;
273- sha256 = "sha256-tk/2Of0R4WzjM7Fiv0mXVSbmiRHXMtppLgBcgvX4p9s=" ;
274- } ;
275- nativeBuildInputs = [
276- reason
277- ] ;
278- propagatedBuildInputs = [
279- fmt
280- logs
281- re
282- ] ;
283- } ;
44+
28445in
46+
28547buildDunePackage {
28648 pname = "Revery" ;
28749 version = "0.0.0" ;
288- # TODO: check if a patch can avoid disabling this
50+ # TODO: check if a patch can avoid disabling this
28951 # https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstrict-overflow
29052 hardeningDisable = [ "strictoverflow" ] ;
291- src = reverySrc ;
53+ inherit ( reason-sdl2 ) src ;
29254 preBuild = ''
29355 substituteInPlace packages/zed/src/dune --replace "bytes" ""
29456 # This supresses a warning from the use of CAMLparam2, where caml__frame is unused:
0 commit comments