Ticket #1035: OpenModelica-9999.ebuild

File OpenModelica-9999.ebuild, 4.6 KB (added by ebo, 16 years ago)

The attached files are gentoo (portage) ebuilds for version 1.4.5 and a live SVN version. These are really rough, but appear to work.

I would like you to review the changes in OpenModelica-1.4.5-build_fixes.patch for general inclusion back into the source tree.

Thanks and best regards,

EBo --

Line 
1# Copyright 1999-2009 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2
3# $Header: ... ebo Exp $
4
5#inherit flag-o-matic subversion eutils
6inherit subversion
7
8DESCRIPTION="A Modelica modeling, compilation and simulation environment."
9HOMEPAGE="http://www.ida.liu.se/labs/pelab/modelica/OpenModelica.html"
10
11# the original package tarball disappeared, so build it from SVN source
12ESVN_REPO_URI="https://openmodelica.ida.liu.se/svn/OpenModelica/trunk"
13ESVN_OPTIONS=" --username anonymous --password none"
14S=${WORKDIR}/trunk
15
16
17LICENSE="OSMC"
18SLOT="0"
19KEYWORDS="~amd64 ~x86"
20IUSE="+corba doc threads fortran"
21
22DEPEND="sys-apps/sed
23 sys-apps/coreutils
24 sys-apps/findutils
25 app-arch/tar
26 media-libs/coin
27 media-libs/SoQt"
28RDEPEND="dev-lang/rml
29 =dev-java/antlr-2*
30 sys-libs/readline
31 threads? ( dev-libs/boost )
32 corba? ( >=net-misc/mico-2.3.12
33 =x11-libs/qt-4*
34 >=virtual/jre-1.4 )
35 ${DEPEND}"
36
37pkg_setup() {
38 export RMLHOME="${ROOT}usr"
39 export ANTLRHOME="${ROOT}usr"
40 export CLASSPATH="${ROOT}usr/share/antlr/lib/antlr.jar"
41
42 # This package is very sensitive to parallelisation of the build
43 # process. Do not do it and you will be safe.
44 MAKEOPTS="${MAKEOPTS} -j1"
45}
46
47src_unpack() {
48 subversion_src_unpack || die "subversion unpack failed"
49
50 cd "${S}"
51 chmod +x configure
52 chmod +x Compiler/rml2sig/rmldep-new.sh
53
54 # FIXME:
55 #epatch "${FILESDIR}/${P}-build_fixes.patch"
56 epatch "${FILESDIR}/OpenModelica-1.4.5-build_fixes.patch"
57
58 # Convert DOS line endings to UNIX, or script will not work.
59 sed -i -e "s|\r$||g" configure
60}
61
62src_compile() {
63 econf \
64 --without-CORBA \
65 $(use_with corba CORBA) \
66 $(use_with threads MODPAR) \
67 $(use_with threads BOOST) \
68 || die "Configure failed."
69
70 # Correct the documentation installation directory: the package
71 # does not give a 'make doc' alternative, so we simply install it
72 # into a folder that will be discarded if documentation is not
73 # desired.
74 if use doc ; then
75 sed -i -r "s|^(INSTALL_DOCDIR.*)/omc/doc|\1/doc/${P}|" "${S}/Makefile"
76 else
77 sed -i -r "s|^(INSTALL_DOCDIR).*/omc/doc|\1 = ${T}/rubbish|" "${S}/Makefile"
78 fi
79
80 emake || die "Build of the OpenModelica Compiler failed."
81
82 if use corba ; then
83 cd "${S}/OMShell"
84 qmake OMShell.pro || die "QMake could not be run on OMShell.pro."
85 emake || die "Build of the OpenModelica GUI Shell failed."
86 else
87 ewarn "You deactivated CORBA support for OpenModelica. This means also"
88 ewarn "that the Qt-based GUI will not be built."
89 fi
90}
91
92src_install() {
93 sed -i -r "s#^((lib|data)dir\s*=)\s*/usr(.*)#\1 \${prefix}\3#" Makefile
94 make prefix="${D}/usr" install
95 dobin "${S}/OMShell/OMShell"
96 # Yes, it looks stupid to put data files in /bin, but that's
97 # where OpenModelica expects them to be.
98 dobin "${S}/OMNotebook/OMNotebookQT4/commands.xml"
99 dobin "${S}/OMNotebook/OMNotebookQT4/modelicacolors.xml"
100 dobin "${S}/OMNotebook/OMNotebookQT4/stylesheet.xml"
101
102 # removed... see below
103 #dodoc "${S}/build/bin/ptplot\ copyright.txt"
104 dodoc "${S}/OSMC-License.txt"
105
106 # Untar the Modelica standard library and set permissions
107 LIBRARYDIR="${D}/usr/share/${PN}"
108 mkdir ${LIBRARYDIR}
109 cd ${LIBRARYDIR}
110 tar xzf "${S}/Compiler/VC7/Setup/zips/ModelicaLib.tar.gz"
111 for DIR in $( find ${LIBRARYDIR} -type d )
112 do
113 chmod 755 ${DIR}
114 done
115 for FILE in $( find ${LIBRARYDIR} -type f )
116 do
117 chmod 644 ${FILE}
118 done
119
120 # Build environment variables
121 echo "OPENMODELICAHOME=${ROOT}usr" > "${T}/99OpenModelica"
122 echo "OPENMODELICALIBRARY=${ROOT}usr/share/${PN}/ModelicaLibrary" >> "${T}/99OpenModelica"
123 doenvd "${T}/99OpenModelica"
124
125 # Do some spring cleaining: some files must be removed.
126 cd "${D}/usr"
127 # Note that lib/ could be lib64/ or lib32/.
128 rm -f lib*/libQt*.a lib*/libf2c*
129 # This has been dodoc'ed above.
130 rm -f bin/ptplot\ copyright.txt
131 # Remove files that are not useful in UNIX.
132 rm -f bin/Compile.* bin/doPlot.* bin/omc_*
133 # Remove one header that belongs to another package.
134 rm -f include/f2c.h
135
136 # Adjust some permissions
137 chmod 755 "${D}/usr/bin/Compile"
138 chmod 755 "${D}/usr/bin/doPlot"
139 # ... And fix some line endings
140 sed -i -e "s|\r$||g" "${D}/usr/bin/Compile"
141 sed -i -e "s|\r$||g" "${D}/usr/bin/doPlot"
142}
143
144pkg_postinst() {
145 if use corba ; then
146 ewarn "Remember to run 'source /etc/profile' as a user before starting the"
147 ewarn "graphical interface OMShell, otherwise it will not be able to"
148 ewarn "find the compiler and the Modelica standard library."
149 ewarn
150 ewarn "Note that OMShell generates a number of garbage files (C++ files,"
151 ewarn "result listings, executables) in the folder it is run from. You"
152 ewarn "should run OMShell from a sandbox folder."
153 fi
154 echo
155 einfo "OpenModelica..."
156 echo
157}