add ebuilds (with some appropriate code change)

This commit is contained in:
eddyem 2018-10-28 21:29:23 +03:00
parent f5ba8ad63e
commit 4da483b33a
13 changed files with 250 additions and 18 deletions

View File

@ -1,21 +1,24 @@
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.0)
set(PROJ apogee_control)
project(${PROJ})
set(VERSION "0.2.0")
set(CMAKE_COLOR_MAKEFILE ON)
#set(CMAKE_VERBOSE_MAKEFILE ON)
if(DEFINED EBUG)
add_definitions(-DEBUG)
endif()
if(DEFINED CMAKE_INSTALL_PREFIX AND CMAKE_INSTALL_PREFIX MATCHES "/usr/local")
set(CMAKE_INSTALL_PREFIX "/usr")
endif()
message("Install dir prefix: ${CMAKE_INSTALL_PREFIX}")
project(${PROJ} VERSION ${PROJ_VERSION} LANGUAGES C CXX)
#if(DEFINED CMAKE_INSTALL_PREFIX AND CMAKE_INSTALL_PREFIX MATCHES "/usr/local")
# set(CMAKE_INSTALL_PREFIX "/usr")
#endif()
if(NOT DEFINED LOCALEDIR)
set(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale)
endif()
set(SOURCES defhdrs.c takepic.c usage.c camtools.c am.c macros.c)
if(NOT DEFINED NOBTA)
if(DEFINED USE_BTA AND USE_BTA STREQUAL "yes")
set(SOURCES ${SOURCES} bta_print.c)
add_definitions(-DUSE_BTA)
endif()
@ -47,16 +50,21 @@ set(PO_FILE ${LCPATH}/messages.po)
set(MO_FILE ${LCPATH}/LC_MESSAGES/${PROJ}.mo)
set(RU_FILE ${LCPATH}/ru.po)
find_package(PkgConfig REQUIRED)
set(MODULES cfitsio>=3.0 apogeec>=1.71 libusb>=0.1.10)
if(NOT DEFINED NOBTA)
# find CFITSIO
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
FIND_PACKAGE(CFITSIO REQUIRED)
set(MODULES apogeec>=1.71 libusb>=0.1.10)
if(DEFINED USE_BTA AND USE_BTA STREQUAL "yes")
set(MODULES ${MODULES} sla)
endif()
if(DEFINED USEPNG)
if(DEFINED USE_PNG AND USE_PNG STREQUAL "yes")
set(MODULES ${MODULES} libpng>=1.2)
add_definitions(-DUSEPNG)
endif()
pkg_check_modules(${PROJ} REQUIRED ${MODULES})
if(DEFINED USERAW)
if(DEFINED USE_RAW AND USE_RAW STREQUAL "yes")
add_definitions(-DUSERAW)
endif()
@ -68,22 +76,22 @@ if(OPENMP_FOUND)
endif()
add_executable(${PROJ} ${SOURCES} ${PO_FILE} ${MO_FILE})
include_directories(${${PROJ}_INCLUDE_DIRS} image_view_module)
include_directories(${${PROJ}_INCLUDE_DIRS} ${CFITSIO_INCLUDE_DIR} image_view_module)
link_directories(${${PROJ}_LIBRARY_DIRS})
add_definitions(${CFLAGS} -DLOCALEDIR=\"${LOCALEDIR}\" -DPACKAGE_VERSION=\"${VERSION}\"
-DGETTEXT_PACKAGE=\"${PROJ}\" -DPROJNAME=\"${PROJ}\")
if(NOT DEFINED NOIMAGEVIEW)
if(DEFINED USE_IMAGEVIEW AND USE_IMAGEVIEW STREQUAL "yes")
add_subdirectory(image_view_module)
endif()
if(IMAGEVIEW_FOUND)
message("Found OpenGL. Will use ${IMLIB} to show data")
find_package(X11 REQUIRED)
target_link_libraries(${PROJ} ${X11_LIBRARIES} ${${PROJ}_LIBRARIES} -lm ${IMLIB})
target_link_libraries(${PROJ} ${IMLIB} ${X11_LIBRARIES} ${${PROJ}_LIBRARIES} ${CFITSIO_LIBRARIES} -lm)
add_definitions(-DIMAGEVIEW)
else()
message("Will compile without image view module")
target_link_libraries(${PROJ} ${${PROJ}_LIBRARIES} -lm)
target_link_libraries(${PROJ} ${${PROJ}_LIBRARIES} ${CFITSIO_LIBRARIES} -lm)
endif()
# Installation of the program

67
FindCFITSIO.cmake Normal file
View File

@ -0,0 +1,67 @@
# - Try to find CFITSIO
# Once done this will define
#
# CFITSIO_FOUND - system has CFITSIO
# CFITSIO_INCLUDE_DIR - the CFITSIO include directory
# CFITSIO_LIBRARIES - Link these to use CFITSIO
# CFITSIO_VERSION_STRING - Human readable version number of cfitsio
# CFITSIO_VERSION_MAJOR - Major version number of cfitsio
# CFITSIO_VERSION_MINOR - Minor version number of cfitsio
# Copyright (c) 2006, Jasem Mutlaq <mutlaqja@ikarustech.com>
# Based on FindLibfacile by Carsten Niehaus, <cniehaus@gmx.de>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
# in cache already, be quiet
set(CFITSIO_FIND_QUIETLY TRUE)
else (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
# JM: Packages from different distributions have different suffixes
find_path(CFITSIO_INCLUDE_DIR fitsio.h
PATH_SUFFIXES libcfitsio3 libcfitsio0 cfitsio
PATHS
$ENV{CFITSIO}
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(CFITSIO_LIBRARIES NAMES cfitsio
PATHS
$ENV{CFITSIO}
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
if(CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
set(CFITSIO_FOUND TRUE)
else (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
set(CFITSIO_FOUND FALSE)
endif(CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
if (CFITSIO_FOUND)
# Find the version of the cfitsio header
FILE(READ "${CFITSIO_INCLUDE_DIR}/fitsio.h" FITSIO_H)
STRING(REGEX REPLACE ".*#define CFITSIO_VERSION[^0-9]*([0-9]+)\\.([0-9]+).*" "\\1.\\2" CFITSIO_VERSION_STRING "${FITSIO_H}")
STRING(REGEX REPLACE "^([0-9]+)[.]([0-9]+)" "\\1" CFITSIO_VERSION_MAJOR ${CFITSIO_VERSION_STRING})
STRING(REGEX REPLACE "^([0-9]+)[.]([0-9]+)" "\\2" CFITSIO_VERSION_MINOR ${CFITSIO_VERSION_STRING})
message(STATUS "found version string ${CFITSIO_VERSION_STRING}")
if (NOT CFITSIO_FIND_QUIETLY)
message(STATUS "Found CFITSIO ${CFITSIO_VERSION_MAJOR}.${CFITSIO_VERSION_MINOR}: ${CFITSIO_LIBRARIES}")
endif (NOT CFITSIO_FIND_QUIETLY)
else (CFITSIO_FOUND)
if (CFITSIO_FIND_REQUIRED)
message(STATUS "CFITSIO not found.")
endif (CFITSIO_FIND_REQUIRED)
endif (CFITSIO_FOUND)
mark_as_advanced(CFITSIO_INCLUDE_DIR CFITSIO_LIBRARIES)
endif (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)

View File

@ -917,7 +917,7 @@ static int get_shm_block( struct SHM_Block *sb, int server) {
return 0;
}
if(server) {
if((shmctl(sb->id, SHM_LOCK, NULL) < 0) < 0) {
if(shmctl(sb->id, SHM_LOCK, NULL) < 0) {
char msg[80];
sprintf(msg,"Can't prevents swapping of shared memory segment '%s'",sb->key.name);
perror(msg);

View File

@ -294,7 +294,7 @@ int writepng(char *filename, int width, int height, void *data){
goto done;
}
png_init_io(pngptr, fp);
png_set_compression_level(pngptr, Z_BEST_COMPRESSION);
png_set_compression_level(pngptr, 6);
png_set_IHDR(pngptr, infoptr, width, height, 16, PNG_COLOR_TYPE_GRAY,
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
PNG_FILTER_TYPE_DEFAULT);

View File

@ -0,0 +1 @@
EBUILD apogee_control-0.1.ebuild 977 BLAKE2B 15b947785fb45a720958d9f4cfdd39f07cc517ec2527c274fbd7ce2de97e14e7a4b7a55737a275c1c84b9f30b62157a8289b63f780073fd86588dde95180e155 SHA512 24bec09adbd7e8c3433850f073b3c676c6e720b4a6d3660d89bd221c897fa114a42d6a43eb829a19485b70a89e00f011aa29208c83599a47f479f496e6f29f6c

View File

@ -0,0 +1,49 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit cmake-utils
DESCRIPTION="Simple Apogee CCD management tool"
HOMEPAGE="https://github.com/eddyem/apogee_control"
SRC_URI=""
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="bta png raw imview"
DEPEND="
bta? ( sci-libs/libsla )
png? ( media-libs/libpng )
sci-libs/libapogee
sci-libs/apogeec
sci-libs/cfitsio
"
RDEPEND="${DEPEND}"
S="${WORKDIR}"
APD="/home/eddy/C-files/apogee_control"
src_unpack() {
cp ${APD}/*.{c,h,txt,cmake} ${S} || die
cp -r ${APD}/image_view_module ${S} || die
cp -r ${APD}/locale ${S} || die
}
CMAKE_USE_DIR="${S}"
BUILD_DIR=${S}
src_configure() {
local mycmakeargs=(
"-DCMAKE_INSTALL_PREFIX=/usr/local"
"-DUSE_BTA=$(usex bta)"
"-DUSE_PNG=$(usex png)"
"-DUSE_RAW=$(usex raw)"
"-DUSE_IMAGEVIEW=$(usex imview)"
)
#cmake ${mycmakeargs} .
cmake-utils_src_configure
}

View File

@ -0,0 +1 @@
EBUILD apogeec-0.1.ebuild 640 BLAKE2B aaccde418f2fd4a94b183b0581631aa502471517788207f5377e92d6079a0a8182c8110a059b702fd8767593fb641c3bb2f49fa10546a7f782d6693ae6656da5 SHA512 f5e4e9ac8d28109c4ed4e4c0d8c44930f7069a2ab8e78c718c1ceeee33676cf342765d31560dfc224772aecf4d80edb2be83610d71bbb87b53a3cf1b7cd7ab53

View File

@ -0,0 +1,35 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit cmake-utils
DESCRIPTION="libapogee C wrapper"
HOMEPAGE="https://github.com/eddyem/apogee_control/tree/master/apogee_C_wrapper"
SRC_URI=""
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
DEPEND="
sci-libs/libapogee
"
RDEPEND="${DEPEND}"
S="${WORKDIR}"
src_unpack() {
cp -r /home/eddy/C-files/apogee_control/apogee_C_wrapper/* ${S} || die
}
CMAKE_USE_DIR="${S}"
BUILD_DIR=${S}
src_configure() {
local mycmakeargs=(
"-DCMAKE_INSTALL_PREFIX=/usr/local"
)
cmake-utils_src_configure
}

View File

@ -0,0 +1 @@
EBUILD libapogee-3.0.3179.ebuild 634 BLAKE2B 8541bd61810babc8c55e9855318652ed93f0b1434ea153cce9835f1b5c76a744acfaef57c2d5a82ca180fd4d77cbe81e3b515098f7128c56d4e0997f769e3cc6 SHA512 a2fe563ba97dd0037795a19a59168379f02a6d12cc12ad13c6868a1461ee58e9245498eeeb3c32203a311ba98b775a33842475bb0d12f0e90e0be8765b6b166c

View File

@ -0,0 +1,36 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit unpacker
DESCRIPTION="Apogee CCD SDK"
HOMEPAGE=""
SRC_URI=""
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE=""
DEPEND=""
RDEPEND="${DEPEND}"
S="${WORKDIR}/libapogee-3.0.3179"
src_unpack() {
tar -zxf /home/eddy/C-files/apogee_control/libapogee/libapogee-3.0.3179.tgz
}
src_configure() {
econf || die "econf failed"
}
#src_install() {
# insinto /usr/local/lib
# doins libfli.a
# insinto /usr/local/include
# doins libfli.h
# insinto /usr/share/pkgconfig
# doins fli.pc
#}

View File

@ -0,0 +1 @@
EBUILD libsla-7.0.0.ebuild 646 BLAKE2B 4e98c6bcc7a5c327ba2f7c936f4e77df0b6872debe04965a291c454464f6f1efc730d41e864e9547b7026f3777e5e01881d145c6857e0c24547cbf1e4f958392 SHA512 37b02e5adfe34ae0bdf0b5b76539fb7f944a4b974af7da99cc32f6c80e1620041d334bbd7d6486afd994080acd1d9ac1c377a9f8bbcd990c22aab6bd378b029d

View File

@ -0,0 +1,33 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit unpacker
DESCRIPTION="Old SLA astronomy calculations library. DEPRECATED! Don't use it in new projects. Use libnova or libsofa instead."
HOMEPAGE=""
SRC_URI=""
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE=""
DEPEND=""
RDEPEND="${DEPEND}"
S="${WORKDIR}"
src_unpack() {
cp -r /home/eddy/C-files/apogee_control/slalib/* ${S} || die
}
src_install() {
insinto /usr/local/lib
doins libsla.so
insinto /usr/local/include
doins slalib.h slamac.h
insinto /usr/share/pkgconfig
doins sla.pc
}

View File

@ -41,4 +41,4 @@ clean:
install:
cp sla.pc /usr/share/pkgconfig
cp libsla$(LIBSUFFIX) /usr/lib
cp slamac.h /usr/include
cp slamac.h slalib.h /usr/include