用户可借助该项目在 OpenHarmony 系统中使用 Git 进行分布式版本控制。项目提供 Git 2.45.2 源码及鸿蒙化补丁,包含依赖库管理与编译配置,支持通过工具链编译生成适用于 OpenHarmony 的 Git 产物。【此简介由AI生成】
Access rate limit exceeded. Please log in to continue.
git
Introduce
Support for Git, the distributed version control system of Openharmony.
Download
git clone https://gitee.com/openharmony-sig/third_party_git
Software architecture
├── deps ---- Git compilation relies on third-party libraries
├── git-2.45.2.tar.gz ---- Git source code v2.45.2
├── patch ---- The patches that need to be modified for Git on Openharmony
├── README.en.md ---- Compilation and installation methods
└── README.md ---- Compilation and installation methods
Environment configuration
- Configure the compilation toolchain on your compilation machine. In the SDK released by OpenHarmony, there is an ohos folder that provides compilation toolchains that can be used on Openharmony PCs
- Prepare make
- Use the following script to configure environment variables
export OHOS_SDK=/your_path/ohos-sdk
export AS=${OHOS_SDK}/native/llvm/bin/llvm-as
export CC="${OHOS_SDK}/native/llvm/bin/clang --target=aarch64-linux-ohos"
export CXX="${OHOS_SDK}/native/llvm/bin/clang++ --target=aarch64-linux-ohos"
export LD=${OHOS_SDK}/native/llvm/bin/ld.lld
export STRIP=${OHOS_SDK}/native/llvm/bin/llvm-strip
export RANLIB=${OHOS_SDK}/native/llvm/bin/llvm-ranlib
export OBJDUMP=${OHOS_SDK}/native/llvm/bin/llvm-objdump
export OBJCOPY=${OHOS_SDK}/native/llvm/bin/llvm-objcopy
export NM=${OHOS_SDK}/native/llvm/bin/llvm-nm
export AR=${OHOS_SDK}/native/llvm/bin/llvm-ar
export CFLAGS="-fPIC -D__MUSL__=1"
export CXXFLAGS="-fPIC -D__MUSL__=1"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${OHOS_SDK}/native/llvm/lib
INSTALL
Thirdparty libraries
- Download code You can download all tar bar by browser.
https://github.com/libexpat/libexpat/releases/download/R_2_6_2/expat-2.6.2.tar.gz
https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.17.tar.gz
https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.43/pcre2-10.43.tar.gz
https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz
https://curl.se/download/curl-8.0.1.tar.gz
https://ftp.gnu.org/pub/gnu/gettext/gettext-0.22.tar.gz
- Complie
tar zxvf expat-2.6.2.tar.gz
cd expat-2.6.2/
./configure --prefix=/your_path/git/deps --host=aarch64-linux --without-xmlwf --without-examples --without-tests --without-docbook --disable-shared
make -j8 && make install
tar zxvf openssl-1.1.1w.tar.gz
cd openssl-1.1.1w/
./Configure --prefix=/your_path/git/deps" linux-aarch64 no-shared
make -j8 && make install
tar zxvf curl-8.0.1.tar.gz
cd curl-8.0.1/
./configure --prefix=/your_path/git/deps --host=aarch64-linux --with-openssl=/your_path/git/deps --with-ca-bundle=/etc/ssl/certs/cacert.pem --with-ca-path=/etc/ssl/certs --disable-shared CFLAGS="-Wno-int-conversion $CFLAGS"
make-j8 && make install
tar zxvf libiconv-1.17.tar.gz
cd libiconv-1.17
./configure --prefix=/your_path/git/deps --host=aarch64-linux --disable-shared
make-j8 && make install
tar zxvf pcre2-10.43.tar.gz
cd pcre2-10.43/
./configure --prefix=/your_path/git/deps --host=aarch64-linux --disable-shared
make -j8 && make install
tar zxvf gettext-0.22.tar.gz
cd gettext-0.22/
./configure --prefix=/your_path/git/deps --host=aarch64-linux --disable-shared CFLAGS="-Wno-int-conversion $CFLAGS"
make -j8 && make install
- Compile git
# cd /your_path/git
# tar zxvf git-2.45.2.tar.gz
# cd git-2.45.2
# patch -p1 < ../patch/git_oh_pkg.patch
# ./configure --prefix="${PWD}/install" --host=aarch64-linux --disable-pthreads \
ac_cv_iconv_omits_bom=yes \
ac_cv_fread_reads_directories=yes \
ac_cv_snprintf_returns_bogus=no \
ac_cv_lib_curl_curl_global_init=yes \
--with-libpcre2 \
--with-tcltk=no \
ac_cv_prog_CURL_CONFIG=${PWD}/../deps/bin/curl-config \
CPPFLAGS="-I${PWD}/../deps/include" \
LDFLAGS="-L${PWD}/../deps/lib"
# make NO_GETTEXT=YesPlease install -j8
After executing the above instructions, generate all git compilation products in /your_path/git/git-2.45.2/install
RUN
# cd /your_path/git/git-2.45.2/install/bin
# ./git --version
git version 2.45.2
Introduction
用户可借助该项目在 OpenHarmony 系统中使用 Git 进行分布式版本控制。项目提供 Git 2.45.2 源码及鸿蒙化补丁,包含依赖库管理与编译配置,支持通过工具链编译生成适用于 OpenHarmony 的 Git 产物。【此简介由AI生成】
Customize your domain