Skip to content

Instantly share code, notes, and snippets.

@hiyms
Last active October 12, 2025 06:04
Show Gist options
  • Save hiyms/19973b582273d0a96fede35b2441a461 to your computer and use it in GitHub Desktop.
Save hiyms/19973b582273d0a96fede35b2441a461 to your computer and use it in GitHub Desktop.
Cangjie Build x86_64 Dockerfile
FROM ubuntu:22.04
RUN sed -i "s@http://.*archive.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list
RUN sed -i "s@http://.*security.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list
RUN apt update && apt upgrade -y
RUN apt install -y \
tar unzip wget curl libcurl4 expat openssl make gcc g++ gettext \
nfs-common libtool sqlite3 zlib1g-dev libssl-dev cmake ninja-build\
libcurl4-openssl-dev sudo autoconf build-essential rapidjson-dev \
texinfo binutils expat libelf-dev libdwarf-dev openssh-client ssh \
dos2unix libxext-dev libxtst-dev libxt-dev libcups2-dev clang clang-15 libedit-dev\
libxrender-dev zip bzip2 libopenmpi-dev vim gdb lldb libclang-15-dev libgtest-dev\
rpm patch libtinfo5 cpio rpm2cpio libncurses5 libncurses5-dev strace net-tools\
tree aria2
ENV BUILD_ROOT=/opt/buildtools
RUN mkdir -p $BUILD_ROOT
RUN chown $USER:$USER $BUILD_ROOT
RUN export tmp_cpus=$(grep -w processor /proc/cpuinfo|wc -l)
# 构建 ncurses
RUN bash -c cd $BUILD_ROOT && \
aria2c https://invisible-island.net/archives/ncurses/ncurses-6.3.tar.gz -x 3 -j 3&& \
tar -zxvf ncurses-6.3.tar.gz && \
cd ncurses-6.3 && \
./configure --with-termlib CC=clang CXX=clang++ CFLAGS=-fPIC CPPFLAGS=-fPIC CFLAGS="-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack" CXXFLAGS="-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack" --with-terminfo-dirs=/etc/terminfo:/lib/terminfo:/usr/share/terminfo --disable-overwrite --disable-root-environ && \
make -j ${tmp_cpus} && \
make install DESTDIR=${BUILD_ROOT}/ncurses-6.3
# 构建 libedit
RUN cd $BUILD_ROOT && \
aria2c https://www.thrysoee.dk/editline/libedit-20250104-3.1.tar.gz -x 3 -j 3 && \
tar -zxvf libedit-20250104-3.1.tar.gz && \
cd libedit-20250104-3.1 && \
./configure --with-pic --enable-shared=no --prefix=${BUILD_ROOT}/libedit-3.1 && \
make -j ${tmp_cpus} && \
make install
ENV OPENSSL_PATH=/usr/lib/x86_64-linux-gnu
# ENV LD_LIBRARY_PATH=$OPENSSL_PATH:$LD_LIBRARY_PATH
RUN echo "/usr/lib/x86_64-linux-gnu" > /etc/ld.so.conf.d/openssl.conf && \
ldconfig
ENV ARCH=x86_64
ENV SDK_NAME=linux-x64
ENV WORKSPACE=/workspace
RUN mkdir ${WORKSPACE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment