now can package ipa, still problems with signing
This commit is contained in:
@@ -3,11 +3,11 @@
|
|||||||
#include "helper.h"
|
#include "helper.h"
|
||||||
#include "tier0/platform.h"
|
#include "tier0/platform.h"
|
||||||
#include "tier1/interface.h"
|
#include "tier1/interface.h"
|
||||||
#include "signal.h"
|
|
||||||
|
|
||||||
ADD_DEPENDENCY_BUILD_FILE(tier0, "../tier0/");
|
ADD_DEPENDENCY_BUILD_FILE(tier0, "../tier0/build.cpp");
|
||||||
ADD_DEPENDENCY_BUILD_FILE(tier1, "../tier1/");
|
ADD_DEPENDENCY_BUILD_FILE(tier1, "../tier1/build.cpp");
|
||||||
ADD_DEPENDENCY_BUILD_FILE(tier2, "../tier2/");
|
ADD_DEPENDENCY_BUILD_FILE(tier2, "../tier2/build.cpp");
|
||||||
|
ADD_DEPENDENCY_BUILD_FILE(signers, "signers/build.cpp");
|
||||||
|
|
||||||
|
|
||||||
CUtlVector<CUtlString> g_fpcFiles = {
|
CUtlVector<CUtlString> g_fpcFiles = {
|
||||||
@@ -30,6 +30,7 @@ CUtlVector<CUtlString> g_libFpcFiles = {
|
|||||||
"library/ld.cpp",
|
"library/ld.cpp",
|
||||||
|
|
||||||
"library/android/apktool.cpp",
|
"library/android/apktool.cpp",
|
||||||
|
"library/apple/appletool.cpp",
|
||||||
|
|
||||||
"library/clang/c.cpp",
|
"library/clang/c.cpp",
|
||||||
"library/clang/ld.cpp",
|
"library/clang/ld.cpp",
|
||||||
@@ -49,7 +50,7 @@ DECLARE_BUILD_STAGE(libfpcbuild)
|
|||||||
CProject_t compileProject = {};
|
CProject_t compileProject = {};
|
||||||
LinkProject_t ldProject = {};
|
LinkProject_t ldProject = {};
|
||||||
|
|
||||||
compileProject.m_szName = "fpc";
|
compileProject.m_szName = "fpcbuild";
|
||||||
compileProject.files = g_libFpcFiles;
|
compileProject.files = g_libFpcFiles;
|
||||||
compileProject.includeDirectories = g_IncludeDirectories;
|
compileProject.includeDirectories = g_IncludeDirectories;
|
||||||
compileProject.bFPIC = true;
|
compileProject.bFPIC = true;
|
||||||
@@ -62,7 +63,7 @@ DECLARE_BUILD_STAGE(libfpcbuild)
|
|||||||
CUtlString outputProject = linker->Link(&ldProject);
|
CUtlString outputProject = linker->Link(&ldProject);
|
||||||
|
|
||||||
|
|
||||||
ADD_OUTPUT_OBJECT("fpc", outputProject)
|
ADD_OUTPUT_OBJECT("fpcbuild", outputProject)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
57
fpc/external/build.cpp
vendored
Normal file
57
fpc/external/build.cpp
vendored
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
#include "c.h"
|
||||||
|
#include "ld.h"
|
||||||
|
#include "helper.h"
|
||||||
|
#include "tier0/platform.h"
|
||||||
|
#include "tier1/interface.h"
|
||||||
|
#include "tier2/ifilesystem.h"
|
||||||
|
|
||||||
|
DECLARE_BUILD_STAGE(zsign)
|
||||||
|
{
|
||||||
|
if (!filesystem)
|
||||||
|
{
|
||||||
|
void *pFilesystem = Plat_LoadLibrary("libfilesystem_std.so");
|
||||||
|
CreateInterfaceFn pFilesystemFactory = Sys_GetFactory(pFilesystem);
|
||||||
|
|
||||||
|
filesystem = (IFileSystem*)pFilesystemFactory(FILESYSTEM_INTERFACE_VERSION, NULL);
|
||||||
|
}
|
||||||
|
IDirectoryHandle *pDir = filesystem->OpenDir("zsign");
|
||||||
|
if (!pDir)
|
||||||
|
return 0;
|
||||||
|
filesystem->CloseDir(pDir);
|
||||||
|
|
||||||
|
CProject_t compileProject = {};
|
||||||
|
LinkProject_t ldProject = {};
|
||||||
|
CUtlString szOutputProject = "";
|
||||||
|
|
||||||
|
compileProject.m_szName = "zsign";
|
||||||
|
compileProject.m_target = Target_t::HostTarget();
|
||||||
|
compileProject.bFPIC = true;
|
||||||
|
compileProject.files = {
|
||||||
|
"zsign/src/common/archive.cpp",
|
||||||
|
"zsign/src/common/base64.cpp",
|
||||||
|
"zsign/src/common/fs.cpp",
|
||||||
|
"zsign/src/common/json.cpp",
|
||||||
|
"zsign/src/common/log.cpp",
|
||||||
|
"zsign/src/common/sha.cpp",
|
||||||
|
"zsign/src/common/timer.cpp",
|
||||||
|
"zsign/src/common/util.cpp",
|
||||||
|
"zsign/src/archo.cpp",
|
||||||
|
"zsign/src/bundle.cpp",
|
||||||
|
"zsign/src/macho.cpp",
|
||||||
|
"zsign/src/openssl.cpp",
|
||||||
|
"zsign/src/signing.cpp",
|
||||||
|
"zsign/src/zsign.cpp",
|
||||||
|
};
|
||||||
|
compileProject.includeDirectories = {
|
||||||
|
"zsign/src/common",
|
||||||
|
"zsign/src",
|
||||||
|
};
|
||||||
|
ldProject = ccompiler->Compile(&compileProject);
|
||||||
|
|
||||||
|
ldProject.linkType = ELINK_DYNAMIC_LIBRARY;
|
||||||
|
szOutputProject = linker->Link(&ldProject);
|
||||||
|
|
||||||
|
ADD_OUTPUT_OBJECT("zsign", szOutputProject);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
1
fpc/external/zsign
vendored
Submodule
1
fpc/external/zsign
vendored
Submodule
Submodule fpc/external/zsign added at cb49b1d34e
92
fpc/library/apple/appletool.cpp
Normal file
92
fpc/library/apple/appletool.cpp
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
#include "appletool.h"
|
||||||
|
#include "helper.h"
|
||||||
|
#include "runner.h"
|
||||||
|
|
||||||
|
void AppleManifest_t::SetPackageID( CUtlString szPackageID )
|
||||||
|
{
|
||||||
|
m_szPackageID = szPackageID;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AppleManifest_t::SetPackageName( CUtlString szPackageName )
|
||||||
|
{
|
||||||
|
m_szPackageName = szPackageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AppleManifest_t::SetPackageExecutable( CUtlString szPackageExecutable )
|
||||||
|
{
|
||||||
|
m_szPackageExecutable = szPackageExecutable;
|
||||||
|
}
|
||||||
|
|
||||||
|
CUtlString AppleManifest_t::BuildManifest()
|
||||||
|
{
|
||||||
|
CPUProject_t project = {};
|
||||||
|
project.m_szName = m_szPackageName;
|
||||||
|
unsigned int hash = project.GenerateProjectHash();
|
||||||
|
CUtlString szOutputDir = CUtlString("%s/apple/%u_%s/app/",FPC_TEMPORAL_DIRNAME, hash, m_szPackageID.GetString());
|
||||||
|
filesystem2->MakeDirectory(szOutputDir);
|
||||||
|
filesystem2->CopyFile(szOutputDir, m_szPackageExecutable);
|
||||||
|
CUtlString szInfoPlist = CUtlString("%s/Info.plist", szOutputDir.GetString());
|
||||||
|
FILE *pInfoPlistFile = V_fopen(szInfoPlist, "wb");
|
||||||
|
|
||||||
|
V_fprintf(pInfoPlistFile, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||||||
|
V_fprintf(pInfoPlistFile, "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n");
|
||||||
|
V_fprintf(pInfoPlistFile, "<plist version=\"1.0\">\n");
|
||||||
|
V_fprintf(pInfoPlistFile, "<dict>\n");
|
||||||
|
V_fprintf(pInfoPlistFile, "<key>CFBundleIdentifier</key>\n");
|
||||||
|
V_fprintf(pInfoPlistFile, "<string>%s</string>\n", m_szPackageID.GetString());
|
||||||
|
V_fprintf(pInfoPlistFile, "<key>CFBundleName</key>\n");
|
||||||
|
V_fprintf(pInfoPlistFile, "<string>%s</string>\n", m_szPackageName.GetString());
|
||||||
|
V_fprintf(pInfoPlistFile, "<key>CFBundleDisplayName</key>\n");
|
||||||
|
V_fprintf(pInfoPlistFile, "<string>%s</string>\n", m_szPackageName.GetString());
|
||||||
|
V_fprintf(pInfoPlistFile, "<key>CFBundleExecutable</key>\n");
|
||||||
|
V_fprintf(pInfoPlistFile, "<string>%s</string>\n", m_szPackageExecutable.GetFileName().GetString());
|
||||||
|
V_fprintf(pInfoPlistFile, "<key>CFBundlePackageType</key>\n");
|
||||||
|
V_fprintf(pInfoPlistFile, "<string>APPL</string>\n");
|
||||||
|
V_fprintf(pInfoPlistFile, "<key>CFBundleVersion</key>\n");
|
||||||
|
V_fprintf(pInfoPlistFile, "<string>1.0</string>\n");
|
||||||
|
V_fprintf(pInfoPlistFile, "<key>CFBundleShortVersionString</key>\n");
|
||||||
|
V_fprintf(pInfoPlistFile, "<string>1.0</string>\n");
|
||||||
|
V_fprintf(pInfoPlistFile, "<key>LSRequiresIPhoneOS</key>\n");
|
||||||
|
V_fprintf(pInfoPlistFile, "<true/>\n");
|
||||||
|
V_fprintf(pInfoPlistFile, "<key>UIDeviceFamily</key>\n");
|
||||||
|
V_fprintf(pInfoPlistFile, "<array>\n");
|
||||||
|
V_fprintf(pInfoPlistFile, "<integer>1</integer>\n");
|
||||||
|
V_fprintf(pInfoPlistFile, "<integer>2</integer>\n");
|
||||||
|
V_fprintf(pInfoPlistFile, "</array>\n");
|
||||||
|
V_fprintf(pInfoPlistFile, "</dict>\n");
|
||||||
|
|
||||||
|
V_fclose(pInfoPlistFile);
|
||||||
|
return szOutputDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class CAppleTool: public IAppleTool
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual CUtlString BuildPackage( AppleManifest_t manifest, CUtlString szManifestDir ) override;
|
||||||
|
virtual CUtlString SignPackage( const char *szIpa, const char *szPassword ) override;
|
||||||
|
};
|
||||||
|
CUtlString CAppleTool::BuildPackage( AppleManifest_t manifest, CUtlString szManifestDir )
|
||||||
|
{
|
||||||
|
CUtlVector<CUtlString> args = {};
|
||||||
|
args = {
|
||||||
|
"-r",
|
||||||
|
CUtlString("../%s.ipa", manifest.m_szPackageName.GetString()),
|
||||||
|
CUtlString("."),
|
||||||
|
};
|
||||||
|
runner->Run("zip",szManifestDir, args);
|
||||||
|
runner->Wait();
|
||||||
|
return CUtlString("../%s.ipa", manifest.m_szPackageName.GetString());
|
||||||
|
}
|
||||||
|
|
||||||
|
CUtlString CAppleTool::SignPackage( const char *szIpa, const char *szPassword )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IAppleTool *AppleTool()
|
||||||
|
{
|
||||||
|
static CAppleTool s_tool;
|
||||||
|
return &s_tool;
|
||||||
|
}
|
||||||
@@ -103,7 +103,7 @@ BuildFile_t *CProjectBuilder::BuildProject( const char *szProjectName, const cha
|
|||||||
*pfnGetProjectObject = FPC_GetProjectObject;
|
*pfnGetProjectObject = FPC_GetProjectObject;
|
||||||
for (auto a: stBuildFileInfo.m_dependantFiles)
|
for (auto a: stBuildFileInfo.m_dependantFiles)
|
||||||
{
|
{
|
||||||
BuildProject("something", CUtlString("%s/%s/build.cpp",szWd.GetString(),a));
|
BuildProject("something", CUtlString("%s/%s",szWd.GetString(),a));
|
||||||
}
|
}
|
||||||
|
|
||||||
Plat_SetWorkingDir(szWd);
|
Plat_SetWorkingDir(szWd);
|
||||||
|
|||||||
@@ -33,10 +33,10 @@ protected:
|
|||||||
virtual void UseDynamicLookup( CUtlVector<CUtlString> &cmd, bool bUse ) override;
|
virtual void UseDynamicLookup( CUtlVector<CUtlString> &cmd, bool bUse ) override;
|
||||||
|
|
||||||
// includes whole file
|
// includes whole file
|
||||||
virtual void UseFullFile( CUtlVector<CUtlString> &cmd ) override;
|
virtual void UseFullFile( CUtlVector<CUtlString> &cmd, LinkProject_t *pProject ) override;
|
||||||
|
|
||||||
// includes used stuff in a file
|
// includes used stuff in a file
|
||||||
virtual void UsePartialFile( CUtlVector<CUtlString> &cmd ) override;
|
virtual void UsePartialFile( CUtlVector<CUtlString> &cmd, LinkProject_t *pProject ) override;
|
||||||
|
|
||||||
virtual void LinkFile( CUtlVector<CUtlString> &cmd, const char *szName ) override;
|
virtual void LinkFile( CUtlVector<CUtlString> &cmd, const char *szName ) override;
|
||||||
virtual void LinkLibraryObject( CUtlVector<CUtlString> &cmd, const char *szName ) override;
|
virtual void LinkLibraryObject( CUtlVector<CUtlString> &cmd, const char *szName ) override;
|
||||||
@@ -72,6 +72,9 @@ void CClangLinker::SetTarget( CUtlVector<CUtlString> &cmd, LinkProject_t *pProje
|
|||||||
if (pProject->linkType == ELINK_DYNAMIC_LIBRARY)
|
if (pProject->linkType == ELINK_DYNAMIC_LIBRARY)
|
||||||
cmd.AppendTail("-shared");
|
cmd.AppendTail("-shared");
|
||||||
|
|
||||||
|
if (pProject->m_target.kernel == TARGET_KERNEL_IOS)
|
||||||
|
cmd.AppendTail("-fuse-ld=lld");
|
||||||
|
|
||||||
cmd.AppendTail("-target");
|
cmd.AppendTail("-target");
|
||||||
cmd.AppendTail(pProject->m_target.GetTriplet());
|
cmd.AppendTail(pProject->m_target.GetTriplet());
|
||||||
}
|
}
|
||||||
@@ -137,15 +140,17 @@ void CClangLinker::UseDynamicLookup( CUtlVector<CUtlString> &cmd, bool bUse )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CClangLinker::UseFullFile( CUtlVector<CUtlString> &cmd )
|
void CClangLinker::UseFullFile( CUtlVector<CUtlString> &cmd, LinkProject_t *pProject )
|
||||||
{
|
{
|
||||||
cmd.AppendTail("-Wl,--whole-archive");
|
if (pProject->m_target.kernel != TARGET_KERNEL_IOS)
|
||||||
|
cmd.AppendTail("-Wl,--whole-archive");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CClangLinker::UsePartialFile( CUtlVector<CUtlString> &cmd )
|
void CClangLinker::UsePartialFile( CUtlVector<CUtlString> &cmd, LinkProject_t *pProject )
|
||||||
{
|
{
|
||||||
cmd.AppendTail("-Wl,--no-whole-archive");
|
if (pProject->m_target.kernel != TARGET_KERNEL_IOS)
|
||||||
|
cmd.AppendTail("-Wl,--no-whole-archive");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -102,12 +102,12 @@ CUtlVector<CUtlString> ILinker::BuildLinkCommandLine( LinkProject_t *pProject, c
|
|||||||
SetOutputFile(cmd, szOutputFileName);
|
SetOutputFile(cmd, szOutputFileName);
|
||||||
SetSysroot(cmd, pProject, NULL);
|
SetSysroot(cmd, pProject, NULL);
|
||||||
SetDefaultLibraryPaths(cmd, pProject);
|
SetDefaultLibraryPaths(cmd, pProject);
|
||||||
UseFullFile(cmd);
|
UseFullFile(cmd, pProject);
|
||||||
for (auto &o: pProject->objects)
|
for (auto &o: pProject->objects)
|
||||||
{
|
{
|
||||||
LinkFile(cmd, o.m_szObjectFile);
|
LinkFile(cmd, o.m_szObjectFile);
|
||||||
}
|
}
|
||||||
UsePartialFile(cmd);
|
UsePartialFile(cmd, pProject);
|
||||||
|
|
||||||
for (auto &o: pProject->libraryObjects)
|
for (auto &o: pProject->libraryObjects)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
#include "runner.h"
|
#include "runner.h"
|
||||||
#include "c.h"
|
#include "c.h"
|
||||||
#include "ld.h"
|
#include "ld.h"
|
||||||
|
#include "tier2/ifilesystem.h"
|
||||||
|
|
||||||
|
IFileSystem *filesystem;
|
||||||
|
|
||||||
void *LibFpcInit()
|
void *LibFpcInit()
|
||||||
{
|
{
|
||||||
@@ -9,6 +12,12 @@ void *LibFpcInit()
|
|||||||
runner = (IRunner*)CreateInterface(RUNNER_INTERFACE_NAME, NULL);
|
runner = (IRunner*)CreateInterface(RUNNER_INTERFACE_NAME, NULL);
|
||||||
ccompiler = (ICCompiler*)CreateInterface(CLANG_C_COMPILER_INTERFACE_NAME, NULL);
|
ccompiler = (ICCompiler*)CreateInterface(CLANG_C_COMPILER_INTERFACE_NAME, NULL);
|
||||||
linker = (ILinker*)CreateInterface(CLANG_LINKER_INTERFACE_NAME, NULL);
|
linker = (ILinker*)CreateInterface(CLANG_LINKER_INTERFACE_NAME, NULL);
|
||||||
|
|
||||||
|
void *pFilesystem = Plat_LoadLibrary("libfilesystem_std.so");
|
||||||
|
CreateInterfaceFn pFilesystemFactory = Sys_GetFactory(pFilesystem);
|
||||||
|
filesystem = (IFileSystem*)pFilesystemFactory(FILESYSTEM_INTERFACE_VERSION, NULL);
|
||||||
|
filesystem->Init();
|
||||||
|
V_printf("----- %p\n",filesystem);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,10 +32,10 @@ protected:
|
|||||||
virtual void UseDynamicLookup( CUtlVector<CUtlString> &cmd, bool bUse ) override;
|
virtual void UseDynamicLookup( CUtlVector<CUtlString> &cmd, bool bUse ) override;
|
||||||
|
|
||||||
// includes whole file
|
// includes whole file
|
||||||
virtual void UseFullFile( CUtlVector<CUtlString> &cmd ) override;
|
virtual void UseFullFile( CUtlVector<CUtlString> &cmd, LinkProject_t *pProject ) override;
|
||||||
|
|
||||||
// includes used stuff in a file
|
// includes used stuff in a file
|
||||||
virtual void UsePartialFile( CUtlVector<CUtlString> &cmd ) override;
|
virtual void UsePartialFile( CUtlVector<CUtlString> &cmd, LinkProject_t *pProject ) override;
|
||||||
|
|
||||||
virtual void LinkFile( CUtlVector<CUtlString> &cmd, const char *szName ) override;
|
virtual void LinkFile( CUtlVector<CUtlString> &cmd, const char *szName ) override;
|
||||||
virtual void LinkLibraryObject( CUtlVector<CUtlString> &cmd, const char *szName ) override;
|
virtual void LinkLibraryObject( CUtlVector<CUtlString> &cmd, const char *szName ) override;
|
||||||
@@ -81,13 +81,13 @@ void CMSVCLinker::UseDynamicLookup( CUtlVector<CUtlString> &cmd, bool bUse )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CMSVCLinker::UseFullFile( CUtlVector<CUtlString> &cmd )
|
void CMSVCLinker::UseFullFile( CUtlVector<CUtlString> &cmd, LinkProject_t *pProject )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CMSVCLinker::UsePartialFile( CUtlVector<CUtlString> &cmd )
|
void CMSVCLinker::UsePartialFile( CUtlVector<CUtlString> &cmd, LinkProject_t *pProject )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
31
fpc/public/appletool.h
Normal file
31
fpc/public/appletool.h
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#ifndef Apple_TOOL_H
|
||||||
|
#define Apple_TOOL_H
|
||||||
|
|
||||||
|
#include "tier0/platform.h"
|
||||||
|
#include "tier1/utlstring.h"
|
||||||
|
#include "legal.h"
|
||||||
|
|
||||||
|
struct AppleManifest_t
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void SetPackageID( CUtlString szPackageID );
|
||||||
|
void SetPackageName( CUtlString szPackageName );
|
||||||
|
void SetPackageExecutable( CUtlString szPackageExecutable );
|
||||||
|
|
||||||
|
CUtlString BuildManifest();
|
||||||
|
|
||||||
|
CUtlString m_szPackageName;
|
||||||
|
CUtlString m_szPackageID;
|
||||||
|
CUtlString m_szPackageExecutable;
|
||||||
|
};
|
||||||
|
|
||||||
|
abstract_class IAppleTool
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual CUtlString BuildPackage( AppleManifest_t manifest, CUtlString szManifestDir ) = 0;
|
||||||
|
virtual CUtlString SignPackage( const char *szIpa, const char *szPassword ) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
IAppleTool *AppleTool();
|
||||||
|
#endif
|
||||||
|
|
||||||
0
fpc/public/deploy.h
Normal file
0
fpc/public/deploy.h
Normal file
@@ -121,10 +121,10 @@ protected:
|
|||||||
virtual void UseDynamicLookup( CUtlVector<CUtlString> &cmd, bool bUse ) = 0;
|
virtual void UseDynamicLookup( CUtlVector<CUtlString> &cmd, bool bUse ) = 0;
|
||||||
|
|
||||||
// includes whole file
|
// includes whole file
|
||||||
virtual void UseFullFile( CUtlVector<CUtlString> &cmd ) = 0;
|
virtual void UseFullFile( CUtlVector<CUtlString> &cmd, LinkProject_t *pProject ) = 0;
|
||||||
|
|
||||||
// includes used stuff in a file
|
// includes used stuff in a file
|
||||||
virtual void UsePartialFile( CUtlVector<CUtlString> &cmd ) = 0;
|
virtual void UsePartialFile( CUtlVector<CUtlString> &cmd, LinkProject_t *pProject ) = 0;
|
||||||
|
|
||||||
virtual void LinkFile( CUtlVector<CUtlString> &cmd, const char *szName ) = 0;
|
virtual void LinkFile( CUtlVector<CUtlString> &cmd, const char *szName ) = 0;
|
||||||
virtual void LinkLibraryObject( CUtlVector<CUtlString> &cmd, const char *szName ) = 0;
|
virtual void LinkLibraryObject( CUtlVector<CUtlString> &cmd, const char *szName ) = 0;
|
||||||
|
|||||||
11
fpc/public/signer.h
Normal file
11
fpc/public/signer.h
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#ifndef SIGNER_H
|
||||||
|
#define SIGNER_H
|
||||||
|
|
||||||
|
#include "c.h"
|
||||||
|
#include "ld.h"
|
||||||
|
#include "helper.h"
|
||||||
|
#include "tier0/platform.h"
|
||||||
|
#include "tier1/interface.h"
|
||||||
|
#include "tier0/platform.h"
|
||||||
|
|
||||||
|
#endif
|
||||||
3
fpc/public/sysrootfetch.h
Normal file
3
fpc/public/sysrootfetch.h
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#ifndef SYSROOT_FETCH_H
|
||||||
|
#define SYSROOT_FETCH_H
|
||||||
|
#endif
|
||||||
@@ -12,12 +12,18 @@ enum ETargetKernel
|
|||||||
{
|
{
|
||||||
TARGET_KERNEL_UNKNOWN = 0,
|
TARGET_KERNEL_UNKNOWN = 0,
|
||||||
TARGET_KERNEL_LINUX,
|
TARGET_KERNEL_LINUX,
|
||||||
|
|
||||||
|
TARGET_KERNEL_WINDOWS_DEVICES = 0x100,
|
||||||
TARGET_KERNEL_WINDOWS_MSVC,
|
TARGET_KERNEL_WINDOWS_MSVC,
|
||||||
TARGET_KERNEL_WINDOWS_GNU,
|
TARGET_KERNEL_WINDOWS_GNU,
|
||||||
TARGET_KERNEL_WINDOWS = TARGET_KERNEL_WINDOWS_GNU,
|
TARGET_KERNEL_WINDOWS = TARGET_KERNEL_WINDOWS_GNU,
|
||||||
|
|
||||||
|
TARGET_KERNEL_APPLE_DEVICES = 0x200,
|
||||||
TARGET_KERNEL_DARWIN,
|
TARGET_KERNEL_DARWIN,
|
||||||
TARGET_KERNEL_IOS,
|
TARGET_KERNEL_IOS,
|
||||||
TARGET_KERNEL_ANDROID,
|
TARGET_KERNEL_ANDROID,
|
||||||
|
|
||||||
|
TARGET_KERNEL_WEB_DEVICES = 0x400,
|
||||||
TARGET_KERNEL_WASI,
|
TARGET_KERNEL_WASI,
|
||||||
TARGET_KERNEL_EMSCRIPTEN,
|
TARGET_KERNEL_EMSCRIPTEN,
|
||||||
};
|
};
|
||||||
|
|||||||
2
fpc/tests/ios_build/.fpccfg
Normal file
2
fpc/tests/ios_build/.fpccfg
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[aarch64-apple-ios]
|
||||||
|
sysroot = "/home/kotofyt/clones/yay/xcode/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#include "helper.h"
|
||||||
|
#include "c.h"
|
||||||
|
#include "ld.h"
|
||||||
|
#include "tier1/utlstring.h"
|
||||||
|
#include "appletool.h"
|
||||||
|
|
||||||
|
DECLARE_BUILD_STAGE(ios_build)
|
||||||
|
{
|
||||||
|
V_printf("Cool\n");
|
||||||
|
CProject_t compileProject = {};
|
||||||
|
compileProject.m_szName = "ios_app";
|
||||||
|
compileProject.m_target = Target_t::HostTarget();
|
||||||
|
compileProject.m_target.kernel = TARGET_KERNEL_IOS;
|
||||||
|
compileProject.m_target.cpu = TARGET_CPU_AARCH64;
|
||||||
|
compileProject.files = {
|
||||||
|
"main.c",
|
||||||
|
};
|
||||||
|
LinkProject_t ldProject = ccompiler->Compile(&compileProject);
|
||||||
|
CUtlString szOutput = linker->Link(&ldProject);
|
||||||
|
|
||||||
|
AppleManifest_t manifest = {};
|
||||||
|
manifest.SetPackageName("FPC Testing facility");
|
||||||
|
manifest.SetPackageID("com.example.testfpc");
|
||||||
|
manifest.SetPackageExecutable(szOutput);
|
||||||
|
CUtlString szIpa = AppleTool()->BuildPackage( manifest, manifest.BuildManifest() );
|
||||||
|
CUtlString szPackage = AppleTool()->SignPackage(szIpa, NULL);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|||||||
6
fpc/tests/ios_build/main.c
Normal file
6
fpc/tests/ios_build/main.c
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#include "stdio.h"
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
printf("Hello, world!\n");
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
@@ -27,6 +27,9 @@ public:
|
|||||||
IFileSystem *m_pFileSystem;
|
IFileSystem *m_pFileSystem;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
abstract_class IDirectoryHandle
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// IFileSystem is an app system which manages files, could have different
|
// IFileSystem is an app system which manages files, could have different
|
||||||
@@ -54,6 +57,10 @@ public:
|
|||||||
// Should be cleaned by the user
|
// Should be cleaned by the user
|
||||||
virtual const char *ReadString( IFileHandle *pFile ) = 0;
|
virtual const char *ReadString( IFileHandle *pFile ) = 0;
|
||||||
|
|
||||||
|
// Directory stuff
|
||||||
|
virtual IDirectoryHandle *OpenDir( const char *szDirName ) = 0;
|
||||||
|
virtual void CloseDir( IDirectoryHandle *pDir ) = 0;
|
||||||
|
|
||||||
IFileSystem *m_pNext;
|
IFileSystem *m_pNext;
|
||||||
|
|
||||||
void RegisterFileSystem();
|
void RegisterFileSystem();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "tier1/interface.h"
|
#include "tier1/interface.h"
|
||||||
#include "tier0/lib.h"
|
#include "tier0/lib.h"
|
||||||
#include "errno.h"
|
#include "errno.h"
|
||||||
|
#include "dirent.h"
|
||||||
|
|
||||||
class CLIBCFileHandle : public IFileHandle
|
class CLIBCFileHandle : public IFileHandle
|
||||||
{
|
{
|
||||||
@@ -11,6 +12,12 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CLIBCDirectoryHandle: public IDirectoryHandle
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DIR *m_pDir;
|
||||||
|
};
|
||||||
|
|
||||||
class CLIBCFileSystem : public IFileSystem
|
class CLIBCFileSystem : public IFileSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -129,6 +136,30 @@ public:
|
|||||||
|
|
||||||
return szData;
|
return szData;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
virtual IDirectoryHandle *OpenDir( const char *szDirName ) override
|
||||||
|
{
|
||||||
|
CLIBCDirectoryHandle *pHandle = NULL;
|
||||||
|
DIR *pDir = opendir(szDirName);
|
||||||
|
if (pDir == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
pHandle = new CLIBCDirectoryHandle;
|
||||||
|
pHandle->m_pDir = pDir;
|
||||||
|
return pHandle;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void CloseDir( IDirectoryHandle *pDir ) override
|
||||||
|
{
|
||||||
|
if (!pDir)
|
||||||
|
return;
|
||||||
|
CLIBCDirectoryHandle *pCDir = (CLIBCDirectoryHandle*)pDir;
|
||||||
|
|
||||||
|
closedir(pCDir->m_pDir);
|
||||||
|
|
||||||
|
delete (CLIBCDirectoryHandle*)pDir;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
EXPOSE_INTERFACE(CLIBCFileSystem, IFileSystem, FILESYSTEM_INTERFACE_VERSION)
|
EXPOSE_INTERFACE(CLIBCFileSystem, IFileSystem, FILESYSTEM_INTERFACE_VERSION)
|
||||||
|
|||||||
Reference in New Issue
Block a user