Skip to content

Commit

Permalink
optimized
Browse files Browse the repository at this point in the history
Signed-off-by: leleliu008 <[email protected]>
  • Loading branch information
leleliu008 committed Nov 16, 2023
1 parent b97c4c5 commit 4d82949
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/generate-url-transform-sample.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ int ppkg_generate_url_transform_sample() {
"#!/bin/sh\n"
"case $1 in\n"
" *githubusercontent.com/*)\n"
" printf 'https://ghproxy.com/%s\\n' \"$1\"\n"
" printf '%s\\n' \"$1\" | sed 's|githubusercontent|gitmirror|'\n"
" ;;\n"
" https://github.com/*)\n"
" printf 'https://ghproxy.com/%s\\n' \"$1\"\n"
" printf 'https://hub.gitmirror.com/%s\\n' \"$1\"\n"
" ;;\n"
" '') printf '%s\\n' \"$0 <URL>, <URL> is unspecified.\" >&2 ; exit 1 ;;\n"
" *) printf '%s\\n' \"$1\"\n"
Expand Down
18 changes: 14 additions & 4 deletions src/install.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,8 @@ static int getNativePackageInfoByID(int packageID, NativePackage * nativePackage
break;
case NATIVE_PACKAGE_ID_SQLITE3:
nativePackage->name = "sqlite3";
nativePackage->srcUrl = "https://www.sqlite.org/2023/sqlite-autoconf-3410100.tar.gz";
nativePackage->srcSha = "4dadfbeab9f8e16c695d4fbbc51c16b2f77fb97ff4c1c3d139919dfc038c9e33";
nativePackage->srcUrl = "https://www.sqlite.org/2023/sqlite-autoconf-3440000.tar.gz";
nativePackage->srcSha = "b9cd386e7cd22af6e0d2a0f06d0404951e1bef109e42ea06cc0450e10cd15550";
nativePackage->depPackageIDArray[0] = NATIVE_PACKAGE_ID_ZLIB;
nativePackage->buildConfigureArgs = "--disable-dependency-tracking --enable-static --disable-shared --enable-largefile --disable-editline --disable-readline";
nativePackage->buildSystemType = BUILD_SYSTEM_TYPE_CONFIGURE;
Expand Down Expand Up @@ -3041,6 +3041,7 @@ static int ppkg_install_package(

size_t depPackageNamesLength = (formula->dep_upp == NULL) ? 0U : strlen(formula->dep_upp);

bool isNativeOSLinux;
bool isNativeOSDarwin;

#if defined (__APPLE__)
Expand All @@ -3049,15 +3050,24 @@ static int ppkg_install_package(
isNativeOSDarwin = false;
#endif

#if defined (__linux__)
isNativeOSLinux = true;
#else
isNativeOSLinux = false;
#endif

size_t uppmPackageNamesCapacity = depPackageNamesLength + 100U;
char uppmPackageNames[uppmPackageNamesCapacity];
int uppmPackageNamesLength = snprintf(uppmPackageNames, 70U, "bash coreutils findutils gsed gawk grep tree pkgconf%s%s", isNativeOSDarwin ? "" : " patchelf", installOptions.enableCcache ? " ccache" : "");

if (uppmPackageNamesLength < 0) {
ret = snprintf(uppmPackageNames, 75U, "bash coreutils findutils gsed gawk grep tree %s%s%s", (isNativeOSLinux || isNativeOSDarwin) ? "pkg-config" : "pkgconf", isNativeOSDarwin ? "" : " patchelf", installOptions.enableCcache ? " ccache" : "");

if (ret < 0) {
perror(NULL);
return PPKG_ERROR;
}

size_t uppmPackageNamesLength = ret;

bool requestToInstallCmake = false;
bool requestToInstallGmake = false;
bool requestToInstallGm4 = false;
Expand Down

0 comments on commit 4d82949

Please sign in to comment.