diff --git a/01_build_src.sh b/01_build_src.sh index 562f5d1..c6265ff 100755 --- a/01_build_src.sh +++ b/01_build_src.sh @@ -197,9 +197,14 @@ fi cd .. -# 编译 xorg +# 编译 xorg [ no same time with xfce ] if [ "${with_xorg}" = true ]; then ./mk_xorg.sh fi +# 编译 xfce [ no same time with xorg ] +if [ "${with_xfce}" = true ]; then + ./mk_xfce.sh +fi + echo "Run the next script: 02_build_img.sh" diff --git a/common.sh b/common.sh index 77678f7..6c8914a 100755 --- a/common.sh +++ b/common.sh @@ -24,6 +24,9 @@ with_gcc=false # 是否开启 xorg with_xorg=false +# 是否开启 xfce +with_xfce=false + # 是否挂载第二块硬盘 with_sdb=false diff --git a/mk_xfce.sh b/mk_xfce.sh new file mode 100755 index 0000000..5c26c6a --- /dev/null +++ b/mk_xfce.sh @@ -0,0 +1,147 @@ +#!/bin/sh + +# 预装工具 +if [ -f "/usr/bin/apt" ]; then + apt install intltool -y +fi + +if [ -f "/usr/bin/yum" ]; then + echo "xxx" +fi + +#----------------------------------------------- +# +# 导入公共变量 +# +#----------------------------------------------- +. ./common.sh + +GLIB_SRC_URL=https://download.gnome.org/sources/glib/2.72/glib-2.72.3.tar.xz +XFCE_SRC_URL=https://archive.xfce.org/xfce/4.16/fat_tarballs/xfce-4.16.tar.bz2 + +#---------------------------- +# +# 下载源码 +# +#---------------------------- +mkdir -pv source +cd source + +XFCE_SRC_NAME=$(file_name ${XFCE_SRC_URL}) +if [ ! -f ${XFCE_SRC_NAME} ]; then + wget -c -t 0 $XFCE_SRC_URL +fi + +cd .. + +#--------------------------- +# +# 解压源码 +# +#--------------------------- +mkdir -pv ${build_dir} + +XFCE_SRC_DIR=${build_dir}"/"$(file_dirname ${XFCE_SRC_NAME} .tar.bz2) +if [ ! -d ${XFCE_SRC_DIR} ]; then + echo "unzip ${XFCE_SRC_NAME} source code" + tar xf source/${XFCE_SRC_NAME} -C ${build_dir} + echo $XFCE_SRC_DIR + mkdir -pv $XFCE_SRC_DIR + tar xf ${build_dir}/src/exo-4.16.0.tar.bz2 -C ${XFCE_SRC_DIR} + tar xf ${build_dir}/src/thunar-4.16.0.tar.bz2 -C ${XFCE_SRC_DIR} + tar xf ${build_dir}/src/xfce4-dev-tools-4.16.0.tar.bz2 -C ${XFCE_SRC_DIR} + tar xf ${build_dir}/src/xfce4-settings-4.16.0.tar.bz2 -C ${XFCE_SRC_DIR} + tar xf ${build_dir}/src/garcon-0.8.0.tar.bz2 -C ${XFCE_SRC_DIR} + tar xf ${build_dir}/src/thunar-volman-4.16.0.tar.bz2 -C ${XFCE_SRC_DIR} + tar xf ${build_dir}/src/xfce4-panel-4.16.0.tar.bz2 -C ${XFCE_SRC_DIR} + tar xf ${build_dir}/src/xfconf-4.16.0.tar.bz2 -C ${XFCE_SRC_DIR} + tar xf ${build_dir}/src/libxfce4ui-4.16.0.tar.bz2 -C ${XFCE_SRC_DIR} + tar xf ${build_dir}/src/tumbler-4.16.0.tar.bz2 -C ${XFCE_SRC_DIR} + tar xf ${build_dir}/src/xfce4-power-manager-4.16.0.tar.bz2 -C ${XFCE_SRC_DIR} + tar xf ${build_dir}/src/xfdesktop-4.16.0.tar.bz2 -C ${XFCE_SRC_DIR} + tar xf ${build_dir}/src/libxfce4util-4.16.0.tar.bz2 -C ${XFCE_SRC_DIR} + tar xf ${build_dir}/src/xfce4-appfinder-4.16.0.tar.bz2 -C ${XFCE_SRC_DIR} + tar xf ${build_dir}/src/xfce4-session-4.16.0.tar.bz2 -C ${XFCE_SRC_DIR} + tar xf ${build_dir}/src/xfwm4-4.16.0.tar.bz2 -C ${XFCE_SRC_DIR} + rm -rf ${build_dir}/src +fi + +#--------------------------------------------- +# +# 编译 xfce +# +#--------------------------------------------- +cd ${build_dir} + +# 编译 +if [ ! -d "xfce_install" ]; then + mkdir -pv xfce_install && cd ${XFCE_SRC_DIR} + + echo $(pwd) + + cd exo-4.16.0 && make distclean && ./autogensh + ./configure ${CFGOPT} + CFLAGS="-L${glibc_install}/lib64 $CFLAGS" make -j8 && make install -j8 DESTDIR=${build_dir}"/xfce_install" && cd .. + + cd thunar-4.16.0 && make distclean && ./autogensh + ./configure ${CFGOPT} + CFLAGS="-L${glibc_install}/lib64 $CFLAGS" make -j8 && make install -j8 DESTDIR=${build_dir}"/xfce_install" && cd .. + + cd xfce4-dev-tools-4.16.0 && make distclean && ./autogensh + ./configure ${CFGOPT} + CFLAGS="-L${glibc_install}/lib64 $CFLAGS" make -j8 && make install -j8 DESTDIR=${build_dir}"/xfce_install" && cd .. + + cd xfce4-settings-4.16.0 && make distclean && ./autogensh + ./configure ${CFGOPT} + CFLAGS="-L${glibc_install}/lib64 $CFLAGS" make -j8 && make install -j8 DESTDIR=${build_dir}"/xfce_install" && cd .. + + cd garcon-0.8.0 && make distclean && ./autogensh + ./configure ${CFGOPT} + CFLAGS="-L${glibc_install}/lib64 $CFLAGS" make -j8 && make install -j8 DESTDIR=${build_dir}"/xfce_install" && cd .. + + cd thunar-volman-4.16.0 && make distclean && ./autogensh + ./configure ${CFGOPT} + CFLAGS="-L${glibc_install}/lib64 $CFLAGS" make -j8 && make install -j8 DESTDIR=${build_dir}"/xfce_install" && cd .. + + cd xfce4-panel-4.16.0 && make distclean && ./autogensh + ./configure ${CFGOPT} + CFLAGS="-L${glibc_install}/lib64 $CFLAGS" make -j8 && make install -j8 DESTDIR=${build_dir}"/xfce_install" && cd .. + + cd xfconf-4.16.0 && make distclean && ./autogensh + ./configure ${CFGOPT} + CFLAGS="-L${glibc_install}/lib64 $CFLAGS" make -j8 && make install -j8 DESTDIR=${build_dir}"/xfce_install" && cd .. + + cd libxfce4ui-4.16.0 && make distclean && ./autogensh + ./configure ${CFGOPT} + CFLAGS="-L${glibc_install}/lib64 $CFLAGS" make -j8 && make install -j8 DESTDIR=${build_dir}"/xfce_install" && cd .. + + cd tumbler-4.16.0 && make distclean && ./autogensh + ./configure ${CFGOPT} + CFLAGS="-L${glibc_install}/lib64 $CFLAGS" make -j8 && make install -j8 DESTDIR=${build_dir}"/xfce_install" && cd .. + + cd xfce4-power-manager-4.16.0 && make distclean && ./autogensh + ./configure ${CFGOPT} + CFLAGS="-L${glibc_install}/lib64 $CFLAGS" make -j8 && make install -j8 DESTDIR=${build_dir}"/xfce_install" && cd .. + + cd xfdesktop-4.16.0 && make distclean && ./autogensh + ./configure ${CFGOPT} + CFLAGS="-L${glibc_install}/lib64 $CFLAGS" make -j8 && make install -j8 DESTDIR=${build_dir}"/xfce_install" && cd .. + + cd libxfce4util-4.16.0 && make distclean && ./autogensh + ./configure ${CFGOPT} + CFLAGS="-L${glibc_install}/lib64 $CFLAGS" make -j8 && make install -j8 DESTDIR=${build_dir}"/xfce_install" && cd .. + + cd xfce4-appfinder-4.16.0 && make distclean && ./autogensh + ./configure ${CFGOPT} + CFLAGS="-L${glibc_install}/lib64 $CFLAGS" make -j8 && make install -j8 DESTDIR=${build_dir}"/xfce_install" && cd .. + + cd xfce4-session-4.16.0 && make distclean && ./autogensh + ./configure ${CFGOPT} + CFLAGS="-L${glibc_install}/lib64 $CFLAGS" make -j8 && make install -j8 DESTDIR=${build_dir}"/xfce_install" && cd .. + + cd xfwm4-4.16.0 && make distclean && ./autogensh + ./configure ${CFGOPT} + CFLAGS="-L${glibc_install}/lib64 $CFLAGS" make -j8 && make install -j8 DESTDIR=${build_dir}"/xfce_install" && cd .. +fi + +cd .. diff --git a/mk_xorg.sh b/mk_xorg.sh index 9c868fc..53e5c6f 100755 --- a/mk_xorg.sh +++ b/mk_xorg.sh @@ -1,8 +1,15 @@ #!/bin/sh # 预装工具 -apt install git autoconf libtool gcc g++ gettext pkg-config -y -apt install xutils-dev libtool m4 pkg-config xtrans-dev libpixman-1-dev libdrm-dev libx11-dev libgl-dev libgcrypt-dev libxkbfile-dev libxfont-dev libpciaccess-dev libepoxy-dev libgbm-dev libegl1-mesa-dev -y +if [ -f "/usr/bin/apt" ]; then + apt install git autoconf libtool gcc g++ gettext pkg-config m4 -y + apt install xutils-dev xtrans-dev libpixman-1-dev libdrm-dev libx11-dev libgl-dev libgcrypt-dev libxkbfile-dev libxfont-dev libpciaccess-dev libepoxy-dev libgbm-dev libegl1-mesa-dev -y +fi + +if [ -f "/usr/bin/yum" ]; then + yum install git autoconf libtool gcc g++ gettext pkg-config m4 -y + yum install xutils-dev xtrans-dev libpixman-1-dev libdrm-dev libx11-dev libgl-dev libgcrypt-dev libxkbfile-dev libxfont-dev libpciaccess-dev libepoxy-dev libgbm-dev libegl1-mesa-dev -y +fi #----------------------------------------------- # @@ -11,7 +18,9 @@ apt install xutils-dev libtool m4 pkg-config xtrans-dev libpixman-1-dev libdrm-d #----------------------------------------------- . ./common.sh -XORG_SRC_URL=https://www.x.org/archive/individual/xserver/xorg-server-1.20.11.tar.bz2 +xserver_dir=${xorg_install}"/xclient" +xclient_dir=${xorg_install}"/xclient" +XSVR_SRC_URL=https://www.x.org/archive/individual/xserver/xorg-server-1.20.11.tar.bz2 #---------------------------- # @@ -21,9 +30,9 @@ XORG_SRC_URL=https://www.x.org/archive/individual/xserver/xorg-server-1.20.11.ta mkdir -pv source cd source -XORG_SRC_NAME=$(file_name ${XORG_SRC_URL}) -if [ ! -f ${XORG_SRC_NAME} ]; then - wget -c -t 0 $XORG_SRC_URL +XSVR_SRC_NAME=$(file_name ${XSVR_SRC_URL}) +if [ ! -f ${XSVR_SRC_NAME} ]; then + wget -c -t 0 $XSVR_SRC_URL fi cd .. @@ -35,24 +44,22 @@ cd .. #--------------------------- mkdir -pv ${build_dir} -XORG_SRC_DIR=${build_dir}"/"$(file_dirname ${XORG_SRC_NAME} .tar.bz2) -if [ ! -d ${XORG_SRC_DIR} ]; then - echo "unzip ${XORG_SRC_NAME} source code" - tar xf source/${XORG_SRC_NAME} -C ${build_dir} +XSVR_SRC_DIR=${build_dir}"/"$(file_dirname ${XSVR_SRC_NAME} .tar.bz2) +if [ ! -d ${XSVR_SRC_DIR} ]; then + echo "unzip ${XSVR_SRC_NAME} source code" + tar xf source/${XSVR_SRC_NAME} -C ${build_dir} fi #--------------------------------------------- # -# 编译源码 +# 编译 xserver # #--------------------------------------------- cd ${build_dir} -xserver_dir=${xorg_install}"/xclient" -xclient_dir=${xorg_install}"/xclient" # 编译 if [ ! -d "xorg_install" ]; then - mkdir -pv xorg_install && cd ${XORG_SRC_DIR} && make distclean && ./autogensh + mkdir -pv xorg_install && cd ${XSVR_SRC_DIR} && make distclean && ./autogensh ./configure ${CFGOPT} CFLAGS="-L${glibc_install}/lib64 $CFLAGS" make -j8 && make install -j8 DESTDIR=${xserver_dir} && cd .. fi @@ -68,6 +75,7 @@ export LDFLAGS="-L${xorg_install}/xclient/usr/lib" export ACLOCAL="aclocal -I /usr/share/aclocal:${xorg_install}/xclient/usr/share/aclocal" export PKG_CONFIG_PATH="${xorg_install}/xclient/usr/share/pkgconfig:${xorg_install}/xclient/usr/lib/pkgconfig" +# 采用 cache 机制,禁止每次都重新下载源码 if [ ! -f xclient.tar.gz ]; then git clone https://gitlab.freedesktop.org/xorg/util/macros.git git clone https://gitlab.freedesktop.org/xorg/proto/xcbproto.git @@ -176,6 +184,7 @@ cd .. && sleep 1 echo "${GREEN}build xload begin${NC}" +# 编译 xclient application cd xload ./autogen.sh && ./configure ${CFGOPT} && make -j8 && make install -j8 DESTDIR=${xclient_dir} && echo "${GREEN}build xload success${NC}" cd .. && sleep 1