Add a postinstall script for the linux packages, permit the use of -p instead of -printresult for the ybcon arguments, and change the installation directory to /opt/bin.
This commit is contained in:
parent
b7fb2fdf6c
commit
69a50e1e79
|
@ -40,9 +40,12 @@ add_executable(ybcon src/main.cpp resources/Yerbacon.rc src/parser/MainParse.cpp
|
|||
|
||||
# lpkg = linux package, wpkg = windows package
|
||||
if (UNIX AND NOT MINGW)
|
||||
set(CPACK_PACKAGING_INSTALL_PREFIX "/opt")
|
||||
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}_lpkg")
|
||||
set(CPACK_SYSTEM_NAME "Linux-${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}")
|
||||
set(CPACK_TOPLEVEL_TAG "Linux-${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}")
|
||||
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/scripts/postinst.sh")
|
||||
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE ${CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA})
|
||||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
||||
set(CPACK_RPM_PACKAGE_AUTOREQ YES)
|
||||
set(CPACK_RPM_PACKAGE_LICENSE "MPL-2.0")
|
||||
|
@ -51,7 +54,7 @@ if (UNIX AND NOT MINGW)
|
|||
if (NOT DEFINED CPACK_GENERATOR)
|
||||
set(CPACK_GENERATOR TGZ;STGZ;DEB;RPM)
|
||||
endif()
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ybcon
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ybcon ${CMAKE_CURRENT_SOURCE_DIR}/scripts/ybcon.sh
|
||||
PERMISSIONS
|
||||
OWNER_WRITE
|
||||
OWNER_EXECUTE
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/sh
|
||||
|
||||
ln -sf /opt/bin/ybcon.sh /usr/bin/ybcon
|
|
@ -0,0 +1,54 @@
|
|||
#!/bin/sh
|
||||
|
||||
# ybcon start script
|
||||
|
||||
EXENAME=ybcon
|
||||
|
||||
# Default location of the executable
|
||||
defaultBinLocation=/opt/bin/ybcon
|
||||
|
||||
usage() {
|
||||
echo "$EXENAME [-h|--help] [-p|-printresult] file"
|
||||
echo " -h or --help What you're seeing right now"
|
||||
echo " -p or -printresult Prints the transpilation result to stdout"
|
||||
}
|
||||
|
||||
args="";
|
||||
run=false;
|
||||
|
||||
newArgs() {
|
||||
if [ "$args" = "" ]; then
|
||||
args="$args$1"
|
||||
else
|
||||
args="$args $1"
|
||||
fi
|
||||
}
|
||||
|
||||
for it in "$@"
|
||||
do
|
||||
case "$it" in
|
||||
-h | --help )
|
||||
echo "Usage:"
|
||||
usage
|
||||
exit 0 ;;
|
||||
-p | -printresult )
|
||||
newArgs "$it"
|
||||
shift ;;
|
||||
*.ybcon )
|
||||
newArgs "$it"
|
||||
run=true
|
||||
break ;;
|
||||
* )
|
||||
usage ;;
|
||||
esac
|
||||
done
|
||||
|
||||
runIt() { eval "$1" " $args"; }
|
||||
|
||||
if [ "$run" = true ]; then
|
||||
if [ -f $defaultBinLocation ]; then
|
||||
runIt "$defaultBinLocation"
|
||||
elif [ -f ybcon ]; then
|
||||
runIt "./ybcon"
|
||||
fi
|
||||
fi
|
|
@ -18,7 +18,7 @@ int main(int argc, char* argv[]) {
|
|||
for (int i = 0; i < argc; i++)
|
||||
{
|
||||
currentArg = ((string) argv[i]);
|
||||
if (currentArg == "-printresult") printResult = true;
|
||||
if ((currentArg == "-printresult") || (currentArg == "-p")) printResult = true;
|
||||
else if (currentArg.starts_with("--target=")) target = '.' + currentArg.erase(0, 9);
|
||||
}
|
||||
const string parsedString = parseString(make_unique<string>(getFileContent(fileName)));
|
||||
|
|
Loading…
Reference in New Issue