upp.src: Various macos fixes

This commit is contained in:
Mirek Fidler 2023-04-04 14:47:48 +02:00
parent 7f16ecccf6
commit bf04664bae
8 changed files with 64 additions and 16 deletions

View file

@ -59,15 +59,13 @@ fi
if [[ "$uname" == 'Darwin' ]]; then
echo Configuring $1 for MacOS
sed -i.bak 's/\`pkg-config --cflags libpng\` \`pkg-config --cflags freetype2\` \`pkg-config --cflags x11\` \`pkg-config --cflags fontconfig\` \`pkg-config --cflags xcb\` \`pkg-config --cflags expat\`/ /' $1
sed -i.bak 's/-Wl,--gc-sections $(LINKOPTIONS)/$(LINKOPTIONS)/' $1
sed -i.bak 's/$(LINKER) -o "$(OutFile)" -Wl,-s $(LIBPATH) -Wl,-O,2 $(LDFLAGS) -Wl,--start-group/$(LINKER) -o "$(OutFile)" $(LIBPATH) $(LDFLAGS)/' $1
sed -i.bak 's/\`pkg-config --libs libpng\`/ /' $1
sed -i.bak 's/\`pkg-config --libs freetype2\`/ /' $1
sed -i.bak 's/\`pkg-config --libs x11\`/ /' $1
sed -i.bak 's/\`pkg-config --libs fontconfig\`/ /' $1
sed -i.bak 's/\`pkg-config --libs xcb\`/ /' $1
sed -i.bak 's/\`pkg-config --libs expat\`/ /' $1
sed -i.bak 's/-lrt /-lpng /' $1
sed -i.bak 's/\`pkg-config --cflags .*\`/ /' $1
sed -i.bak 's/\`pkg-config --libs .*\`/ /' $1
sed -i.bak 's/-lrt / -framework Foundation -framework Cocoa -framework Carbon /' $1
sed -i.bak 's/-lpng / /' $1
sed -i.bak 's/-Wl,-s/ /' $1
sed -i.bak 's/-Wl,--start-group/ /' $1
sed -i.bak 's/-Wl,--end-group/ /' $1
sed -i.bak 's/-DflagLINUX/-DflagBSD -DflagOSX -DflagNOMM/' $1
fi

View file

@ -131,9 +131,9 @@ CONSOLE_APP_MAIN
#endif
Syx(GetHomeDirFile("bin/umk") + " ./uppsrc umk GCC -rvsM");
FixMakefile(release + "/umkMakefile", release + "/Makefile");
FixMakefile(release + "/umkMakefile.in", release + "/Makefile");
Syx(GetHomeDirFile("bin/umk") + " ./uppsrc ide GCC -rvsM theide");
FixMakefile(release + "/Makefile", release + "/Makefile");
FixMakefile(release + "/Makefile.in", release + "/Makefile");
SaveFile(release + "/license.chk", "1");

View file

@ -1,5 +1,5 @@
const char *install_script =
R"--(#!/usr/bin/env bash
R"--(##!/usr/bin/env bash
AskContinue()
{
@ -83,10 +83,12 @@ if [ -z "$UMK" ]; then
UMK="./umk"
fi
if clang++ 2>/dev/null; then
if clang++ --version >/dev/null; then
echo $UMK ./uppsrc ide CLANG -brs ./theide
$UMK ./uppsrc ide CLANG -brs ./theide
$UMK ./uppsrc umk CLANG -brs ./umk
else
echo $UMK ./uppsrc ide GCC -brs ./theide
$UMK ./uppsrc ide GCC -brs ./theide
$UMK ./uppsrc umk GCC -brs ./umk
fi

View file

@ -10,7 +10,7 @@ uses
library(WIN32) "usp10 user32 gdi32";
link(OSX !X11) "-framework Foundation -framework Cocoa -framework Carbon";
link(OSX !X11 !NOMM) "-framework Foundation -framework Cocoa -framework Carbon";
pkg_config(POSIX !OSX) "freetype2 fontconfig";
@ -25,6 +25,7 @@ file
FontWin32.cpp,
FontFc.cpp,
FontCoco.mm,
FontCocoNOMM.cpp,
Draw.cpp,
DrawText.cpp,
DrawData.cpp,

View file

@ -3,7 +3,7 @@
#define LLOG(x) // LOG(x)
#define LTIMING(x) // TIMING(x)
#if !defined(CUSTOM_FONTSYS) && defined(PLATFORM_COCOA)
#if !defined(CUSTOM_FONTSYS) && defined(PLATFORM_COCOA) && !defined(flagNOMM)
#define Point NS_Point
#define Rect NS_Rect

View file

@ -0,0 +1,44 @@
#include "Draw.h"
#define LLOG(x) // LOG(x)
#define LTIMING(x) // TIMING(x)
#if !defined(CUSTOM_FONTSYS) && defined(PLATFORM_COCOA) && defined(flagNOMM)
// NOMM serves mostly to build umk (or other console app) without Objective-C++
namespace Upp {
CommonFontInfo GetFontInfoSys(Font font)
{
CommonFontInfo fi;
return fi;
}
GlyphInfo GetGlyphInfoSys(Font font, int chr)
{
GlyphInfo gi;
gi.lspc = gi.rspc = 0;
gi.width = 0x8000;
gi.glyphi = 0;
return gi;
}
Vector<FaceInfo> GetAllFacesSys()
{
Vector<FaceInfo> r;
return r;
}
String GetFontDataSys(Font font, const char *table, int offset, int size)
{ // read truetype or opentype table
return Null;
}
void RenderCharacterSys(FontGlyphConsumer& sw, double x, double y, int chr, Font font)
{
}
};
#endif

View file

@ -92,10 +92,12 @@ bool Install(bool& hasvars)
Scan(GetHomeDirFile("upp.src/*"));
Scan(GetHomeDirFile("upp/uppsrc"));
Scan(GetHomeDirFile("upp/*"));
#ifndef PLATFORM_COCOA // otherwise macos complains about Documents/Music etc...
Scan(GetHomeDirFile("*"));
for(FindFile ff(GetHomeDirFile("*")); ff; ff.Next())
if(ff.IsFolder())
Scan(ff.GetPath() + "/*");
#endif
}
CreateBuildMethods();

View file

@ -12,5 +12,6 @@ file
umake.cpp;
mainconfig
"" = "";
"" = "",
"" = "NOMM";