-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimberc.spec
92 lines (73 loc) · 2.62 KB
/
timberc.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# RPM spec file for timberc -*-rpm-spec-*-
#
# This file is subject to the same free software license as timberc.
#
# Copyright 2008-2009, Peter A. Jonsson
#
# This file was derived from ghc.spec.in
%define name timberc
%define version 1.0.3
%define release 1
Name: %{name}
Version: %{version}
Release: %{release}
License: BSD-like
Group: Development/Languages/Timber
URL: http://timber-lang.org
Source0: http://timber-lang.org/dist/timberc-%{version}.tar.gz
Packager: Peter A. Jonsson <[email protected]>
BuildRoot: %{_tmppath}/BUILDROOT/%{name}-%{version}-%{release}.%{_arch}
BuildRequires: happy >= 1.18, ghc >= 6.10.1
Provides: timber
Summary: The Timber Compiler
%description
%prep
%setup -b0
%build
runhaskell Setup configure --prefix=%{_prefix}
runhaskell Setup build
%install
runhaskell Setup copy --destdir=${RPM_BUILD_ROOT}
mv ${RPM_BUILD_ROOT}%{_bindir}/timberc ${RPM_BUILD_ROOT}%{_datadir}/timberc-%{version}/timberc
# Ugly hack: construct a temporary bin/timberc by hand to build the RTS.
SCRIPT="%{_bindir}/timberc"
SCRIPT_TMP="${RPM_BUILD_ROOT}$SCRIPT"
DATADIR="%{_datadir}/timberc-%{version}"
DATADIR_TMP="${RPM_BUILD_ROOT}/$DATADIR"
# Build a temporary timberc for compiling things during package construction.
# We must use a relative datadir here, otherwise the path will end up in the
# file which in turn will fail the sanity check of rpm.
echo "#!/bin/sh" > $SCRIPT_TMP
echo " " >> $SCRIPT_TMP
echo "exec $DATADIR_TMP/timberc -v \${1+\"\$@\"} --datadir .." >> $SCRIPT_TMP
chmod 755 $SCRIPT_TMP
cd rtsPOSIX
sh ./configure --prefix=$DATADIR --with-timberc=$SCRIPT_TMP
sed 's#^TIMBERC.*#TIMBERC = %{_bindir}/timberc#g' Makefile > Makefile.new
mv Makefile.new Makefile
make TIMBERC=$SCRIPT_TMP DESTDIR=${RPM_BUILD_ROOT} install
cd ..
# We're done with the temporary thing. Now make a real one.
rm $SCRIPT_TMP
echo "#!/bin/sh" > $SCRIPT_TMP
echo " " >> $SCRIPT_TMP
echo "exec $DATADIR/timberc \${1+\"\$@\"} --datadir $DATADIR" >> $SCRIPT_TMP
chmod 755 $SCRIPT_TMP
# Grep reports BUILDROOT inside our object files; disable that test.
QA_SKIP_BUILD_ROOT=1
export QA_SKIP_BUILD_ROOT
%clean
rm -rf ${RPM_BUILD_ROOT}
%post
# We should perhaps register as a Haskell package.
%preun
# If we register in post we should unregister here.
%files
%defattr(-,root,root)
%doc %{_prefix}/share/doc/timberc-%{version}/*
%{_prefix}/bin/timberc
%{_prefix}/share/timberc-%{version}/timberc
%{_prefix}/share/timberc-%{version}/rtsPOSIX/*
%{_prefix}/share/timberc-%{version}/examples/*
%{_prefix}/share/timberc-%{version}/include/*
%{_prefix}/share/timberc-%{version}/lib/*