summaryrefslogtreecommitdiff
path: root/ghc/Pkgfile
blob: f5b0f3556f0d363168fdc6986904a6e80d4a2c89 (plain)
    1 # Description: Glasgow Haskell compiler.
    2 # URL: https://www.haskell.org/haskellwiki/Glasgow_Haskell_Compiler
    3 # Maintainer: Danny Rawlins, crux at romster dot me
    4 # Depends on: docbook-xsl libedit libffi libgmp readline
    5 
    6 name=ghc
    7 version=8.10.3
    8 _bversion=8.10.3
    9 release=1
   10 _bootstrapsum=f562ca61979ff1d21e34e69e59028cb742a8eff8d84e46bbd3a750f2ac7d8ed1
   11 #curl -s http://downloads.haskell.org/~ghc/$version/SHA256SUMS | grep ./ghc-$version-x86_64-centos7-linux.tar.xz | cut -d' ' -f1
   12 source=(https://downloads.haskell.org/~ghc/$version/$name-$version-src.tar.xz)
   13 
   14 build() {
   15 	# if ghc is not previously installed bootstrap it
   16 	if [ ! -e '/usr/bin/ghc' ]; then
   17 
   18 		# download binary bootstrap file if it does not exist
   19 		if [ ! -f "$PKGMK_SOURCE_DIR/$name-$_bversion-x86_64-centos7-linux.tar.xz" ]; then
   20 
   21 			wget "http://downloads.haskell.org/~ghc/$_bversion/$name-$_bversion-x86_64-centos7-linux.tar.xz" \
   22 				--output-document="$PKGMK_SOURCE_DIR/$name-$_bversion-x86_64-centos7-linux.tar.xz"
   23 
   24 		fi
   25 
   26 		if [ $_bootstrapsum != $(sha256sum "$PKGMK_SOURCE_DIR/$name-$_bversion-x86_64-centos7-linux.tar.xz" | cut -d' ' -f1) ]; then
   27 			echo "Error Bootstrap file $PKGMK_SOURCE_DIR/$name-$_bversion-x86_64-centos7-linux.tar.xz failed sha256sum"
   28 			exit $E_GENERAL
   29 		fi
   30 
   31 		mkdir tmp
   32 		cd tmp
   33 		bsdtar -xf "$PKGMK_SOURCE_DIR/$name-$_bversion-x86_64-centos7-linux.tar.xz"
   34 		mv $name-$_bversion ../$name-$_bversion-binary
   35 		cd -
   36 		rmdir tmp
   37 
   38 		cd $name-$_bversion-binary
   39 
   40 		# hack for gmp and ncurses for bootstrap binary ghc
   41 		ln -s /usr/lib/libgmp.so.10 libgmp.so.3
   42 		ln -s /lib/libncurses.so.6 libtinfo.so.5
   43 		export LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH"
   44 
   45 		./configure --prefix=$SRC/binary
   46 		make install
   47 		cd $SRC
   48 
   49 		export PATH="$SRC/binary/bin:$PATH"
   50 	fi
   51 
   52 	cd $name-$version
   53 
   54         ./configure \
   55                 --prefix=/usr \
   56                 --docdir=/usr/share/doc/ghc \
   57                 --with-system-libffi \
   58                 --with-ffi-includes=$(pkg-config --variable=includedir libffi)
   59 
   60 	make
   61 	make -j1 DESTDIR=$PKG install
   62 
   63 	rm -r $PKG/usr/share/doc
   64 }

Generated by cgit