diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..552d72a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,75 @@ +language: c + +branches: + only: + - master + - /^hptsqfix-.*/ +matrix: + fast_finish: true + include: + - os: linux + env: + - MATRIX_EVAL="CC=gcc" CF=-DBUILD_SHARED_LIBS=OFF ARCH="x86_64" + - os: linux + env: + - MATRIX_EVAL="CC='gcc -m32'" CF="-DBUILD_SHARED_LIBS=OFF -DCMAKE_LIBRARY_PATH=/usr/lib32" + PACKAGES="gcc-multilib lib32z1-dev" ARCH="i686" + - os: osx + env: + - MATRIX_EVAL="CC=gcc" CF=-DBUILD_SHARED_LIBS=OFF ARCH="x86_64" + - os: osx + env: + - MATRIX_EVAL="CC='gcc -m32'" CF=-DBUILD_SHARED_LIBS=OFF ARCH="i686" +before_install: + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y rpm; fi + - git clone https://github.com/huskyproject/huskylib ~/build/huskyproject/huskylib + - git clone https://github.com/huskyproject/smapi ~/build/huskyproject/smapi + - git clone https://github.com/huskyproject/fidoconf ~/build/huskyproject/fidoconf + - if [ -n "$PACKAGES" ]; then travis_retry sudo apt-get install --no-install-recommends + --no-upgrade -qq $PACKAGES; fi +script: + - eval "${MATRIX_EVAL}" + - cd ~/build/huskyproject/huskylib + - mkdir build + - cd build + - cmake .. ${CF} + - cmake --build . + - sudo make install + - cd ~/build/huskyproject/smapi + - mkdir build + - cd build + - cmake .. ${CF} + - cmake --build . + - sudo make install + - cd ~/build/huskyproject/fidoconf + - mkdir build + - cd build + - cmake .. ${CF} + - cmake --build . + - sudo make install + - cd $TRAVIS_BUILD_DIR + - mkdir build + - cd build + - cmake .. ${CF} -DCPACK_DEBIAN_PACKAGE_MAINTAINER=travis-ci + - cmake --build . + - cpack + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cpack -G RPM; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cpack -G DEB; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then for file in *.rpm; do mv $file + $(basename $file .rpm).${ARCH}.rpm; done; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then for file in *.deb; do mv $file + $(basename $file .deb).${ARCH}.deb; done; fi + - for file in *.tar.gz; do mv $file $(basename $file .tar.gz).${ARCH}.tar.gz; + done +deploy: + provider: releases + api_key: $GITHUB_OAUTH_TOKEN + file_glob: true + skip_cleanup: true + file: + - $TRAVIS_BUILD_DIR/build/*.rpm + - $TRAVIS_BUILD_DIR/build/*.deb + - $TRAVIS_BUILD_DIR/build/*.tar.gz + on: + tags: true + branch: master diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..94dc9ca --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,72 @@ +cmake_minimum_required(VERSION 2.8.11) +PROJECT(hptsqfix C) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +option(BUILD_SHARED_LIBS "Build shared libs" ON) + +if(CMAKE_BUILD_TYPE MATCHES Debug) + ADD_DEFINITIONS(-g -DDEBUG -D_DEBUG) + set(CMAKE_CONFIGURATION_TYPES "Debug" CACHE STRING "My multi config types" FORCE) +else(CMAKE_BUILD_TYPE MATCHES Debug) + ADD_DEFINITIONS(-DNDEBUG) + set(CMAKE_CONFIGURATION_TYPES "Release" CACHE STRING "My multi config types" FORCE) +endif(CMAKE_BUILD_TYPE MATCHES Debug) + +if (MSVC) + if (BUILD_SHARED_LIBS) + ADD_DEFINITIONS(-D_DLL -D_MAKE_DLL) + endif() + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../out/lib") + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../out/bin") + ADD_DEFINITIONS(-DWIN32 -D_WINDOWS -D_CONSOLE -D_CRT_SECURE_NO_WARNINGS) + include_directories("${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/h;${CMAKE_CURRENT_SOURCE_DIR}/../huskylib;${CMAKE_CURRENT_SOURCE_DIR}/../fidoconf;${CMAKE_CURRENT_SOURCE_DIR}/../smapi;") + if(CMAKE_BUILD_TYPE MATCHES Debug) + list( APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../out/lib/Debug" ) + else(CMAKE_BUILD_TYPE MATCHES Debug) + list( APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../out/lib/Release" ) + endif(CMAKE_BUILD_TYPE MATCHES Debug) +else () + if (NOT BUILD_SHARED_LIBS) + SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + endif() + include_directories("h") + ADD_DEFINITIONS(-Wall -DUNIX) +endif (MSVC) + +find_library(husky_LIB NAMES husky PATHS "${CMAKE_FIND_ROOT_PATH}") +find_library(fidoconfig_LIB NAMES fidoconfig PATHS "${CMAKE_FIND_ROOT_PATH}") +find_library(smapi_LIB NAMES smapi PATHS "${CMAKE_FIND_ROOT_PATH}") + +message("-------------------------") +message("System : ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION}") +message("Compiler : ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}") +message("Prefix : ${CMAKE_INSTALL_PREFIX} (run \"cmake . -DCMAKE_INSTALL_PREFIX:PATH=/other\" for other prefix)") +message("libhusky : ${husky_LIB}") +message("libfidoconfig : ${fidoconfig_LIB}") +message("libsmapi : ${smapi_LIB}") +message("Build shared : ${BUILD_SHARED_LIBS}") +message("Build type : ${CMAKE_CONFIGURATION_TYPES}") +message("-------------------------") + +ADD_EXECUTABLE(hptsqfix + src/hptsqfix.c +) +target_link_libraries(hptsqfix ${fidoconfig_LIB} ${smapi_LIB} ${husky_LIB}) + + INSTALL(TARGETS hptsqfix + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ) +if (NOT MSVC) + set(CPACK_GENERATOR ${CPACK_GENERATOR} TGZ) +else() + set(CPACK_GENERATOR ${CPACK_GENERATOR} 7Z) +endif (NOT MSVC) + +set (CPACK_STRIP_FILES TRUE) +set (CPACK_PACKAGE_VERSION_MAJOR "1") +set (CPACK_PACKAGE_VERSION_MINOR "9") +file(READ h/cvsdate.h CPACK_PACKAGE_VERSION_PATCH LIMIT 10 OFFSET 17) +string(SUBSTRING ${CPACK_PACKAGE_VERSION_PATCH} 0 10 CPACK_PACKAGE_VERSION_PATCH) +string(REGEX REPLACE "-" "" CPACK_PACKAGE_VERSION_PATCH ${CPACK_PACKAGE_VERSION_PATCH}) +INCLUDE(CPack) diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..222f6d1 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,37 @@ +version: '{build}' +branches: + only: + - master + - /^hptsqfix-.*/ +image: + - Visual Studio 2017 +environment: + matrix: + - generator: Visual Studio 15 2017 + cf: -DBUILD_SHARED_LIBS=OFF + - generator: Visual Studio 15 2017 + cf: -DBUILD_SHARED_LIBS=ON + - generator: Visual Studio 15 2017 Win64 + cf: -DBUILD_SHARED_LIBS=OFF + - generator: Visual Studio 15 2017 Win64 + cf: -DBUILD_SHARED_LIBS=ON +install: + - cmd: git clone https://github.com/huskyproject/huskylib C:\projects\huskylib + - cmd: git clone https://github.com/huskyproject/smapi C:\projects\smapi + - cmd: git clone https://github.com/huskyproject/fidoconf C:\projects\fidoconf +build_script: + - cmd: + cd C:\projects\huskylib && mkdir build && cd build && cmake --version && cmake .. -G "%GENERATOR%" "%CF%" && cmake --build . -- /P:Configuration=Release && + cd C:\projects\smapi && mkdir build && cd build && cmake --version && cmake .. -G "%GENERATOR%" "%CF%" && cmake --build . -- /P:Configuration=Release && + cd C:\projects\fidoconf && mkdir build && cd build && cmake --version && cmake .. -G "%GENERATOR%" "%CF%" && cmake --build . -- /P:Configuration=Release && + cd C:\projects\hptsqfix && mkdir build && cd build && cmake --version && cmake .. -G "%GENERATOR%" "%CF%" && cmake --build . -- /P:Configuration=Release + - if ["%CF%"]==["-DBUILD_SHARED_LIBS=OFF"] (cpack) +artifacts: + - path: build\*.7z + name: dist +deploy: + provider: GitHub + artifact: dist + auth_token: $(GITHUB_OAUTH_TOKEN) + on: + appveyor_repo_tag: true diff --git a/h/cvsdate.h b/h/cvsdate.h index 93a0658..ab950fd 100644 --- a/h/cvsdate.h +++ b/h/cvsdate.h @@ -1 +1 @@ -char cvs_date[]="04-05-17"; +char cvs_date[]="2017-05-04";