Skip to content

Commit

Permalink
Modfiy rules and CMakeLists.
Browse files Browse the repository at this point in the history
If install RabbitCommon develp kits. the install to /usr
If use RabbitCommon source code. the install to /opt/LunarCalendar
  • Loading branch information
KangLin committed Jun 19, 2024
1 parent 487d8ed commit 978d7d0
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 23 deletions.
7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,10 @@ include(cmake/DownloadFile.cmake)
if(NOT RabbitCommon_DIR)
set(RabbitCommon_DIR $ENV{RabbitCommon_DIR})
if(NOT RabbitCommon_DIR)
set(RabbitCommon_DIR ${CMAKE_SOURCE_DIR}/../RabbitCommon)
endif()
if(NOT EXISTS ${RabbitCommon_DIR}/Src)
set(RabbitCommon_DIR ${CMAKE_SOURCE_DIR}/../../../RabbitCommon)
endif()
endif()
if(RabbitCommon_DIR AND EXISTS ${RabbitCommon_DIR}/Src)
if(RabbitCommon_DIR AND EXISTS ${RabbitCommon_DIR}/Src/CMakeLists.txt)
message("Use RabbitCommon source code")
add_subdirectory(${RabbitCommon_DIR}/Src ${CMAKE_BINARY_DIR}/RabbitCommon)
else()
Expand All @@ -98,7 +95,7 @@ endif()
GET_VERSION(OUT_VERSION LunarCalendar_VERSION
OUT_REVISION LunarCalendar_REVISION)
if(NOT LunarCalendar_VERSION)
SET(LunarCalendar_VERSION "v1.0.4")
SET(LunarCalendar_VERSION "1.0.4")
endif()
message("LunarCalendar_VERSION:${LunarCalendar_VERSION}")

Expand Down
2 changes: 1 addition & 1 deletion Src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ endif()
GET_VERSION(OUT_VERSION LunarCalendar_VERSION
OUT_REVISION LunarCalendar_REVISION)
if(NOT LunarCalendar_VERSION)
SET(LunarCalendar_VERSION "v1.0.4")
SET(LunarCalendar_VERSION "1.0.4")
endif()
message("LunarCalendar_VERSION:${LunarCalendar_VERSION}")
message("LunarCalendar_REVISION:${LunarCalendar_REVISION}")
Expand Down
4 changes: 1 addition & 3 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Priority: optional
Maintainer: Kang Lin <[email protected]>
Standards-Version: 4.6.2
Build-Depends: debhelper (>=13~), debhelper-compat (=13), fakeroot, cmake,
rabbitcommon-dev (>=2), qt6-tools-dev, qt6-tools-dev-tools,
rabbitcommon-dev(>=2.2.6), qt6-tools-dev, qt6-tools-dev-tools,
qt6-base-dev, qt6-base-dev-tools, qt6-l10n-tools,
qt6-translations-l10n, qt6-scxml-dev, qt6-webengine-dev,
qt6-webengine-dev-tools, libsqlite3-dev
Expand All @@ -22,7 +22,6 @@ Architecture: any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Depends: ${shlibs:Depends}, ${misc:Depends}
Replaces: rabbitcommon (>=2)
Description: The lunar calendar library using Qt
- A lunar calendar library of Qt GUI, support QSS.
+ solar calendar
Expand All @@ -46,7 +45,6 @@ Package: lunarcalendar-dev
Section: libdevel
Architecture: any
Multi-Arch: same
Recommends: rabbitcommon-dev (>=2)
Depends: lunarcalendar (= ${binary:Version}), ${misc:Depends}
Description: The lunar calendar devel library using Qt
- A lunar calendar devel library of Qt GUI, support QSS.
Expand Down
22 changes: 15 additions & 7 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,17 @@ export DH_VERBOSE = 1
#export QT_SELECT=qt5

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
BUILD_DIR = "build_$(DEB_HOST_MULTIARCH)"
PACKAGE_DIR = "debian/lunarcalendar"
PACKAGE_dev_DIR = "debian/lunarcalendar-dev"
BUILD_DIR = build_$(DEB_HOST_MULTIARCH)
PACKAGE_DIR = debian/lunarcalendar
PACKAGE_DEV_DIR = debian/lunarcalendar-dev

ifeq ($(strip $(shell pkg-config --libs RabbitCommon)), -lRabbitCommon)
PACKAGE_PREFIX = $(PACKAGE_DIR)/usr
PACKAGE_DEV_PREFIX = $(PACKAGE_DEV_DIR)/usr
else
PACKAGE_PREFIX = $(PACKAGE_DIR)/opt/LunarCalendar
PACKAGE_DEV_PREFIX = $(PACKAGE_DEV_DIR)/opt/LunarCalendar
endif

%:
dh $@
Expand All @@ -28,19 +36,19 @@ PACKAGE_dev_DIR = "debian/lunarcalendar-dev"
# This is example for Cmake (See https://bugs.debian.org/641051 )
override_dh_auto_configure:
dh_auto_configure -B$(BUILD_DIR) -- \
-DCMAKE_BUILD_TYPE=Release -DBUILD_APP=OFF
-DCMAKE_BUILD_TYPE=Release -DBUILD_APP=OFF

