aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--Pandoc.cabal.in2
-rwxr-xr-xcabalize5
3 files changed, 7 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 3b15e395c..e5442967f 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ CONFIGURE := configure
# Cabal constants
#-------------------------------------------------------------------------------
NAME := $(shell sed -ne 's/^[Nn]ame:[[:space:]]*//p' $(CABAL).in)
-VERSION := $(shell sed -ne 's/^[Vv]ersion:[[:space:]]*//p' $(CABAL).in)
+VERSION := $(shell sed -ne 's/^version[[:space:]]*=[[:space:]]*"\([^"]*\)"/\1/p' $(SRCDIR)/Main.hs)
EXECS := $(shell sed -ne 's/^[Ee]xecutable:[[:space:]]*//p' $(CABAL).in)
# First entry in Cabal's executable stanza is the main executable.
MAIN := $(firstword $(EXECS))
@@ -110,7 +110,7 @@ cleanup_files+=$(WRAPPERS)
@$(generate-shell-script)
cleanup_files+=$(CABAL)
-$(CABAL): cabalize $(CABAL).in
+$(CABAL): cabalize $(CABAL).in $(SRCDIR)/Main.hs
./cabalize <$(CABAL).in >$(CABAL)
.PHONY: configure
diff --git a/Pandoc.cabal.in b/Pandoc.cabal.in
index 9711c8671..cbe60f7c1 100644
--- a/Pandoc.cabal.in
+++ b/Pandoc.cabal.in
@@ -1,5 +1,5 @@
Name: Pandoc
-Version: 0.3
+Version: @VERSION@
License: GPL
License-File: LICENSE
Author: John MacFarlane <jgm@berkeley.edu>
diff --git a/cabalize b/cabalize
index 22ce64252..407336c9b 100755
--- a/cabalize
+++ b/cabalize
@@ -29,6 +29,8 @@ case "$ghc_version" in
esac
BUILD_DEPENDS=$(echo $BUILD_DEPENDS | sed -e 's# #, #g')
+PANDOC_VERSION=$(sed -ne 's/^version[[:space:]]*=[[:space:]]*"\([^"]*\)"/\1/p' src/Main.hs)
+
# Handle 'Hs-Source-Dir' option name which was deprecated in Cabal > 1.1.3.
HS_SOURCE_DIRS='Hs-Source-Dirs'
cabal_version=$(ghc-pkg -l | sed -ne 's/.*[Cc]abal-\([^,]*\).*/\1/p')
@@ -38,4 +40,5 @@ fi
sed -e "s#@HCFLAGS@#$HCFLAGS#g" \
-e "s#@BUILD_DEPENDS@#$BUILD_DEPENDS#g" \
- -e "s#@HS_SOURCE_DIRS@#$HS_SOURCE_DIRS#g"
+ -e "s#@HS_SOURCE_DIRS@#$HS_SOURCE_DIRS#g" \
+ -e "s#@VERSION@#$PANDOC_VERSION#g"