Commit 9d65aa0e authored by LAMBERT Jean-charles's avatar LAMBERT Jean-charles

new installation process to make packages

parent 58db1b0f
3rdparty/nemolight/build-Debug 3rdparty/nemolight/build-Debug
#cmake #cmake
*build/ *build*/
#qmake #qmake
*.user *.user
......
...@@ -13,13 +13,13 @@ ...@@ -13,13 +13,13 @@
# ============================================================================ # ============================================================================
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.6)
#INCLUDE(CPack)
# project name # project name
project (UNSIO2) project (UNSIO2)
SET(CMAKE_VERBOSE_MAKEFILE OFF) SET(CMAKE_VERBOSE_MAKEFILE OFF)
# extra path for NEMO # extra cmake path
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake) SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
# load setup flags # load setup flags
...@@ -53,7 +53,6 @@ MESSAGE( STATUS "core OPT =" ${OPT} ) ...@@ -53,7 +53,6 @@ MESSAGE( STATUS "core OPT =" ${OPT} )
MESSAGE( STATUS "OSX detected =" ${OSX} ) MESSAGE( STATUS "OSX detected =" ${OSX} )
MESSAGE( STATUS "BUILD_TYPE =" ${RELEASE} ) MESSAGE( STATUS "BUILD_TYPE =" ${RELEASE} )
FIND_PACKAGE(NEMO)
FIND_PACKAGE(SQLITE3) FIND_PACKAGE(SQLITE3)
#set (HDF5_USE_STATIC_LIBRARIES TRUE) #set (HDF5_USE_STATIC_LIBRARIES TRUE)
FIND_PACKAGE(HDF5 COMPONENTS CXX REQUIRED) FIND_PACKAGE(HDF5 COMPONENTS CXX REQUIRED)
...@@ -64,19 +63,12 @@ if(LINUX_ISSUE MATCHES "Mageia") ...@@ -64,19 +63,12 @@ if(LINUX_ISSUE MATCHES "Mageia")
endif() endif()
MESSAGE( STATUS "2) HDF5_CXX_LIBRARIES=" ${HDF5_CXX_LIBRARIES}) MESSAGE( STATUS "2) HDF5_CXX_LIBRARIES=" ${HDF5_CXX_LIBRARIES})
#set (NEMO_INSTALLED FALSE) # fore NEMO not installed MESSAGE(STATUS "NEMO LIGHT will be build")
IF (NOT NEMO_INSTALLED)
MESSAGE(STATUS "NEMO LIGHT will be build")
add_subdirectory(${PROJECT_SOURCE_DIR}/3rdparty/nemolight ${PROJECT_SOURCE_DIR}/3rdparty/nemolight/build-${CMAKE_BUILD_TYPE} )
set(NEMOLIGHT ${PROJECT_SOURCE_DIR}/3rdparty/nemolight)
set(NEMOLIB ${NEMOLIGHT}/build-${CMAKE_BUILD_TYPE}/lib)
set(NEMOINC ${NEMOLIGHT}/src/inc)
ELSE (NOT NEMO_INSTALLED) add_subdirectory(${PROJECT_SOURCE_DIR}/3rdparty/nemolight ${PROJECT_SOURCE_DIR}/3rdparty/nemolight/build-${CMAKE_BUILD_TYPE} )
set(NEMOLIB $ENV{NEMOLIB}) set(NEMOLIGHT ${PROJECT_SOURCE_DIR}/3rdparty/nemolight)
set(NEMOINC $ENV{NEMOINC}) set(NEMOLIB ${NEMOLIGHT}/build-${CMAKE_BUILD_TYPE}/lib)
ENDIF (NOT NEMO_INSTALLED) set(NEMOINC ${NEMOLIGHT}/src/inc)
MESSAGE( STATUS "NEMOLIB : " ${NEMOLIB} ) MESSAGE( STATUS "NEMOLIB : " ${NEMOLIB} )
MESSAGE( STATUS "NEMOINC : " ${NEMOINC} ) MESSAGE( STATUS "NEMOINC : " ${NEMOINC} )
...@@ -106,11 +98,8 @@ if (OSX) ...@@ -106,11 +98,8 @@ if (OSX)
endif() endif()
# #
IF (NOT NEMO_INSTALLED) SET(DEP_NEMO_LIB "nemo")
SET(DEP_NEMO_LIB "nemo") #ENDIF (NOT NEMO_INSTALLED)
ELSE (NOT NEMO_INSTALLED)
SET(DEP_NEMO_LIB "${NEMOLIB}/libnemo.a")
ENDIF (NOT NEMO_INSTALLED)
target_link_libraries(unsio ${DEP_NEMO_LIB} ${HDF5_CXX_LIBRARIES} sqlite3 z ) target_link_libraries(unsio ${DEP_NEMO_LIB} ${HDF5_CXX_LIBRARIES} sqlite3 z )
if (OSX) if (OSX)
...@@ -120,25 +109,16 @@ endif() ...@@ -120,25 +109,16 @@ endif()
# ---------------------------------------------------------- # ----------------------------------------------------------
# Install SETUP # Install SETUP
# ---------------------------------------------------------- # ----------------------------------------------------------
SET(PREFIX_LIB "lib") # must be changed to lib64 when get rid of NEMO
SET(PREFIX_INC "inc") # must be changed to include when get rid of NEMO
SET(PREFIX_MAN "man")
SET(PREFIX_SCR "scripts")
mark_as_advanced(CMAKE_INSTALL_PREFIX) mark_as_advanced(CMAKE_INSTALL_PREFIX)
if (CMAKE_INSTALL_PREFIX STREQUAL "/usr") SET(PREFIX_LIB ${LIB_SUFFIX})
SET(PREFIX_LIB "lib64") SET(PREFIX_INC "include")
SET(PREFIX_INC "include") SET(PREFIX_MAN "share/man")
SET(PREFIX_MAN "share/man") SET(PREFIX_SCR "share/uns/scripts")
SET(PREFIX_SCR "share/uns/scripts")
endif()
IF (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) IF (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
IF (NEMO_INSTALLED) set (CMAKE_INSTALL_PREFIX "$ENV{HOME}/local/unsio" CACHE PATH "" FORCE) #if NEMO NOT exist => default install into ${HOME}/local/unsio
set (CMAKE_INSTALL_PREFIX "$ENV{NEMO}" CACHE PATH "" FORCE) #if NEMO exist => default install into NEMO path
ELSE()
set (CMAKE_INSTALL_PREFIX "$ENV{HOME}/local/unsio" CACHE PATH "" FORCE) #if NEMO NOT exist => default install into ${HOME}/local/unsio
ENDIF()
ENDIF ()#NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) ENDIF ()#NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
MESSAGE( STATUS "--------> CMAKE_INSTALL_PREFIX =" ${CMAKE_INSTALL_PREFIX}) MESSAGE( STATUS "--------> CMAKE_INSTALL_PREFIX =" ${CMAKE_INSTALL_PREFIX})
...@@ -235,32 +215,30 @@ INSTALL(FILES ${UNSIO2_BINARY_DIR}/../src/snapshotinterface.h DESTINATION ${PRE ...@@ -235,32 +215,30 @@ INSTALL(FILES ${UNSIO2_BINARY_DIR}/../src/snapshotinterface.h DESTINATION ${PRE
INSTALL(FILES ${UNSIO2_BINARY_DIR}/../src/componentrange.h DESTINATION ${PREFIX_INC}/uns) INSTALL(FILES ${UNSIO2_BINARY_DIR}/../src/componentrange.h DESTINATION ${PREFIX_INC}/uns)
INSTALL(FILES ${UNSIO2_BINARY_DIR}/../src/ctools.h DESTINATION ${PREFIX_INC}/uns) INSTALL(FILES ${UNSIO2_BINARY_DIR}/../src/ctools.h DESTINATION ${PREFIX_INC}/uns)
INSTALL(FILES ${UNSIO2_BINARY_DIR}/../src/userselection.h DESTINATION ${PREFIX_INC}/uns) INSTALL(FILES ${UNSIO2_BINARY_DIR}/../src/userselection.h DESTINATION ${PREFIX_INC}/uns)
# unsio lib
INSTALL(FILES ${UNSIO2_BINARY_DIR}/lib/libunsio.${LIBEXT} DESTINATION ${PREFIX_LIB})
# man
INSTALL(FILES ${UNSIO2_BINARY_DIR}/../man/man3/unsiof.3 DESTINATION ${PREFIX_MAN}/man3)
# NEMO specific includes #
IF (NOT NEMO_INSTALLED) # NEMO specific lib and includes
#
# install nemo lib
INSTALL(FILES ${NEMOLIB}/libnemo.a DESTINATION ${PREFIX_LIB})
INSTALL(FILES ${NEMOLIB}/libnemomaing77.a DESTINATION ${PREFIX_LIB})
# Find all NEMOLIGHT header files #INSTALL(FILES ${NEMOLIB}/libnemo.a DESTINATION ${PREFIX_LIB})
FILE(GLOB nlight_files ${NEMOLIGHT}/src/*.h ${NEMOLIGHT}/src/inc/*.h) INSTALL(FILES ${NEMOLIB}/libnemomaing77.a DESTINATION ${PREFIX_LIB})
FOREACH(source_header ${nlight_files})
INSTALL(FILES ${source_header} DESTINATION ${PREFIX_INC})
ENDFOREACH()
FILE(GLOB nlight_files ${NEMOLIGHT}/src/inc/snapshot/*.{c,h}) # Find all NEMOLIGHT header files
FOREACH(source_header ${nlight_files}) FILE(GLOB nlight_files ${NEMOLIGHT}/src/*.h ${NEMOLIGHT}/src/inc/*.h)
INSTALL(FILES ${source_header} DESTINATION ${PREFIX_INC}/snapshot) FOREACH(source_header ${nlight_files})
ENDFOREACH() INSTALL(FILES ${source_header} DESTINATION ${PREFIX_INC}/nemo)
ENDFOREACH()
ENDIF() FILE(GLOB nlight_files ${NEMOLIGHT}/src/inc/snapshot/*.c ${NEMOLIGHT}/src/inc/snapshot/*.h)
FOREACH(source_header ${nlight_files})
INSTALL(FILES ${source_header} DESTINATION ${PREFIX_INC}/nemo/snapshot)
ENDFOREACH()
# unsio lib
INSTALL(FILES ${UNSIO2_BINARY_DIR}/lib/libunsio.${LIBEXT} DESTINATION ${PREFIX_LIB})
# man
INSTALL(FILES ${UNSIO2_BINARY_DIR}/../man/man3/unsiof.3 DESTINATION ${PREFIX_MAN}/man3)
if (NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr") if (NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr")
# I man using this hack otherwise the RPM package created fails to install because an unresolve dependency on Tools::Sqlite3 # I man using this hack otherwise the RPM package created fails to install because an unresolve dependency on Tools::Sqlite3
...@@ -327,6 +305,8 @@ set(CPACK_RPM_PACKAGE_DESCRIPTION "UNSIO - Universal Nbody Snapshot Input Output ...@@ -327,6 +305,8 @@ set(CPACK_RPM_PACKAGE_DESCRIPTION "UNSIO - Universal Nbody Snapshot Input Output
# CPACK debian specific # CPACK debian specific
set(CPACK_DEBIAN_PACKAGE_NAME ${CPACK_PACKAGE_NAME}) set(CPACK_DEBIAN_PACKAGE_NAME ${CPACK_PACKAGE_NAME})
set(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${LINUX_NAME}) set(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${LINUX_NAME})
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON)
IF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") IF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE amd64) SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE amd64)
ELSEIF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686") ELSEIF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686")
......
...@@ -35,6 +35,7 @@ if(UNIX) ...@@ -35,6 +35,7 @@ if(UNIX)
set(SPECIFIC_SYSTEM_PREFERED_CPACK_GENERATOR "TGZ") set(SPECIFIC_SYSTEM_PREFERED_CPACK_GENERATOR "TGZ")
set(LINUX_NAME "") set(LINUX_NAME "")
set(LINUX_ISSUE "") set(LINUX_ISSUE "")
set(LIB_SUFFIX "lib64")
if(EXISTS "/etc/system-release") if(EXISTS "/etc/system-release")
file(READ "/etc/system-release" LINUX_ISSUE) file(READ "/etc/system-release" LINUX_ISSUE)
elseif (EXISTS "/etc/issue") elseif (EXISTS "/etc/issue")
...@@ -85,6 +86,7 @@ if(UNIX) ...@@ -85,6 +86,7 @@ if(UNIX)
string(REGEX MATCH "buntu ([0-9]+\\.[0-9]+)" UBUNTU "${LINUX_ISSUE}") string(REGEX MATCH "buntu ([0-9]+\\.[0-9]+)" UBUNTU "${LINUX_ISSUE}")
set(LINUX_NAME "ubuntu${CMAKE_MATCH_1}") set(LINUX_NAME "ubuntu${CMAKE_MATCH_1}")
set(SPECIFIC_SYSTEM_PREFERED_CPACK_GENERATOR "DEB") set(SPECIFIC_SYSTEM_PREFERED_CPACK_GENERATOR "DEB")
set(LIB_SUFFIX "lib/x86_64-linux-gnu")
endif(LINUX_ISSUE MATCHES "Ubuntu") endif(LINUX_ISSUE MATCHES "Ubuntu")
# Mint case # Mint case
if(LINUX_ISSUE MATCHES "Mint") if(LINUX_ISSUE MATCHES "Mint")
...@@ -93,6 +95,7 @@ if(UNIX) ...@@ -93,6 +95,7 @@ if(UNIX)
string(REGEX MATCH "Mint ([0-9]+\\.[0-9]+)" MINT "${LINUX_ISSUE}") string(REGEX MATCH "Mint ([0-9]+\\.[0-9]+)" MINT "${LINUX_ISSUE}")
set(LINUX_NAME "mint${CMAKE_MATCH_1}") set(LINUX_NAME "mint${CMAKE_MATCH_1}")
set(SPECIFIC_SYSTEM_PREFERED_CPACK_GENERATOR "DEB") set(SPECIFIC_SYSTEM_PREFERED_CPACK_GENERATOR "DEB")
set(LIB_SUFFIX "lib/x86_64-linux-gnu")
endif(LINUX_ISSUE MATCHES "Mint") endif(LINUX_ISSUE MATCHES "Mint")
# Debian case # Debian case
if(LINUX_ISSUE MATCHES "Debian") if(LINUX_ISSUE MATCHES "Debian")
...@@ -101,6 +104,7 @@ if(UNIX) ...@@ -101,6 +104,7 @@ if(UNIX)
set(LINUX_NAME "debian-${CMAKE_MATCH_1}") set(LINUX_NAME "debian-${CMAKE_MATCH_1}")
string(REPLACE "/" "_" LINUX_NAME ${LINUX_NAME}) string(REPLACE "/" "_" LINUX_NAME ${LINUX_NAME})
set(SPECIFIC_SYSTEM_PREFERED_CPACK_GENERATOR "DEB") set(SPECIFIC_SYSTEM_PREFERED_CPACK_GENERATOR "DEB")
set(LIB_SUFFIX "lib/x86_64-linux-gnu")
endif(LINUX_ISSUE MATCHES "Debian") endif(LINUX_ISSUE MATCHES "Debian")
# Open SuSE case # Open SuSE case
if(LINUX_ISSUE MATCHES "SUSE") if(LINUX_ISSUE MATCHES "SUSE")
......
...@@ -87,9 +87,20 @@ A list of all available make targets can be obtained by ...@@ -87,9 +87,20 @@ A list of all available make targets can be obtained by
To creata an installable package (RPM, deb, etc...) use the following command : To creata an installable package (RPM, deb, etc...) use the following command :
1) python2 packaging 1) python2 packaging
SRCPATH=`pwd`/../src python setup.py bdist_rpm python setup.py bdist_rpm --release 1mga6
2) python3 packaging 2) python3 packaging
SRCPATH=`pwd`/../src python3 setup.py bdist_rpm python3 setup.py bdist_rpm --release 1mga6
Both packages will be located in 'dist' directory Both packages will be located in 'dist' directory
NOTE :
Deb packaging, install
apt-get install python3-stdeb fakeroot python3-all-dev python3-all swig python3-numpy python3-setuptools
apt-get install python-stdeb fakeroot python-all-dev python-all swig python-numpy python-setuptools libsqlite3-dev
to build DEB package for both python2 and python3 in directory my_deb :
python setup.py --command-packages=stdeb.command bdist_deb sdist_dsc --with-python2=True --with-python3=True --dist-dir=my_deb --debian-version 0ubuntu16.04
see https://pypi.org/project/stdeb/
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
To build RPM (from py respositoy) : To build RPM (from py respositoy) :
SRCPATH=`pwd`/../src python3 setup.py bdist_rpm SRCPATH=`pwd`/../src python3 setup.py bdist_rpm
To build deb package
SRCPATH=`pwd`/../src python3 setup.py --command-packages=stdeb.command bdist_deb
""" """
#from distutils.core import setup, Extension #from distutils.core import setup, Extension
...@@ -17,9 +20,11 @@ try: ...@@ -17,9 +20,11 @@ try:
except AttributeError: except AttributeError:
numpy_include = numpy.get_numpy_include() numpy_include = numpy.get_numpy_include()
SRCPATH=os.environ["SRCPATH"] try:
if SRCPATH=="": SRCPATH=os.environ["SRCPATH"]
SRPCPATH="./" except:
print("You must prepend your command line with \"SRCPATH=`pwd`/../src\"")
sys.exit()
# detect python version (2 or 3) # detect python version (2 or 3)
pyversion="3" pyversion="3"
...@@ -32,6 +37,7 @@ setup( ...@@ -32,6 +37,7 @@ setup(
description='Python wrapper to unsio', description='Python wrapper to unsio',
author='Jean-Charles LAMBERT', author='Jean-Charles LAMBERT',
author_email='jean-charles.lambert@lam.fr', author_email='jean-charles.lambert@lam.fr',
url='https://projets.lam.fr/projects/unsio',
# 'unsio' -> installation directory # 'unsio' -> installation directory
# 'swig' -> about all the py source in 'src' # 'swig' -> about all the py source in 'src'
package_dir={'unsio':'swig'}, package_dir={'unsio':'swig'},
......
from unsio.py_unsio import *
from __future__ import print_function
try:
from unsio.py_unsio import *
except:
import sys
print("Unable to import [unsio.py_unsio]....",file=sys.stderr)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment