Skip to content

Commit

Permalink
optimized
Browse files Browse the repository at this point in the history
  • Loading branch information
leleliu008 committed Oct 31, 2024
1 parent 2a9984d commit 91c2fcf
Showing 1 changed file with 38 additions and 32 deletions.
70 changes: 38 additions & 32 deletions ndk-pkg
Original file line number Diff line number Diff line change
Expand Up @@ -8999,43 +8999,14 @@ EOF
wfetch 'https://github.com/leleliu008/test/releases/download/2023.10.08/glibc-2.40-linux-glibc-x86_64.tar.xz' --no-buffer
run $TAR xf glibc-2.40-linux-glibc-x86_64.tar.xz -C sysroot --strip-components=1

wfetch 'https://github.com/leleliu008/test/releases/download/2023.10.08/linux-headers-6.8-linux-x86_64.tar.xz' --no-buffer
run $TAR xf linux-headers-6.8-linux-x86_64.tar.xz -C sysroot --strip-components=1

mv bin/gcc bin/gcc.exe
mv bin/g++ bin/gcc.exe

cat > bin/gcc <<EOF
#!/bin/sh
X="$PWD/sysroot"
$PWD/bin/gcc.exe \
-nostdlib \
-I\$X/include \
-L\$X/lib \
-Wl,-rpath,\$X/lib \
-Wl,-dynamic-linker,\$X/lib/ld-linux-x86-64.so.2 \
"\$@" \
\$X/lib/Scrt1.o \
\$X/lib/crti.o \
\$X/lib/crtn.o \
-lc
EOF
chmod +x bin/gcc

export PATH="$PWD/bin:$PATH"

LINUX_KERNAL_VERSION="$(cut -d ' ' -f3 < /proc/version | cut -d- -f1)"
LINUX_KERNAL_VERSION="${LINUX_KERNAL_VERSION%.0}"
LINUX_KERNAL_VERSION_MAJOR="${LINUX_KERNAL_VERSION%%.*}"
LINUX_KERNAL_SRC_FILENAME="linux-$LINUX_KERNAL_VERSION.tar.xz"

wfetch "https://cdn.kernel.org/pub/linux/kernel/v$LINUX_KERNAL_VERSION_MAJOR.x/$LINUX_KERNAL_SRC_FILENAME" --no-buffer

run install -d linux-src
run $TAR xf "$LINUX_KERNAL_SRC_FILENAME" -C linux-src --strip-components=1
run cd linux-src
run "$UPPM_HOME/installed/gmake/bin/gmake" headers_install INSTALL_HDR_PATH=../sysroot
cd -

cat > bin/gcc <<EOF
#!/bin/sh
X="\$NDKPKG_HOME/core/sysroot"
\$NDKPKG_HOME/core/bin/gcc.exe \
-nostdlib \
Expand Down Expand Up @@ -9086,6 +9057,41 @@ EOF
success "ndk-pkg-$NDKPKG_VERSION have been successfully setup."
}

__xx() {

cat > bin/gcc <<EOF
#!/bin/sh
X="$PWD/sysroot"
$PWD/bin/gcc.exe \
-nostdlib \
-I\$X/include \
-L\$X/lib \
-Wl,-rpath,\$X/lib \
-Wl,-dynamic-linker,\$X/lib/ld-linux-x86-64.so.2 \
"\$@" \
\$X/lib/Scrt1.o \
\$X/lib/crti.o \
\$X/lib/crtn.o \
-lc
EOF
chmod +x bin/gcc

export PATH="$PWD/bin:$PATH"

LINUX_KERNAL_VERSION="$(cut -d ' ' -f3 < /proc/version | cut -d- -f1)"
LINUX_KERNAL_VERSION="${LINUX_KERNAL_VERSION%.0}"
LINUX_KERNAL_VERSION_MAJOR="${LINUX_KERNAL_VERSION%%.*}"
LINUX_KERNAL_SRC_FILENAME="linux-$LINUX_KERNAL_VERSION.tar.xz"

wfetch "https://cdn.kernel.org/pub/linux/kernel/v$LINUX_KERNAL_VERSION_MAJOR.x/$LINUX_KERNAL_SRC_FILENAME" --no-buffer

run install -d linux-src
run $TAR xf "$LINUX_KERNAL_SRC_FILENAME" -C linux-src --strip-components=1
run cd linux-src
run "$UPPM_HOME/installed/gmake/bin/gmake" headers_install INSTALL_HDR_PATH=../sysroot
cd -
}

# }}}
##############################################################################
# {{{ ndk-pkg help
Expand Down

0 comments on commit 91c2fcf

Please sign in to comment.