override_dh_auto_build:
cmake --build $(BUILD_DIR) --config Release --parallel $(if "`cat /proc/cpuinfo |grep 'cpu cores' |wc -l`", `cat /proc/cpuinfo |grep 'cpu cores' |wc -l`, 1)

override_dh_auto_install:
cmake --install $(BUILD_DIR) --config Release \
--component Runtime \
--prefix $(PACKAGE_DIR)/usr
--prefix $(PACKAGE_PREFIX)
cmake --install $(BUILD_DIR) --config Release \
--component Development \
--prefix $(PACKAGE_dev_DIR)/usr
--prefix $(PACKAGE_DEV_PREFIX)

override_dh_builddeb:
dh_builddeb --package=lunarcalendar -P$(PACKAGE_DIR)
dh_builddeb --package=lunarcalendar-dev -P$(PACKAGE_dev_DIR)
dh_builddeb --package=lunarcalendar-dev -P$(PACKAGE_DEV_DIR)
2 changes: 1 addition & 1 deletion debian/source/format
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0 (native)
3.0 (quilt)
27 changes: 21 additions & 6 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,37 @@ set -e

SOURCE_DIR=`pwd`

PRE_TAG=`git tag --sort=-creatordate | head -n 1`

if [ -n "$1" ]; then
VERSION=`git describe --tags`
if [ -z "$VERSION" ]; then
VERSION=` git rev-parse HEAD`
VERSION=`git rev-parse HEAD`
fi

echo "Current version: $VERSION, The version to will be set: $1"

if [ -n "$2" ]; then
MESSAGE="Release $1 $2"
else
MESSAGE="Release $1"
fi

PRE_TAG=`git tag --sort=-taggerdate | head -n 1`
echo "Current version: $VERSION, current tag: $PRE_TAG. The version to will be set tag version: $1 message: $MESSAGE"
echo "Please check the follow list:"
echo " - Test is ok ?"
echo " - Translation is ok ?"
echo " - Setup file is ok ?"
echo " - Update_*.xml is ok ?"

read -t 30 -p "Be sure to input Y, not input N: " INPUT
if [ "$INPUT" != "Y" -a "$INPUT" != "y" ]; then
exit 0
fi
git tag -a $1 -m "Release $1"
git tag -a $1 -m "Release $1 ${MESSAGE}"
else
echo "Usage: $0 release_version [release_message]"
echo " release_version format: [v][0-9].[0-9].[0-9]"
exit -1
fi

VERSION=`git describe --tags`
Expand All @@ -42,8 +56,6 @@ EOF

#mkchangelog $VERSION ChangeLog.md

sed -i "s/ SET(LunarCalendar_VERSION.*/ SET(LunarCalendar_VERSION \"${VERSION}\")/g" ${SOURCE_DIR}/CMakeLists.txt
sed -i "s/ SET(LunarCalendar_VERSION.*/ SET(LunarCalendar_VERSION \"${VERSION}\")/g" ${SOURCE_DIR}/Src/CMakeLists.txt
sed -i "s/^\!define PRODUCT_VERSION.*/\!define PRODUCT_VERSION \"${VERSION}\"/g" ${SOURCE_DIR}/Install/Install.nsi
sed -i "s/^version: '.*{build}'/version: '${VERSION}.{build}'/g" ${SOURCE_DIR}/appveyor.yml
sed -i "s/^\ - export VERSION=.*/\ - export VERSION=\"${VERSION}\"/g" ${SOURCE_DIR}/.travis.yml
Expand All @@ -60,6 +72,9 @@ sed -i "s/v[0-9]\+\.[0-9]\+\.[0-9]\+/${VERSION}/g" ${SOURCE_DIR}/README*.md
DEBIAN_VERSION=`echo ${VERSION}|cut -d "v" -f 2`
#sed -i "s/lunarcalendar_[0-9]\+\.[0-9]\+\.[0-9]\+/lunarcalendar_${DEBIAN_VERSION}/g" ${SOURCE_DIR}/README*.md

sed -i "s/ SET(LunarCalendar_VERSION.*/ SET(LunarCalendar_VERSION \"${DEBIAN_VERSION}\")/g" ${SOURCE_DIR}/CMakeLists.txt
sed -i "s/ SET(LunarCalendar_VERSION.*/ SET(LunarCalendar_VERSION \"${DEBIAN_VERSION}\")/g" ${SOURCE_DIR}/Src/CMakeLists.txt

sed -i "s/lunarcalendar (.*)/lunarcalendar (${DEBIAN_VERSION})/g" ${SOURCE_DIR}/debian/changelog
sed -i "s/[0-9]\+\.[0-9]\+\.[0-9]\+/${DEBIAN_VERSION}/g" ${SOURCE_DIR}/App/android/AndroidManifest.xml
sed -i "s/LunarCalendar_VERSION:.*/LunarCalendar_VERSION: ${DEBIAN_VERSION}/g" ${SOURCE_DIR}/.github/workflows/ubuntu.yml
Expand Down

0 comments on commit 978d7d0

Please sign in to comment.