From 4c7deb948f1e3321e7a8ac1d37ecbcd6b691d6db Mon Sep 17 00:00:00 2001 From: Akilan Date: Fri, 6 Jun 2025 15:43:48 +0100 Subject: [PATCH] added haskell build instruction --- .gitignore | 1 + Bindings/Haskell/lib/API.hs | 2 +- Bindings/Haskell/lib/CLI.hs | 2 +- Makefile | 3 +++ build-haskell.sh | 29 +++++++++++++++++++++++++++++ 5 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 build-haskell.sh diff --git a/.gitignore b/.gitignore index d7c04f9..4d2e073 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ server/docker/containers/ # generic folder to ignore export/ +exports/ # Any testing file *test diff --git a/Bindings/Haskell/lib/API.hs b/Bindings/Haskell/lib/API.hs index 0cc616e..bf67f96 100644 --- a/Bindings/Haskell/lib/API.hs +++ b/Bindings/Haskell/lib/API.hs @@ -96,7 +96,7 @@ main = p2prcAPI :: P2PRCapi p2prcAPI = MkP2PRCapi - { startServer = spawnProcP2PRC p2prcCmdName [ MkOptAtomic "--s" ] + { startServer = spawnProcP2PRC p2prcCmdName [ MkOptAtomic "-s" ] , execListServers = execProcP2PRCParser [ MkOptAtomic "--ls" ] MkEmptyStdInput diff --git a/Bindings/Haskell/lib/CLI.hs b/Bindings/Haskell/lib/CLI.hs index 43fb4d8..0896c3c 100644 --- a/Bindings/Haskell/lib/CLI.hs +++ b/Bindings/Haskell/lib/CLI.hs @@ -116,5 +116,5 @@ eitherErrorDecode esa = -- assumes the program is ran inside the haskell module in p2prc's repo -- assumes that last path segment is "haskell" and that p2prc binary's name is "p2p-rendering-computation" p2prcCmdName :: String -p2prcCmdName = "p2prc" +p2prcCmdName = "p2p-rendering-computation" diff --git a/Makefile b/Makefile index de64e1a..173f3e7 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,9 @@ sharedObjects: python: sh build-python-package.sh +haskell: + sh build-haskell.sh + clean: go clean -modcache rm -fr .go-build vendor result* diff --git a/build-haskell.sh b/build-haskell.sh new file mode 100644 index 0000000..9442fbf --- /dev/null +++ b/build-haskell.sh @@ -0,0 +1,29 @@ +# This bash script consists of the manaul build script of haskell +go build . + +# Unset p2prc path +unset p2prc + +# Enter the haskell project +cd Bindings/haskell +# Remove exsisting export build +rm -rf exports +# Create exports directory +mkdir exports +# Copy current haskell project into the folder +cp -rf . exports/ +# Copy p2prc binary inside haskell folder +cp ../../p2p-rendering-computation exports/ + +cd exports + +# Set p2prc variable +echo export P2PRC=$PWD + +export P2PRC=$PWD + +./p2p-rendering-computation --dc + +echo "Run the following commands in the directory: ${PWD}" +echo "To build: cabal build" +echo "To run sample program: cabal run"