Skip to content

Commit

Permalink
Linux musl changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
LongDirtyAnimAlf committed Jul 17, 2023
1 parent c132583 commit d7c94d7
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 30 deletions.
66 changes: 42 additions & 24 deletions fpcuptools/libraryscanner/scannercore.pas
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ implementation
{$endif}
{$endif}

const FPCLIBS : array [0..48] of string = (
const FPCLIBS : array [0..43] of string = (
'crtbegin.o',
'crtbeginS.o',
'crtend.o',
Expand All @@ -182,9 +182,6 @@ implementation
'libanl.so.1',
'libcrypt.so.1',
'libc.so.*',
'libc_nonshared.a',
'libssp_nonshared.a',
'libgcc.a',
'libdb1.so.2',
'libdb2.so.3',
'libdl.so.1',
Expand All @@ -194,7 +191,6 @@ implementation
'libgthread-2.0.so.0',
'libgmodule-2.0.so.0',
'libm.so.6',
'libmvec_nonshared.a',
'libmvec.so.1',
'libnsl.so.1',
'libnss_compat.so.2',
Expand All @@ -206,14 +202,28 @@ implementation
'libnss_nisplus.so.2',
'libnss_nis.so.2',
'libpthread.so.0',
'libpthread_nonshared.a',
'libresolv.so.2',
'librt.so.1',
'libthread_db.so.1',
'libutil.so.1',
'libz.so.1'
);

const FPCALIBS : array [0..11] of string = (
'libc_nonshared.a',
'libssp_nonshared.a',
'libgcc.a',
'libmvec_nonshared.a',
'libpthread_nonshared.a',
'libcrypt.a', // might be a placeholder only [musl]
'libdl.a', // might be a placeholder only [musl]
'libm.a', // might be a placeholder only [musl]
'libpthread.a', // might be a placeholder only [musl]
'libresolv.a', // might be a placeholder only [musl]
'librt.a', // might be a placeholder only [musl]
'libutil.a' // might be a placeholder only [musl]
);

const FPCLINKLIBS : array [0..10] of string = (
'ld.so',
'libc.so',
Expand Down Expand Up @@ -696,29 +706,33 @@ function GetDistro(const aID:string=''):string;
end;
if (NOT success) then
begin
s:='';
if RunCommand('hostnamectl',[],s,[poUsePipes, poStderrToOutPut]{$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 30200)},swoHide{$ENDIF}) then
if FileExists('/usr/bin/hostnamectl') then
begin
AllOutput:=TStringList.Create;
try
AllOutput.NameValueSeparator:=':';
AllOutput.Delimiter:=#10;
AllOutput.StrictDelimiter:=true;
AllOutput.DelimitedText:=s;
s:='';
for i:=0 to AllOutput.Count-1 do
begin
j:=Pos('Operating System',AllOutput.Strings[i]);
if j>0 then s:=s+Trim(AllOutput.Values[AllOutput.Names[i]]);
j:=Pos('Kernel',AllOutput.Strings[i]);
if j>0 then s:=s+' '+Trim(AllOutput.Values[AllOutput.Names[i]]);
s:='';
if RunCommand('hostnamectl',[],s,[poUsePipes, poStderrToOutPut]{$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 30200)},swoHide{$ENDIF}) then
begin
AllOutput:=TStringList.Create;
try
AllOutput.NameValueSeparator:=':';
AllOutput.Delimiter:=#10;
AllOutput.StrictDelimiter:=true;
AllOutput.DelimitedText:=s;
s:='';
for i:=0 to AllOutput.Count-1 do
begin
j:=Pos('Operating System',AllOutput.Strings[i]);
if j>0 then s:=s+Trim(AllOutput.Values[AllOutput.Names[i]]);
j:=Pos('Kernel',AllOutput.Strings[i]);
if j>0 then s:=s+' '+Trim(AllOutput.Values[AllOutput.Names[i]]);
end;
success:=(Length(s)>0);
finally
AllOutput.Free;
end;
success:=(Length(s)>0);
finally
AllOutput.Free;
end;
end;
end;

if (NOT success) then t:='unknown' else
begin
s:=DelChars(s,'"');
Expand Down Expand Up @@ -899,6 +913,10 @@ procedure TScannerCore.GetAndSaveLibs(const Location:string);
begin
CheckAndAddLibrary(SearchLib);
end;
for SearchLib in FPCALIBS do
begin
CheckAndAddLibrary(SearchLib);
end;
for SearchLib in FPCEXTRALIBS do
begin
CheckAndAddLibrary(SearchLib);
Expand Down
20 changes: 18 additions & 2 deletions installscripts/alpine.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
apk add binutils gcc g++ musl-dev make git 7zip

