Installer works on Linux via command line script build.sh. Based on legacy projects needs refactoring. (./build.sh 0.0.3 linux GenericQtClient org.working_copy.genericQtClient)
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -81,3 +81,4 @@ CMakeLists.txt.user*
|
||||
.uic/
|
||||
/build*/
|
||||
_build*/
|
||||
_output/*
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
set(TARGET_APP "GenericQtClient")
|
||||
project(${TARGET_APP} VERSION 0.0.1 LANGUAGES CXX)
|
||||
project(${TARGET_APP} VERSION 0.0.3 LANGUAGES CXX)
|
||||
|
||||
enable_testing()
|
||||
|
||||
@ -11,8 +11,39 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
add_subdirectory(libs/GenericCore)
|
||||
set (CORE_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libs/GenericCore)
|
||||
|
||||
# Frontend applications
|
||||
#Frontend applications
|
||||
add_subdirectory(UIs/GenericWidgets)
|
||||
|
||||
### Tests
|
||||
add_subdirectory(tests/GenericCoreTests)
|
||||
|
||||
### Qt installer
|
||||
set(PACKAGE_FOLDER "genericQtClient")
|
||||
set(TARGET_PACKAGE "org.working_copy.${PACKAGE_FOLDER}")
|
||||
set(CONFIG_REPO_URL ".../${PACKAGE_FOLDER}")
|
||||
set(PUSH_REPO_URL ".../${PACKAGE_FOLDER}")
|
||||
string(TIMESTAMP CURRENT_DATE "%Y-%m-%d")
|
||||
set(PLATFORM "linux")
|
||||
|
||||
set(BASH_COMMAND)
|
||||
|
||||
### quick fix for config.xml.in and installscript.qs.in:
|
||||
set(ApplicationsDir @ApplicationsDir@)
|
||||
set(TargetDir @TargetDir@)
|
||||
set(DesktopDir @DesktopDir@)
|
||||
set(HomeDir @HomeDir@)
|
||||
### end of quick fix
|
||||
|
||||
configure_file(installer/config/config.xml.in installer/config/config.xml)
|
||||
configure_file(installer/packages/defaultPackage/meta/package.xml.in installer/packages/${TARGET_PACKAGE}/meta/package.xml)
|
||||
configure_file(installer/packages/defaultPackage/meta/installscript.qs.in installer/packages/${TARGET_PACKAGE}/meta/installscript.qs)
|
||||
# configure_file(installer/packages/defaultPackage/meta/license.txt.in installer/packages/${TARGET_PACKAGE}/meta/license.txt)
|
||||
|
||||
# add_custom_command(
|
||||
# OUTPUT installer/config/config.xml
|
||||
# COMMAND ${BASH_COMMAND} ${CMAKE_CURRENT_SOURCE_DIR}/installer/script.sh ${PROJECT_VERSION} linux ${TARGET_APP} ${TARGET_PACKAGE}
|
||||
# )
|
||||
|
||||
# add_custom_target(installer ALL
|
||||
# DEPENDS installer/config/config.xml
|
||||
# )
|
||||
|
||||
Submodule UIs/GenericWidgets updated: 641cf02db4...9c67fdabdc
4
installer/.env
Normal file
4
installer/.env
Normal file
@ -0,0 +1,4 @@
|
||||
# ssh url of the packages directory of the repo
|
||||
PROJECT_FOLDER=""
|
||||
export CONFIG_REPO_URL="/${PROJECT_FOLDER}"
|
||||
export PUSH_REPO_URL="/${PROJECT_FOLDER}"
|
||||
52
installer/build.sh
Executable file
52
installer/build.sh
Executable file
@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo amount of arguments: $#
|
||||
|
||||
if [[ $# -ne 4 ]]; then
|
||||
echo "Build script has to be called with exactly two arguments."
|
||||
echo "The version number (Major.Minor.Patch) as its first argument."
|
||||
echo "... and the OS (linux, windows or macos) as the second argument"
|
||||
echo "TODO: DOCUMENT ARGUMENTS 3 & 4!!!"
|
||||
echo "Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=$1
|
||||
regex='^([0-9]+\.){0,2}(\*|[0-9]+)$'
|
||||
if [[ $VERSION =~ $regex ]]; then
|
||||
echo "Version accepted: $VERSION"
|
||||
else
|
||||
echo "Version '$VERSION' is not acceptable. Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PLATFORM=$2
|
||||
# TODO refactor this to use something like PLATFORMS.contains(PLATFORM)
|
||||
if [[ $PLATFORM == linux ]]; then
|
||||
echo "OS: $PLATFORM"
|
||||
elif [[ $PLATFORM == windows ]]; then
|
||||
echo "OS: $PLATFORM"
|
||||
elif [[ $PLATFORM == macos ]]; then
|
||||
echo "OS: $PLATFORM"
|
||||
else
|
||||
echo "Platform '$PLATFORM' is not acceptable. Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#if [[ ! -e .env ]]; then
|
||||
# echo "File .env not found. Aborting..."
|
||||
# exit 1
|
||||
#fi
|
||||
#echo "Sourcing .env file..."
|
||||
#source .env
|
||||
|
||||
echo "calling the compile-executable.sh..."
|
||||
./compile-executable.sh $1 $2 $3 $4
|
||||
|
||||
echo "calling the create-installer.sh..."
|
||||
./create-installer.sh $1 $2 $3 $4
|
||||
|
||||
echo "calling the deployToRepo.sh..."
|
||||
./deployToRepo.sh $1 $2 $3 $4
|
||||
|
||||
cd ${OLD_PWD}
|
||||
59
installer/compile-executable.sh
Executable file
59
installer/compile-executable.sh
Executable file
@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo amount of arguments: $#
|
||||
|
||||
if [[ $# -ne 4 ]]; then
|
||||
echo "Build script has to be called with exactly two arguments."
|
||||
echo "The version number (Major.Minor.Patch) as its first argument."
|
||||
echo "... and the OS (linux, windows or macos) as the second argument"
|
||||
echo "TODO: DOCUMENT ARGUMENTS 3 & 4!!!"
|
||||
echo "Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=$1
|
||||
regex='^([0-9]+\.){0,2}(\*|[0-9]+)$'
|
||||
if [[ $VERSION =~ $regex ]]; then
|
||||
echo "Version accepted: $VERSION"
|
||||
else
|
||||
echo "Version '$VERSION' is not acceptable. Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PLATFORM=$2
|
||||
# TODO refactor this to use something like PLATFORMS.contains(PLATFORM)
|
||||
if [[ $PLATFORM == linux ]]; then
|
||||
echo "OS: $PLATFORM"
|
||||
#QMAKE_EXE="qmake"
|
||||
COMPILER_EXE="make"
|
||||
elif [[ $PLATFORM == windows ]]; then
|
||||
echo "OS: $PLATFORM"
|
||||
#QMAKE_EXE="$QMAKE_LOCATION/qmake"
|
||||
#COMPILER_EXE="$MINGWROOT/bin/mingw32-make"
|
||||
elif [[ $PLATFORM == macos ]]; then
|
||||
echo "OS: $PLATFORM"
|
||||
#QMAKE_EXE="qmake"
|
||||
COMPILER_EXE="make"
|
||||
else
|
||||
echo "Platform '$PLATFORM' is not acceptable. Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Starting build ..."
|
||||
OLD_PWD=$(pwd)
|
||||
BUILD_DIR="_build"
|
||||
echo "starting in: ${OLD_PWD}"
|
||||
|
||||
# if [[ -e $BUILD_DIR/$TARGET ]]; then
|
||||
# echo "old build dir has old content, cleaning the build directory..."
|
||||
# rm -r $BUILD_DIR/*
|
||||
# fi
|
||||
cd $BUILD_DIR
|
||||
echo "Building in $(pwd) ..."
|
||||
|
||||
echo "Building whole project..."
|
||||
echo "Running CMake..."
|
||||
cmake -DCMAKE_BUILD_TYPE=Release ../../
|
||||
|
||||
echo "Compiling..."
|
||||
$COMPILER_EXE
|
||||
16
installer/config/config.xml.in
Normal file
16
installer/config/config.xml.in
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Installer>
|
||||
<Name>${PROJECT_NAME}</Name>
|
||||
<Version>1.0.0</Version>
|
||||
<Title>${PROJECT_NAME} Installer</Title>
|
||||
<Publisher>Working-Copy Collective</Publisher>
|
||||
<StartMenuDir>Utilities</StartMenuDir>
|
||||
<TargetDir>@ApplicationsDir@/${PROJECT_NAME}</TargetDir>
|
||||
<RemoteRepositories>
|
||||
<Repository>
|
||||
<Url>${CONFIG_REPO_URL}/${PLATFORM}/packages</Url>
|
||||
<Enabled>1</Enabled>
|
||||
<DisplayName>The ${PROJECT_NAME} repository</DisplayName>
|
||||
</Repository>
|
||||
</RemoteRepositories>
|
||||
</Installer>
|
||||
112
installer/create-installer.sh
Executable file
112
installer/create-installer.sh
Executable file
@ -0,0 +1,112 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ $# -ne 4 ]]; then
|
||||
echo "Build script has to be called with exactly two arguments."
|
||||
echo "The version number (Major.Minor.Patch) as its first argument."
|
||||
echo "... and the OS (linux, windows or macos) as the second argument"
|
||||
echo "TODO: DOCUMENT ARGUMENTS 3 & 4!!!"
|
||||
echo "Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=$1
|
||||
regex='^([0-9]+\.){0,2}(\*|[0-9]+)$'
|
||||
if [[ $VERSION =~ $regex ]]; then
|
||||
echo "Version accepted: $VERSION"
|
||||
else
|
||||
echo "Version '$VERSION' is not acceptable. Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PLATFORM=$2
|
||||
TARGET=$3
|
||||
EXECUTABLE="$TARGET-Widgets"
|
||||
BUILD_PREFIX="_build/UIs/GenericWidgets"
|
||||
# TODO refactor this to use PLATFORMS.contains(PLATFORM)
|
||||
if [[ $PLATFORM == linux ]]; then
|
||||
echo "OS: $PLATFORM"
|
||||
BUILD_DIR=$BUILD_PREFIX
|
||||
elif [[ $PLATFORM == windows ]]; then
|
||||
echo "OS: $PLATFORM"
|
||||
BUILD_DIR="$BUILD_PREFIX/release"
|
||||
elif [[ $PLATFORM == macos ]]; then
|
||||
echo "OS: $PLATFORM"
|
||||
BUILD_DIR=$BUILD_PREFIX
|
||||
else
|
||||
echo "Version '$PLATFORM' is not acceptable. Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#if [[ ! -e .env ]]; then
|
||||
# echo "File .env not found. Aborting..."
|
||||
# exit 1
|
||||
#fi
|
||||
#echo "Sourcing .env file..."
|
||||
#source .env
|
||||
|
||||
PACKAGENAME=$4
|
||||
INSTALLER_DIR="_build/installer"
|
||||
PKG_DATA_DIR="$INSTALLER_DIR/packages/$PACKAGENAME/data"
|
||||
PKG_META_DIR="$INSTALLER_DIR/packages/$PACKAGENAME/meta"
|
||||
ASSET_DIR="../assets/icons"
|
||||
OUTPUT_DIR="../_output/installer"
|
||||
|
||||
if [[ -e $PKG_DATA_DIR/$TARGET ]]; then
|
||||
echo "old $TARGET exe exists, cleaning the package data directory..."
|
||||
rm -r $PKG_DATA_DIR/*
|
||||
fi
|
||||
|
||||
if [[ ! -d $PKG_DATA_DIR ]]; then
|
||||
echo "creating package data folder..."
|
||||
mkdir -p $PKG_DATA_DIR
|
||||
fi
|
||||
|
||||
mv $INSTALLER_DIR/packages/meta $PKG_META_DIR
|
||||
|
||||
echo "copying executable..."
|
||||
if [[ $PLATFORM == macos ]]; then
|
||||
cp -r $BUILD_DIR/$EXECUTABLE.app $PKG_DATA_DIR/$TARGET.app
|
||||
else
|
||||
cp $BUILD_DIR/$EXECUTABLE $PKG_DATA_DIR/$TARGET
|
||||
fi
|
||||
|
||||
echo "copying assets..."
|
||||
cp $ASSET_DIR/$TARGET.png $PKG_DATA_DIR/$TARGET.png
|
||||
|
||||
echo "copying license..."
|
||||
cp ../LICENSE $PKG_META_DIR/license.txt
|
||||
|
||||
### Platform dependencies
|
||||
echo "Applying platform dependencies..."
|
||||
INSTALLER_APPENDIX="installer"
|
||||
if [[ $PLATFORM == linux ]]; then
|
||||
echo "Linux..."
|
||||
# echo "Patching the config.xml"
|
||||
# sed -i "s/<PLATFORM>/$PLATFORM/g" config/config.xml
|
||||
elif [[ $PLATFORM == windows ]]; then
|
||||
echo "Windows..."
|
||||
cd $PKG_DATA_DIR
|
||||
echo "Copying OpenSSL dlls..."
|
||||
cp /c/Qt/Tools/OpenSSL/Win_x64/bin/libcrypto-1_1-x64.dll .
|
||||
cp /c/Qt/Tools/OpenSSL/Win_x64/bin/libssl-1_1-x64.dll .
|
||||
echo "Calling windeployqt..."
|
||||
$QMAKE_LOCATION/windeployqt $TARGET.exe
|
||||
cd -
|
||||
# echo "Patching the config.xml"
|
||||
# sed -i "s/<PLATFORM>/$PLATFORM/g" config/config.xml
|
||||
elif [[ $PLATFORM == macos ]]; then
|
||||
echo "MacOS..."
|
||||
echo "Calling macdeployqt..."
|
||||
INSTALLER_APPENDIX="installer.dmg"
|
||||
cd $PKG_DATA_DIR
|
||||
macdeployqt $TARGET.app
|
||||
cd -
|
||||
# echo "Patching the config.xml..."
|
||||
# sed -i '' "s/<PLATFORM>/$PLATFORM/g" config/config.xml
|
||||
fi
|
||||
|
||||
|
||||
echo "running binarycreator..."
|
||||
#echo "$QIF_LOCATION/binarycreator"
|
||||
binarycreator -n -c $INSTALLER_DIR/config/config.xml -p $INSTALLER_DIR/packages $OUTPUT_DIR/$TARGET-$PLATFORM-$VERSION-$INSTALLER_APPENDIX-online
|
||||
binarycreator -f -c $INSTALLER_DIR/config/config.xml -p $INSTALLER_DIR/packages $OUTPUT_DIR/$TARGET-$PLATFORM-$VERSION-$INSTALLER_APPENDIX-offline
|
||||
44
installer/deployToRepo.sh
Executable file
44
installer/deployToRepo.sh
Executable file
@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo amount of arguments: $#
|
||||
|
||||
if [[ $# -ne 4 ]]; then
|
||||
echo "Build script has to be called with exactly two arguments."
|
||||
echo "The version number (Major.Minor.Patch) as its first argument."
|
||||
echo "... and the OS (linux, windows or macos) as the second argument"
|
||||
echo "TODO: DOCUMENT ARGUMENTS 3 & 4!!!"
|
||||
echo "Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=$1
|
||||
regex='^([0-9]+\.){0,2}(\*|[0-9]+)$'
|
||||
if [[ $VERSION =~ $regex ]]; then
|
||||
echo "Version accepted: $VERSION"
|
||||
else
|
||||
echo "Version '$VERSION' is not acceptable. Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -e .env ]]; then
|
||||
exit 1
|
||||
fi
|
||||
echo "Sourcing .env file..."
|
||||
source .env
|
||||
|
||||
PACKAGENAME=$4
|
||||
|
||||
PLATFORM=$2
|
||||
|
||||
PACKAGE_DIR="_build/installer/packages"
|
||||
OUTPUT_DIR="../_output/repository"
|
||||
echo "executing repo-gen..."
|
||||
repogen --update -p $PACKAGE_DIR $OUTPUT_DIR
|
||||
|
||||
if [[ $PUSH_REPO_URL != "" ]]; then
|
||||
echo "pushing package data to repo..."
|
||||
echo "PUSH_REPO_URL: $PUSH_REPO_URL"
|
||||
scp -r $OUTPUT_DIR/* $PUSH_REPO_URL/$PLATFORM/packages/
|
||||
fi
|
||||
|
||||
cd ${OLD_PWD}
|
||||
24
installer/packages/defaultPackage/meta/installscript.qs.in
Normal file
24
installer/packages/defaultPackage/meta/installscript.qs.in
Normal file
@ -0,0 +1,24 @@
|
||||
function Component() {}
|
||||
|
||||
Component.prototype.isDefault = function() {
|
||||
return true;
|
||||
}
|
||||
|
||||
Component.prototype.createOperations = function() {
|
||||
|
||||
try {
|
||||
component.createOperations();
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
|
||||
if (installer.value("os") === "win")
|
||||
{
|
||||
component.addOperation("CreateShortcut", "@TargetDir@/${PROJECT_NAME}.exe", "@DesktopDir@/${PROJECT_NAME}.lnk");
|
||||
}
|
||||
if (installer.value("os") === "x11")
|
||||
{
|
||||
component.addOperation("CreateDesktopEntry", "/usr/share/applications/${PROJECT_NAME}.desktop", "Version=1.0\nType=Application\nTerminal=false\nCategories=Utility\nExec=@TargetDir@/${PROJECT_NAME}\nName=${PROJECT_NAME}\nIcon=@TargetDir@/${PROJECT_NAME}.png\nName[en_US]=${PROJECT_NAME}");
|
||||
//component.addElevatedOperation("Copy", "/usr/share/applications/${PROJECT_NAME}.desktop", "@HomeDir@/Desktop/${PROJECT_NAME}.desktop");
|
||||
}
|
||||
}
|
||||
1
installer/packages/defaultPackage/meta/license.txt.in
Normal file
1
installer/packages/defaultPackage/meta/license.txt.in
Normal file
@ -0,0 +1 @@
|
||||
The fantastic license, have you heard of the Tea Public License Agreement yet?
|
||||
13
installer/packages/defaultPackage/meta/package.xml.in
Normal file
13
installer/packages/defaultPackage/meta/package.xml.in
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Package>
|
||||
<DisplayName>The application itself</DisplayName>
|
||||
<Description>Installs the ${PROJECT_NAME} executable.</Description>
|
||||
<Version>${PROJECT_VERSION}</Version>
|
||||
<ReleaseDate>${CURRENT_DATE}</ReleaseDate>
|
||||
<Licenses>
|
||||
<License name="GNU General Public License Agreement" file="license.txt" />
|
||||
</Licenses>
|
||||
<ForcedInstallation>true</ForcedInstallation>
|
||||
<Default>script</Default>
|
||||
<Script>installscript.qs</Script>
|
||||
</Package>
|
||||
Reference in New Issue
Block a user