POSIX installation and configuration issues

git-svn-id: svn://ultimatepp.org/upp/trunk@14222 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2020-04-04 13:12:56 +00:00
parent 3661e61ed4
commit f5814aefb5
8 changed files with 91 additions and 30 deletions

View file

@ -125,6 +125,8 @@ CONSOLE_APP_MAIN
Syx(GetHomeDirFile("bin/umk") + " uppsrc umk GCC -rvsM");
SaveFile(release + "/uMakefile", LoadFile(release + "/Makefile"));
Syx(GetHomeDirFile("bin/umk") + " uppsrc ide GCC -rvsM theide");
system("cp " + GetHomeDirFile("upp.bin") + "/" + "*.udc " + release);
chdir(release_dir);

View file

@ -3,30 +3,35 @@ R"--(#!/usr/bin/env bash
AskContinue()
{
read -p "Continue (y/n)?" CONT
if ! [ "$CONT" = "y" ]; then
read -p "Continue (Y/n)?" answer
if [ "$answer" != "${answer//[nN]/x}" ]; then
exit;
fi
}
if [ -x "$(command -v apt-get)" ]; then
echo 'Debian packaging system (apt-get) detected'
DEP="apt-get -y install g++ clang make libgtk-3-dev libnotify-dev libbz2-dev libssl-dev"
DEP="apt-get install g++ clang make libgtk-3-dev libnotify-dev libbz2-dev libssl-dev"
fi
if [ -x "$(command -v yum)" ]; then
echo 'Fedora packaging system (yum) detected'
DEP="yum -y install gcc-c++ clang make gtk3-devel pango-devel atk-devel cairo-devel libnotify-devel bzip2-devel freetype-devel"
DEP="yum install gcc-c++ clang make gtk3-devel libnotify-devel bzip2-devel freetype-devel"
fi
if [ -x "$(command -v dnf)" ]; then
echo 'Fedora packaging system (dnf) detected'
DEP="dnf -y install gcc-c++ clang make gtk3-devel pango-devel atk-devel cairo-devel libnotify-devel bzip2-devel freetype-devel"
DEP="dnf install gcc-c++ clang make gtk3-devel libnotify-devel bzip2-devel freetype-devel"
fi
if [ -x "$(command -v urpmi)" ]; then
echo 'Mandriva packaging system (urpmi) detected'
DEP="urpmi install gcc-c++ clang make gtk3-devel libnotify-devel bzip2-devel freetype-devel"
fi
if [ -x "$(command -v zypper)" ]; then
echo 'Zypper packaging system (dnf) detected'
DEP="sudo zypper -n install gtk3-devel libbz2-devel ne xorg-x11-server-devel ssl-devel gcc-c++ make libXdmcp-devel clang"
DEP="sudo zypper -n install clang make gtk3-devel libnotify-devel bzip2-devel freetype-devel"
fi
#add more packaging systems / distros here
@ -34,23 +39,39 @@ fi
if [ -z "$DEP" ]; then
echo Packaging system was not identified.
echo Automatic dependency instalation has failed.
echo You will have to install required packages manually.
echo Please make sure that build dependecies are satisfied.
AskContinue
else
echo We will now try to install required packages.
echo Please enter your password so that we can do:
echo Following command should be used to install required packages:
echo
echo sudo $DEP
if ! eval 'sudo $DEP'; then
echo Failed to install all required packages
AskContinue
echo
echo Install script can run this command for you, but that will require
echo your sudo password.
read -p "Do you want the script to do that (Y/n)?" answer
if [ "$answer" == "${answer//[nN]/x}" ]; then
if ! eval 'sudo $DEP'; then
echo Failed to install all required packages.
echo You will have to install required packages manually.
AskContinue
fi
else
echo Please make sure that build dependecies are satisfied.
fi
fi
if ./umks32; then
echo Using umks32 to build
UMK="./umks32"
else
echo umks32 not available, building umk using make
if ./umks32 >/dev/null; then
echo
read -p "Use prebuilt binary umks32 to accelerate the build (Y/n)?" answer
if [ "$answer" == "${answer//[nN]/x}" ]; then
echo Using umks32 to build
UMK="./umks32"
fi
fi
if [ -z "$UMK" ]; then
echo umks32 cannot be used, building umk using make
make -f uMakefile -j 4
UMK="./umk"
fi
@ -58,10 +79,17 @@ fi
$UMK ./uppsrc ide CLANG -brs ./theide
$UMK ./uppsrc umk CLANG -brs ./umk
echo Install process has been finished. Do you want to start theide now?
AskContinue
if [ -x ./theide ]; then
echo Install process has been finished, TheIDE is built as ./theide
read -p "Do you want to start TheIDE now? (Y/n):" answer
if [ "$answer" == "${answer//[nN]/x}" ]; then
./theide
fi
else
echo Something went wrong.
echo Please use 'make' to compile theide and/or notify developers.
fi
./theide
)--";
const char *clean_script =
@ -70,6 +98,6 @@ R"--(#!/usr/bin/env bash
rm -rf .config/*
rm -rf .cache/*
rm theide
rm umk
rm -f theide
rm -f umk
)--";

View file

@ -150,6 +150,18 @@ void SetAppName(const String& name)
sAppName = name;
}
static String sConfigGroup = "u++";
void SetConfigGroup(const char *group)
{
sConfigGroup = group;
}
String GetConfigGroup()
{
return sConfigGroup;
}
String GetTempDirectory()
{
return GetTempPath();
@ -222,6 +234,8 @@ String ConfigFile(const char *file) {
cfgdir = GetEnv("XDG_CONFIG_HOME");
if(IsNull(cfgdir) || !DirectoryExists(cfgdir))
cfgdir = GetHomeDirFile(".config");
if(sConfigGroup.GetCount())
cfgdir = AppendFileName(cfgdir, sConfigGroup);
}
String pp = AppendFileName(cfgdir, GetAppName());
RealizeDirectory(pp);

View file

@ -64,6 +64,19 @@ onst]_[_^Upp`:`:String^ String][@(0.0.255) `&]_[*@3 name])&]
[s2;%% Overrides the name of the application.&]
[s3;%% &]
[s4; &]
[s5;:Upp`:`:SetConfigGroup`(const char`*`): [@(0.0.255) void]_[* SetConfigGroup]([@(0.0.255) c
onst]_[@(0.0.255) char]_`*[*@3 group])&]
[s2;%% In POSIX systems, ConfigFile function default path is inside
`".cache`" directory. This function allows to set a name of subdirectory
of this directory where the another subdirectory named GetAppName()
specific to the application will store the configuration. Setting
group empty just removes whole level. Default value is `"u`+`+`".&]
[s3;%% &]
[s4; &]
[s5;:Upp`:`:GetConfigGroup`(`): [_^Upp`:`:String^ String]_[* GetConfigGroup]()&]
[s2;%% Returns current config group.&]
[s3; &]
[s4; &]
[s5;:Upp`:`:GetTempDirectory`(`): [_^Upp`:`:String^ String]_[* GetTempDirectory]()&]
[s2;%% Return the temporary directory.&]
[s3; &]

View file

@ -127,4 +127,11 @@ String GetDefaultUppOut()
return out;
}
#endif
#else
String GetDefaultUppOut()
{
return ConfigFile("_out");
}
#endif

View file

@ -1,7 +1,7 @@
#include "ide.h"
//#include "Install.h"
#ifndef PLATFORM_WIN32
#ifdef PLATFORM_POSIX
bool Install(bool& hasvars)
{

View file

@ -126,7 +126,7 @@ void InstantSetup()
String bin = GetExeDirFile("bin");
if(DirectoryExists(bin + "/clang")) // hopefully deprecated, but keep it for now
if(DirectoryExists(bin + "/clang"))
for(int x64 = 0; x64 < 2; x64++) {
String method = x64 ? "CLANGx64" : "CLANG";
#ifdef INSTANT_TESTING

View file

@ -483,11 +483,8 @@ void Ide::SetupDefaultMethod()
if(IsNull(method)) {
SetMethod(GetDefaultMethod());
if(IsNull(method)) {
if(FileExists(ConfigFile("MSC14.bm")))
SetMethod("MSC14");
else
if(FileExists(ConfigFile("MSC15.bm")))
SetMethod("MSC15");
if(FileExists(ConfigFile("CLANG.bm")))
SetMethod("CLANG");
else
if(FileExists(ConfigFile("GCC.bm")))
SetMethod("GCC");