apk add qt5-qtbase qt5-qtbase-dev qt5-qtx11extras-dev qt5-qtx11extras-dev

apk add sdl2
apk add sdl2-dev

apk add sdl2_image
apk add sdl2_mixer
apk add sdl2_net
apk add sdl2_ttf

apk add sdl2_image-dev
apk add sdl2_mixer-dev
apk add sdl2_net-dev
apk add sdl2_ttf-dev

setup-xorg-base
apk add mc xfce4 xfce4-terminal lightdm-gtk-greeter dbus
rc-update add dbus
Expand All @@ -6,8 +23,7 @@ rc-update add lightdm
# apk add firefox
apk add gdk-pixbuf-xlib
apk add gtk+2.0
apk add binutils gcc musl-dev make git 7zip

apk add gtk+3.0

# Add the correct links by apk magic
apk add libx11-dev gdk-pixbuf-dev gdk-pixbuf-xlib-dev gtk+ pango-dev gdb gtk+2.0-dev gcompat
Expand Down
2 changes: 1 addition & 1 deletion public/gitrevision.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[master]crosslibs_all-2793(4e0e545)
[master]crosslibs_all-2794(c132583)
20 changes: 17 additions & 3 deletions sources/installermanager.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,11 @@ procedure TFPCupManager.GetCrossToolsFileName(out BinsFileName,LibsFileName:stri
begin
if (CrossCPU_Target=TCPU.aarch64) then s:='Linux_AArch64_Ubuntu_1804.zip';
if (CrossCPU_Target=TCPU.arm) then s:='Linux_ARMHF_Ubuntu_1804.zip';
if (CrossCPU_Target=TCPU.x86_64) then s:='Linux_AMD64_Ubuntu_1804.zip';
if (CrossCPU_Target=TCPU.x86_64) then
begin
s:='Linux_AMD64_Ubuntu_1804.zip';
if MUSL then s:='Linux_AMD64_Alpine_0314.zip';
end;
if (CrossCPU_Target=TCPU.i386) then s:='Linux_i386_Ubuntu_1804.zip';
if (CrossCPU_Target=TCPU.loongarch64) then s:='Linux_Loongarch64_Deepin_0803.zip';
end;
Expand All @@ -1284,21 +1288,31 @@ procedure TFPCupManager.GetCrossToolsFileName(out BinsFileName,LibsFileName:stri
if (CrossOS_Target=TOS.darwin) then
begin
if (CrossCPU_Target in [TCPU.i386,TCPU.x86_64,TCPU.aarch64]) then s:='Darwin_All.zip';
if (CrossCPU_Target in [TCPU.powerpc,TCPU.powerpc64]) then s:='Darwin_PPC.zip';
if (CrossCPU_Target in [TCPU.powerpc,TCPU.powerpc64]) then s:='Darwin_PPC_10_05.zip';
end;
if (CrossOS_Target=TOS.ios) then
begin
if (CrossCPU_Target in [TCPU.arm,TCPU.aarch64]) then s:='IOS_All.zip';
end;
if (CrossOS_Target=TOS.solaris) then
begin
if (CrossCPU_Target=TCPU.x86_64) then s:='Solaris_AMD64_Oracle_1104.zip';
if (CrossCPU_Target=TCPU.x86_64) then
begin
s:='Solaris_AMD64_Oracle_1104.zip';
if SolarisOI then s:='Solaris_AMD64_OpenIndiana_2010.zip';
end;
end;
if (CrossOS_Target=TOS.freebsd) then
begin
//http://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/VM-IMAGES
if (CrossCPU_Target=TCPU.x86_64) then s:='FreeBSD_AMD64_FreeBSD_10.zip';
end;
if (CrossOS_Target=TOS.openbsd) then
begin
if (CrossCPU_Target=TCPU.aarch64) then s:='OpenBSD_AArch64_OpenBSD_0606.zip';
if (CrossCPU_Target=TCPU.i386) then s:='OpenBSD_i386_OpenBSD_0600.zip';
if (CrossCPU_Target=TCPU.x86_64) then s:='OpenBSD_AMD64_OpenBSD_0701.zip';
end;

if (Length(s)>0) then
begin
Expand Down

0 comments on commit d7c94d7

Please sign in to comment.