Skip to content

Commit

Permalink
dev: add gcc pick-ver, add denv init script
Browse files Browse the repository at this point in the history
  • Loading branch information
micl2e2 committed Feb 22, 2025
1 parent 1abbba2 commit a685959
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 0 deletions.
112 changes: 112 additions & 0 deletions dev/init-devenv-deb11.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@

PICK_GCC_REL=$(cat pick-ver-gcc)
PICK_TDLIB_SRC=$(cat pick-src-tdlib)

# -------------------------- Install deps --------------------------

sudo apt update

test $? -eq 0 || exit 11

sudo apt upgrade -y

test $? -eq 0 || exit 12

sudo apt-get install -y g++ make wget curl bzip2 autogen dejagnu

test $? -eq 0 || exit 13

sudo apt-get install -y gperf cmake g++ git zlib1g-dev libssl-dev wget

test $? -eq 0 || exit 14

# ------------------------ Prepare alt-gcc ------------------------

if [[ ! -x /usr/local/bin/alt-gcc ]]
then

cd ~

wget http://ftp.gnu.org/gnu/gcc/gcc-${PICK_GCC_REL}/gcc-${PICK_GCC_REL}.tar.gz

test $? -eq 0 || exit 15

tar xf gcc-${PICK_GCC_REL}.tar.gz

cd gcc-${PICK_GCC_REL} && ./contrib/download_prerequisites

test $? -eq 0 || exit 16

cd ~

mkdir objdir

cd objdir && ../gcc-${PICK_GCC_REL}/configure --program-prefix='alt-' --disable-multilib --disable-libsanitizer --enable-languages=c,c++ --enable-shared=libgcc,libstdc++

test $? -eq 0 || exit 17

cd ~

cd objdir && make -j$(nproc)

test $? -eq 0 || exit 18

cd ~

cd objdir && sudo make install

test $? -eq 0 || exit 19

cd ~

fi

# -------------------------- Prepare tdlib --------------------------

if [[ ! -f /usr/local/lib/libtdcore.a ]]
then

cd ~

test -d td/.git || git clone --depth=1000 https://github.com/tdlib/td

test $? -eq 0 || exit 20

cd td && git reset --hard ${PICK_TDLIB_SRC}

test $? -eq 0 || exit 21

cd ~

cd td && cmake -DCMAKE_BUILD_TYPE=Release -DOPENSSL_USE_STATIC_LIBS=TRUE -DZLIB_USE_STATIC_LIBS=ON -DCMAKE_C_COMPILER=/usr/local/bin/alt-gcc -DCMAKE_CXX_COMPILER=/usr/local/bin/alt-g++ -B build

test $? -eq 0 || exit 22

cd ~

cd td/build && LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH make -j$(nproc)

test $? -eq 0 || exit 23

cd ~

cd td/build && LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH make test

test $? -eq 0 || exit 25

cd ~

cd td/build && sudo LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH make install

test $? -eq 0 || exit 24

fi









1 change: 1 addition & 0 deletions dev/pick-ver-gcc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12.4.0

0 comments on commit a685959

Please sign in to comment.