Skip to content

Commit 656d688

Browse files
committed
refactor: turn utils/fs into a cabal package
1 parent 9f9e88b commit 656d688

File tree

10 files changed

+24
-24
lines changed

10 files changed

+24
-24
lines changed

Build.hs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ buildGhcStage booting opts cabal ghc0 dst = do
173173
, " " ++ src </> "libraries/ghci"
174174
, " " ++ src </> "libraries/os-string/"
175175
, " " ++ src </> "libraries/process/"
176+
, " " ++ src </> "libraries/rts-fs/"
176177
, " " ++ src </> "libraries/rts-includes/"
177178
, " " ++ src </> "libraries/semaphore-compat"
178179
, " " ++ src </> "libraries/time"
@@ -363,19 +364,14 @@ prepareGhcSources opts dst = do
363364
cp "./libraries" dst
364365
cp "./compiler/*" (dst </> "libraries/ghc/")
365366
cp "./rts" (dst </> "libraries/")
367+
cp "./rts-fs" (dst </> "libraries/")
366368
cp "./rts-includes" (dst </> "libraries/")
367369
cp "./ghc" (dst </> "ghc-bin")
368370
cp "./utils" dst
369371

370372
cp "./config.sub" (dst </> "libraries/rts/")
371373
cp "./config.guess" (dst </> "libraries/rts/")
372374

373-
-- shared among ghc-internal rts and unlit
374-
cp "utils/fs/fs.h" (dst </> "libraries/ghc-internal/include")
375-
cp "utils/fs/fs.c" (dst </> "libraries/ghc-internal/cbits")
376-
cp "utils/fs/fs.*" (dst </> "libraries/rts/")
377-
cp "utils/fs/fs.*" (dst </> "utils/unlit/")
378-
379375
buildBootLibraries :: Cabal -> Ghc -> GhcPkg -> DeriveConstants -> GenApply -> GenPrimop -> GhcBuildOptions -> FilePath -> IO ()
380376
buildBootLibraries cabal ghc ghcpkg derive_constants genapply genprimop opts dst = do
381377
src <- makeAbsolute (dst </> "src")
@@ -433,6 +429,7 @@ buildBootLibraries cabal ghc ghcpkg derive_constants genapply genprimop opts dst
433429
, ""
434430
, "packages:"
435431
, " " ++ src </> "libraries/rts"
432+
, " " ++ src </> "libraries/rts-fs"
436433
, " " ++ src </> "libraries/rts-includes"
437434
, ""
438435
, "benchmarks: False"

cabal.project.stage1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ packages:
1616
./libraries/ghci
1717
./libraries/os-string
1818
./libraries/process
19+
./libraries/rts-fs
1920
./libraries/semaphore-compat
2021
./libraries/time
2122
./libraries/unix

compiler/ghc.cabal

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ Library
7979
Exposed: False
8080

8181
Includes: Unique.h
82-
-- CodeGen.Platform.h -- invalid as C, skip
83-
-- shared with rts via symlink
8482

8583
if flag(build-tool-depends)
8684
build-tool-depends: alex:alex >= 3.2.6, happy:happy >= 1.20.0, genprimopcode:genprimopcode, deriveConstants:deriveConstants

libraries/ghc-internal/ghc-internal.cabal

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ extra-source-files:
3636
include/HsBaseConfig.h.in
3737
include/ieee-flpt.h
3838
include/md5.h
39-
include/fs.h
4039
include/winio_structs.h
4140
include/WordSize.h
4241
include/HsIntegerGmp.h.in
@@ -116,7 +115,8 @@ Library
116115
Unsafe
117116

118117
build-depends:
119-
rts == 1.0.*
118+
rts == 1.0.*,
119+
rts-fs == 1.0.*
120120

121121
exposed-modules:
122122
GHC.Internal.ClosureTypes
@@ -431,7 +431,6 @@ Library
431431
cbits/md5.c
432432
cbits/primFloat.c
433433
cbits/sysconf.c
434-
cbits/fs.c
435434
cbits/strerror.c
436435
cbits/atomic.c
437436
cbits/bswap.c
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
This "fs" library, used by various ghc utilities is used to share some common
22
I/O filesystem functions with different packages.
3-
4-
This file is copied across the build-system by configure.
File renamed without changes.
File renamed without changes.

libraries/rts-fs/rts-fs.cabal

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
cabal-version: 3.0
2+
name: rts-fs
3+
version: 1.0.0.0
4+
license: NONE
5+
author: Andrea Bedini
6+
maintainer: [email protected]
7+
build-type: Simple
8+
extra-doc-files: README
9+
10+
library
11+
c-sources: fs.c
12+
install-includes: fs.h
13+
default-language: Haskell2010

rts/rts.cabal

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ extra-source-files:
5555
FileLock.h
5656
ForeignExports.h
5757
fs_rts.h
58-
fs.h
5958
GetEnv.h
6059
GetTime.h
6160
Globals.h
@@ -743,7 +742,6 @@ library
743742
sm/Scav_thr.c
744743
sm/Storage.c
745744
sm/Sweep.c
746-
fs.c
747745
-- I wish we had wildcards..., this would be:
748746
-- *.c hooks/**/*.c sm/**/*.c eventlog/**/*.c linker/**/*.c
749747

@@ -788,7 +786,8 @@ library
788786
-- from Ticker.c
789787

790788
build-depends:
791-
rts-includes
789+
rts-includes,
790+
rts-fs
792791

793792
-- Note [Undefined symbols in the RTS]
794793
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

utils/unlit/unlit.cabal

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
1-
cabal-version: 2.4
1+
cabal-version: 3.0
22
Name: unlit
33
Version: 0.1
4-
Copyright: XXX
54
License: BSD-3-Clause
6-
Author: XXX
7-
Maintainer: XXX
85
Synopsis: Literate program filter
9-
Description: XXX
106
Category: Development
117
build-type: Simple
12-
extra-source-files: fs.h
138

149
Executable unlit
1510
Default-Language: Haskell2010
1611
Main-Is: unlit.c
17-
C-Sources: fs.c
18-
Includes: fs.h
12+
build-depends:
13+
rts-fs

0 commit comments

Comments
 (0)