Skip to content

Commit

Permalink
Merge pull request #256 from haskell/fix-sdist
Browse files Browse the repository at this point in the history
Fix sdist
  • Loading branch information
Ericson2314 authored Oct 1, 2023
2 parents 3425ff9 + bc4fb07 commit 7d2fbbd
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 27 deletions.
5 changes: 4 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Revision history for Happy

## Unreleased
## 2.0

The main focus of this release was modularizing Happy.

Expand All @@ -12,6 +12,9 @@ The main focus of this release was modularizing Happy.
- `happy-grammar`
- `happy-tabular`

* Partially revert the new bootstrapping system of 1.21.0 to mitigate
build issues.

## 1.21.0

The main focus of this release was revamping the build system and bootstrapping.
Expand Down
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ CABAL = cabal

HAPPY_VER = `awk '/^version:/ { print $$2 }' happy.cabal`

ALEX = alex
ALEX_OPTS = -g

SDIST_DIR=dist-newstyle/sdist

sdist ::
Expand All @@ -16,7 +13,7 @@ sdist ::
echo "Error: Tree is not clean"; \
exit 1; \
fi
$(CABAL) v2-sdist
$(CABAL) v2-sdist all
@if [ ! -f "${SDIST_DIR}/happy-$(HAPPY_VER).tar.gz" ]; then \
echo "Error: source tarball not found: dist/happy-$(HAPPY_VER).tar.gz"; \
exit 1; \
Expand Down
35 changes: 35 additions & 0 deletions bootstrap.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import Control.Monad
import Data.Foldable
import System.FilePath
import System.Directory
import System.Process
import System.Exit

main :: IO ()
main = do
let bootstrap_root = "./bootstrap-root"
happy_boot = bootstrap_root </> "happy"
callProcess "cabal"
[ "install", "happy",
"-f", "-bootstrap",
"--installdir=" ++ bootstrap_root ]
with_y_files "packages" $ \y_file -> do
putStrLn $ "Processing " ++ show y_file
callProcess happy_boot [y_file]
removeFile y_file
removePathForcibly bootstrap_root

with_y_files :: FilePath -> (FilePath -> IO ()) -> IO ()
with_y_files path cont = do
is_dir <- doesDirectoryExist path
if is_dir then do
entries <- listDirectory path
for_ entries $ \entry ->
with_y_files (path </> entry) cont
else do
is_file <- doesFileExist path
if is_file then do
let ext = takeExtension path
when (ext == ".y" || ext == ".ly") (cont path)
else do
die ("Neither file nor dir: " ++ show path)
14 changes: 7 additions & 7 deletions happy.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: happy
version: 1.21.0
version: 2.0
license: BSD2
license-file: LICENSE
copyright: (c) Andy Gill, Simon Marlow
Expand Down Expand Up @@ -142,12 +142,12 @@ executable happy
array,
containers >= 0.4.2,
mtl >= 2.2.1,
happy-codegen-common == 1.21.0,
happy-grammar == 1.21.0,
happy-tabular == 1.21.0,
happy-frontend == 1.21.0,
happy-backend-lalr == 1.21.0,
happy-backend-glr == 1.21.0
happy-codegen-common == 2.0,
happy-grammar == 2.0,
happy-tabular == 2.0,
happy-frontend == 2.0,
happy-backend-lalr == 2.0,
happy-backend-glr == 2.0

default-language: Haskell98
default-extensions: CPP, MagicHash, FlexibleContexts, NamedFieldPuns
Expand Down
8 changes: 4 additions & 4 deletions packages/backend-glr/happy-backend-glr.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: happy-backend-glr
version: 1.21.0
version: 2.0
license: BSD2
license-file: LICENSE
copyright: (c) Andy Gill, Simon Marlow
Expand Down Expand Up @@ -49,9 +49,9 @@ library
Happy.Backend.GLR.ProduceCode
build-depends: base < 5,
array,
happy-codegen-common == 1.21.0,
happy-grammar == 1.21.0,
happy-tabular == 1.21.0
happy-codegen-common == 2.0,
happy-grammar == 2.0,
happy-tabular == 2.0

default-language: Haskell98
default-extensions: CPP, MagicHash, FlexibleContexts
Expand Down
8 changes: 4 additions & 4 deletions packages/backend-lalr/happy-backend-lalr.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: happy-backend-lalr
version: 1.21.0
version: 2.0
license: BSD2
license-file: LICENSE
copyright: (c) Andy Gill, Simon Marlow
Expand Down Expand Up @@ -49,9 +49,9 @@ library
Happy.Backend.LALR.ProduceCode
build-depends: base < 5,
array,
happy-codegen-common == 1.21.0,
happy-grammar == 1.21.0,
happy-tabular == 1.21.0
happy-codegen-common == 2.0,
happy-grammar == 2.0,
happy-tabular == 2.0

default-language: Haskell98
default-extensions: CPP, MagicHash, FlexibleContexts
Expand Down
2 changes: 1 addition & 1 deletion packages/codegen-common/happy-codegen-common.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: happy-codegen-common
version: 1.21.0
version: 2.0
license: BSD2
license-file: LICENSE
copyright: (c) Andy Gill, Simon Marlow
Expand Down
6 changes: 3 additions & 3 deletions packages/frontend/happy-frontend.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: happy-frontend
version: 1.21.0
version: 2.0
license: BSD2
license-file: LICENSE
copyright: (c) Andy Gill, Simon Marlow
Expand Down Expand Up @@ -54,8 +54,8 @@ library
containers >= 0.4.2,
transformers >= 0.5.6.2,
mtl >= 2.2.2,
happy-codegen-common == 1.21.0,
happy-grammar == 1.21.0
happy-codegen-common == 2.0,
happy-grammar == 2.0

default-language: Haskell98
default-extensions: CPP, MagicHash, FlexibleContexts
Expand Down
2 changes: 1 addition & 1 deletion packages/grammar/happy-grammar.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: happy-grammar
version: 1.21.0
version: 2.0
license: BSD2
license-file: LICENSE
copyright: (c) Andy Gill, Simon Marlow
Expand Down
4 changes: 2 additions & 2 deletions packages/tabular/happy-tabular.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: happy-tabular
version: 1.21.0
version: 2.0
license: BSD2
license-file: LICENSE
copyright: (c) Andy Gill, Simon Marlow
Expand Down Expand Up @@ -47,7 +47,7 @@ library
build-depends: base < 5,
array,
containers >= 0.4.2,
happy-grammar == 1.21.0
happy-grammar == 2.0

default-language: Haskell98
default-extensions: CPP, MagicHash, FlexibleContexts, NamedFieldPuns
Expand Down

0 comments on commit 7d2fbbd

Please sign in to comment.