Deb package creation script

From FreeCAD Documentation
Jump to navigation Jump to search
This page is a translated version of the page Deb package creation script and the translation is 100% complete.
Other languages:
English • ‎español • ‎italiano

Este archivo de guión crea un paquete .deb a partir del código fuente de FreeCAD. Necesitas tener instalado ele paquete checkinstall. Para utilizarlo, simplemente:

  • editar el archivo de guión y cambiar manualmente las líneas de configuración si es necesario
  • copy it to your freecad source dir,
  • hacerlo ejecutable,
  • asegurarse de que el código fuente se compilará sin errores (hacer primero un "make"),
  • entonces ejecutar el archivo de guión.

Nota: este archivo de guión ha sido creado para Ubuntu Gusty, puede haber una ligera diferencia en los nombres de los paquetes de las dependencias si utilizas otra versión de Ubuntu/Debian. Si tienes más información sobre esto, por favor añádela aquí...

para Ubuntu Hardy

  • eliminar libumfpack4 de las dependencias (actualmente no se utiliza en FreeCAD)

  1. !/usr/bin/env python
  2. this script builds a .deb package of FreeCAD
  3. use it instead of 'make + make install' to generate a nice package for your debian-based system!
  1. config - edit manually if needed

maintainer='' # put your own email here! version='0.7' # the current FreeCAD version build=False # if true, freecad will be compiled (make) before anything else. I suggest to use True only when you are sure it will compile without errors Otherwise do "make" first, then run this script. occinclude='/usr/include/opencascade' # where your occ include files reside. Only used if build=True. installdir='/opt/FreeCAD' # where you want to install FreeCAD cflags='"-O2"' # my usual 64bit optimizations are "-O3 -march=athlon64". Leave an empty string "" if not sure.

  1. end of config
  1. start

import os

  1. build FreeCAD, if needed

if build: cmd='./configure --with-occ-include='+occinclude+' --prefix='+installdir+' CFLAGS='+cflags+' CXXFLAGS='+cflags os.system(cmd) os.system('make')

  1. retrieve release version number from source

vfile=open("src/Build/Version.h") for i in vfile: if (i.find("FCRevision ") != -1): revline = i release = revline.split('"')[1]

  1. creating Checkinstall files

debinstall = open('debinstall-pak','w') # shellscript containing the installation procedure debinstall.write('#!/bin/sh\n') debinstall.write('make install\n') debinstall.write('cp debian/freecad.desktop /usr/share/applications\n') debinstall.write('cp src/Gui/Icons/FCIcon.xpm /usr/share/pixmaps') debinstall.close()

os.system('chmod +x debinstall-pak')

postinstall = open('postinstall-pak','w') # shellscript to be run after freecad is installed postinstall.write('#!/bin/sh\n') postinstall.write('ln -s '+installdir+'/bin/FreeCAD /usr/bin/freecad') postinstall.close()

preremove = open('preremove-pak','w') # shellscript to be run before freecad is removed preremove.write('#!/bin/sh\n') preremove.write('rm /usr/bin/freecad') preremove.close()

description = open('description-pak','w') # package description description.write("FreeCAD is an Open Source CAx RAD based on OpenCasCade, Qt and Python. It features some key concepts like macro recording, workbenches, ability to run as a server and dynamically loadable application extensions and it is designed to be platform independent. For more details see") description.close()

  1. executing Checkinstall

dependencies='"opencascade, python, libc6-dev, libstdc++6, libboost-date-time-dev, libboost-filesystem-dev, libboost-graph-dev, libboost-iostreams-dev, libboost-program-options-dev, libboost-regex-dev, libboost-serialization-dev, libboost-signals-dev, libqt4-gui, zlib1g, libxerces27, libxt6, libsoqt4-dev, libxmu6, libxi6, libcoin40c2, libgl1-mesa-dev, libx11-6, libxext6, libgts-0.7-5, libumfpack4, libcv1, libqt4-qt3support, freeglut3-dev, libglu1-mesa-dev, libglu1-xorg-dev, libglut3-dev"' cmd='checkinstall --backup=no --fstrans=no --install=no --maintainer='+maintainer+' --pkgversion='+version+' --pkgrelease='+release+' --pkgname="freecad" --pkggroup="Graphics" --requires='+dependencies+' ./debinstall-pak' os.system(cmd)

  1. removing temp files

os.system('rm -r *pak')