* ./goodies:

- New: In buildCoriolis.py, support to build rpm packages (in user's "rpm"
        directory).
    - Added: coriolis2.spec.in for rpm building. Install under /opt/coriolis2.
        This spec files has the particularity to also buildup a binary tarball
        of the compiled & installed files, this avoid a second complete build
        stage. The tarball is put into "rpm/SOURCES".
This commit is contained in:
Jean-Paul Chaput 2010-05-17 14:45:55 +00:00
parent 3401114216
commit 9ac035bb49
2 changed files with 195 additions and 4 deletions

View File

@ -68,6 +68,7 @@ class ProjectBuilder:
self._libMode = "Shared"
self._makeArguments = []
self._environment = os.environ
self._rpmTopDir = os.path.join ( os.environ["HOME"], "rpm" )
self._guessOs ()
self._updateSecondary ()
@ -111,6 +112,11 @@ class ProjectBuilder:
if self._enableShared == "ON": self._libMode = "Shared"
else: self._libMode = "Static"
self._specFileIn = os.path.join ( self._sourceDir, "goodies", "coriolis2.spec.in" )
self._specFile = os.path.join ( self._sourceDir, "goodies", "coriolis2.spec" )
self._sourceTarBz2 = "coriolis2-1.0-%s.tar.bz2" % self._svnTag
self._binaryTarBz2 = "coriolis2-binary-1.0-%s.tar.bz2" % self._svnTag
return
@ -151,6 +157,7 @@ class ProjectBuilder:
if m:
self._svnTag = m.group("revision")
print "Latest revision of project %s is %s." % (project.getName(),self._svnTag)
self._updateSecondary ()
return
print "[WARNING] Cannot guess revision for project \"%s\"." % project.getName()
@ -158,6 +165,27 @@ class ProjectBuilder:
return
def _doSpec ( self ):
fdSpecFileIn = open ( self._specFileIn, "r" )
fdSpecFile = open ( self._specFile , "w" )
for line in fdSpecFileIn.readlines():
stable = False
substituted0 = line
while not stable:
substituted1 = re.sub ( r"@svntag@" , self._svnTag , substituted0 )
substituted1 = re.sub ( r"@coriolisTop@", "/opt/coriolis2", substituted1 )
if substituted0 == substituted1: stable = True
else: substituted0 = substituted1
fdSpecFile.write ( substituted0 )
fdSpecFileIn.close ()
fdSpecFile.close ()
return
def _execute ( self, command, error ):
sys.stdout.flush ()
sys.stderr.flush ()
@ -401,6 +429,8 @@ class ProjectBuilder:
if self._svnTag == "x":
self._guessSvnTag ( self.getProject(projects[0]) )
self._doSpec ()
if os.path.isdir(self._tarballDir):
print "Removing previous tarball directory: \"%s\"." % self._tarballDir
command = [ "/bin/rm", "-r", self._tarballDir ]
@ -411,7 +441,7 @@ class ProjectBuilder:
self.svnExport ( tools, projects )
os.chdir ( self._tarballDir )
command = [ "/bin/tar", "jcvf", "coriolis2-1.0-%s.tar.bz2" % (self._svnTag), "coriolis2-1.0" ]
command = [ "/bin/tar", "jcvf", self._sourceTarBz2, "coriolis2-1.0" ]
self._execute ( command, "tar command failed" )
print "Cleanup SVN export tarball archive directory: \"%s\"." % self._archiveDir
@ -421,6 +451,29 @@ class ProjectBuilder:
return
def doRpm ( self, tools, projects ):
self.tarball ( tools, projects )
rpmSpecFile = os.path.join ( self._rpmTopDir, "SPECS/coriolis2.spec" )
rpmSourceFile = os.path.join ( self._rpmTopDir, "SOURCES", self._sourceTarBz2 )
sourceFile = os.path.join ( self._tarballDir, self._sourceTarBz2 )
if os.path.isfile ( rpmSpecFile ):
os.unlink ( rpmSpecFile )
os.symlink ( self._specFile , rpmSpecFile )
if not os.path.islink ( rpmSourceFile ):
os.symlink ( sourceFile, rpmSourceFile )
os.chdir ( os.path.join ( os.environ["HOME"], "rpm" ) )
command = [ "/usr/bin/rpmbuild", "-ba", "--with", "binarytar", rpmSpecFile ]
self._execute ( command, "Rebuild rpm packages" )
return
if __name__ == "__main__":
io = Project ( name = "io"
@ -477,6 +530,7 @@ if __name__ == "__main__":
parser.add_option ( "--svn-checkout" , action="store_true", dest="svnCheckout" )
# Miscellaneous.
parser.add_option ( "--tarball" , action="store_true", dest="tarball" )
parser.add_option ( "--do-rpm" , action="store_true", dest="doRpm" )
( options, args ) = parser.parse_args ()
builder = ProjectBuilder ()
@ -504,6 +558,7 @@ if __name__ == "__main__":
elif options.svnUpdate: builder.svnUpdate ( tools=options.tools, projects=options.projects )
elif options.svnCheckout: builder.svnCheckout ( tools=options.tools, projects=options.projects )
elif options.tarball: builder.tarball ( tools=options.tools, projects=options.projects )
elif options.doRpm: builder.doRpm ( tools=options.tools, projects=options.projects )
else: builder.build ( tools=options.tools, projects=options.projects )
sys.exit ( 0 )

136
bootstrap/coriolis2.spec.in Normal file
View File

@ -0,0 +1,136 @@
%define coriolisTop @coriolisTop@
%define svntag @svntag@
%define with_binarytar %{?_with_binarytar:1}%{!?_with_binarytar:0}
Name: coriolis2
Summary: Coriolis 2 VLSI CAD Sytem
Version: 1.0
Release: 1
License: LGPL/GPL
Group: Applications/Engineering
Source: %{name}-%{version}-%{svntag}.tar.bz2
URL: http://www-asim.lip6.fr/
Packager: Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
BuildRoot: %{_tmppath}/root-%{name}
%description
Coriolis is the new CAD tool suite intended to replace the
physical backend flow of Alliance.
%package devel
Summary: Coriolis 2 VLSI CAD Sytem - Development
Group: Applications/Engineering
Requires: %{name} = %{version}-%{release}
%description devel
Development files for the Coriolis 2 package.
%prep
%setup
%build
if [ -d %{buildroot} ]; then rm -r %{buildroot}; fi
IO_TOP=%{buildroot}%{coriolisTop}; export IO_TOP
CORIOLIS_TOP=%{buildroot}%{coriolisTop}; export CORIOLIS_TOP
# Do build & install in one step.
tools="io hurricane crlcore knik katabatic kite equinox solstice unicorn"
for tool in $tools; do
%__mkdir_p build/$tool
pushd build/$tool;
cmake -D CMAKE_BUILD_TYPE:STRING=RELEASE \
-D BUILD_SHARED_LIBS:STRING=ON \
-D BUILD_DOC:STRING=OFF \
-D CMAKE_INSTALL_PREFIX:STRING=%{coriolisTop} \
../../$tool
make DESTDIR=%{buildroot} %{_smp_mflags} install
popd
done
%install
# Nothing to do here.
# Removing undistributed binaries.
%__rm -f %{buildroot}%{coriolisTop}/bin/{cx2y,kite-text}
%{__mkdir} -p %{buildroot}%{_sysconfdir}/ld.so.conf.d/
cat > %{buildroot}%{_sysconfdir}/ld.so.conf.d/%{name}.conf << EOF
# Coriolis 2 VLSI design system
%{prefix}/lib
%{prefix}/lib/python
EOF
%if %{with_binarytar}
cd %{buildroot}%{coriolisTop}
tar --exclude "*/cmake_modules*" \
-jcf %{_sourcedir}/%{name}-binary-%{version}-%{release}-%{svntag}.tar.bz2 \
bin lib share
%endif
%clean
if [ -d %{buildroot} ]; then rm -r %{buildroot}; fi
%files
%defattr(-,root,root,-)
%dir %{coriolisTop}/share/etc
%dir %{coriolisTop}/share/etc/flute-2.4
%dir %{coriolisTop}/bin
%dir %{coriolisTop}/lib
%dir %{coriolisTop}/lib/python
%{coriolisTop}/bin/*
%{coriolisTop}/lib/*.so
%{coriolisTop}/lib/python/*.so
%config(noreplace) %{_sysconfdir}/ld.so.conf.d/*
%config(noreplace) %{coriolisTop}/share/etc/*.xml
%config(noreplace) %{coriolisTop}/share/etc/flute-2.4/*.dat
%files devel
%defattr(-,root,root,-)
%dir %{coriolisTop}/share/cmake_modules
%dir %{coriolisTop}/include
%dir %{coriolisTop}/include/io
%dir %{coriolisTop}/include/io/agds
%dir %{coriolisTop}/include/io/cif
%dir %{coriolisTop}/include/io/dtr
%dir %{coriolisTop}/include/io/openChams
%dir %{coriolisTop}/include/hurricane
%dir %{coriolisTop}/include/hurricane/viewer
%dir %{coriolisTop}/include/hurricane/isobar
%dir %{coriolisTop}/include/coriolis
%dir %{coriolisTop}/include/coriolis/crlcore
%dir %{coriolisTop}/include/coriolis/knik
%dir %{coriolisTop}/include/coriolis/katabatic
%dir %{coriolisTop}/include/coriolis/kite
%dir %{coriolisTop}/include/coriolis/equinox
%dir %{coriolisTop}/include/coriolis/solstice
%{coriolisTop}/share/cmake_modules/*.cmake
%{coriolisTop}/include/io/agds/*.h
%{coriolisTop}/include/io/cif/*.h
%{coriolisTop}/include/io/dtr/*.h
%{coriolisTop}/include/io/openChams/*.h
%{coriolisTop}/include/hurricane/*.h
%{coriolisTop}/include/hurricane/viewer/*.h
%{coriolisTop}/include/hurricane/isobar/*.h
%{coriolisTop}/include/coriolis/crlcore/*.h
%{coriolisTop}/include/coriolis/knik/*.h
%{coriolisTop}/include/coriolis/katabatic/*.h
%{coriolisTop}/include/coriolis/kite/*.h
%{coriolisTop}/include/coriolis/equinox/*.h
%{coriolisTop}/include/coriolis/solstice/*.h
%changelog
* Sun May 16 2010 Jean-Paul.Chaput <Jean-Paul.Chaput@lip6.fr>
- Initial packaging for svn release 1322 (alpha stage).