frok from rsync://littlefoxpro.xyz/repository/leaf
This commit is contained in:
51
hints/build.txt
Normal file
51
hints/build.txt
Normal file
@@ -0,0 +1,51 @@
|
||||
几种常见的构建系统
|
||||
|
||||
1. GNU Make & GNU Autotools
|
||||
------------------------------------------------------------
|
||||
./configure --prefix=/usr
|
||||
make
|
||||
make DESTDIR=$pkgdir install
|
||||
------------------------------------------------------------
|
||||
|
||||
2. CMake
|
||||
------------------------------------------------------------
|
||||
mdkir build
|
||||
cd build
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
..
|
||||
make
|
||||
make DESTDIR=$pkgdir install
|
||||
------------------------------------------------------------
|
||||
|
||||
3. Meson & Ninja
|
||||
------------------------------------------------------------
|
||||
mkdir build
|
||||
cd build
|
||||
meson setup --prefix=/usr \
|
||||
--libdir=/usr/lib \
|
||||
--buildtype=release \
|
||||
-Dtests=false \
|
||||
..
|
||||
ninja
|
||||
DESTDIR=$pkgdir ninja install
|
||||
------------------------------------------------------------
|
||||
|
||||
4. Python setup.py
|
||||
------------------------------------------------------------
|
||||
python3 setup.py build
|
||||
python3 setup.py install --root=$pkgdir --optimize=1
|
||||
------------------------------------------------------------
|
||||
|
||||
5. Python Pip
|
||||
------------------------------------------------------------
|
||||
pip3 wheel -w dist --no-build-isolation --no-deps $PWD
|
||||
pip3 install --no-deps --no-warn-script-location --no-index --find-links dist --no-cache-dir --no-user --force-reinstall --root $pkgdir <Package Name>
|
||||
------------------------------------------------------------
|
||||
|
||||
6. Perl
|
||||
------------------------------------------------------------
|
||||
perl Makefile.PL INSTALLDIRS=vendor
|
||||
make
|
||||
make DESTDIR=$pkgdir install
|
||||
------------------------------------------------------------
|
||||
19
hints/kernel.txt
Normal file
19
hints/kernel.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
编译安装Linux内核的一般步骤
|
||||
|
||||
------------------------------------------------------------
|
||||
make menuconfig
|
||||
make
|
||||
make INSTALL_MOD_PATH=$pkgdir/usr INSTALL_MOD_STRIP=1 DEPMOD=/doesnt/exist modules_install # 操作(1)
|
||||
install -Dm644 arch/x86/boot/bzImage $pkgdir/boot/vmlinuz # 操作(2)
|
||||
install -Dm644 System.map $pkgdir/boot/System.map
|
||||
install -Dm644 .config $pkgdir/boot/config
|
||||
------------------------------------------------------------
|
||||
注意: 操作(1)作用只是安装内核模块, 操作(2)作用将内核复制到指定位置供bootloader加载。
|
||||
|
||||
如果您将EXT4、NVME等重要的功能编译成了内核模块, 则必须借助initrd或initramfs来启动计算机。
|
||||
以下是使用dracut生成initramfs的过程:
|
||||
------------------------------------------------------------
|
||||
KERNEL_VERSION=<内核版本>
|
||||
depmod -a $KERNEL_VERSION
|
||||
dracut --kver $KERNEL_VERSION --zstd --force /boot/initramfs-$KERNEL_VERSION.img
|
||||
------------------------------------------------------------
|
||||
6
hints/nodejs.txt
Normal file
6
hints/nodejs.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
NPM & Yarn换源
|
||||
|
||||
------------------------------------------------------------
|
||||
npm config set registry https://registry.npmmirror.com
|
||||
yarn config set registry https://registry.npmmirror.com
|
||||
------------------------------------------------------------
|
||||
11
hints/pip.txt
Normal file
11
hints/pip.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
Python Pip换源
|
||||
|
||||
------------------------------------------------------------
|
||||
mkdir -pv ~/.pip
|
||||
cat > ~/.pip/pip.conf << "EOF"
|
||||
[global]
|
||||
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
[install]
|
||||
trusted-host = https://pypi.tuna.tsinghua.edu.cn
|
||||
EOF
|
||||
------------------------------------------------------------
|
||||
18
hints/rust.txt
Normal file
18
hints/rust.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
Rust Crates换源
|
||||
|
||||
------------------------------------------------------------
|
||||
mkdir -pv ~/.cargo
|
||||
cat > ~/.cargo/config << "EOF"
|
||||
[source.crates-io]
|
||||
replace-with = "ustc"
|
||||
[source.ustc]
|
||||
registry = "sparse+https://mirrors.ustc.edu.cn/crates.io-index/"
|
||||
EOF
|
||||
------------------------------------------------------------
|
||||
|
||||
编译Rust时需要获取上一个版本的Rust来进行构建, 可以预先在指定位置下载好二进制Rust安装包以提升速度。
|
||||
以Rust 1.76.0为例, 下载
|
||||
1. https://static.rust-lang.org/dist/cargo-1.75.0-x86_64-unknown-linux-gnu.tar.xz
|
||||
2. https://static.rust-lang.org/dist/rust-std-1.75.0-x86_64-unknown-linux-gnu.tar.xz
|
||||
2. https://static.rust-lang.org/dist/rustc-1.75.0-x86_64-unknown-linux-gnu.tar.xz
|
||||
并将它们放置于build/cache/2023-12-28目录中(发行日期见https://github.com/rust-lang/rust/releases)。
|
||||
Reference in New Issue
Block a user