diff --git a/.drone.yml b/.drone.yml index 46de1b1..b2dc841 100644 --- a/.drone.yml +++ b/.drone.yml @@ -12,24 +12,13 @@ steps: username: 168062547@qq.com password: from_secret: docker_password -- name: wechat - image: lizheming/drone-wechat +- name: deploy-ubuntu2004 + image: plugins/docker settings: - corpid: - from_secret: wechat_corpid - corp_secret: - from_secret: wechat_corp_secret - agent_id: - from_secret: agent_id - to_user: '@all' - to_tag: ${DRONE_REPO_NAME} - msg_url: ${DRONE_BUILD_LINK} - safe: 1 - btn_txt: more - title: ${DRONE_REPO_NAME} - message: > - {%if success %} - build {{build.number}} succeeded. Good job. - {% else %} - build {{build.number}} failed. Fix me please. - {% endif %} \ No newline at end of file + registry: registry.cn-shenzhen.aliyuncs.com + repo: registry.cn-shenzhen.aliyuncs.com/amass_toolset/develop + tags: ubuntu2004 + dockerfile: ubuntu.dockerfile + username: 168062547@qq.com + password: + from_secret: docker_password \ No newline at end of file diff --git a/resources/raspberrypi.cmake b/resources/raspberrypi.cmake new file mode 100644 index 0000000..92e3e5c --- /dev/null +++ b/resources/raspberrypi.cmake @@ -0,0 +1,31 @@ +include_guard(GLOBAL) +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR arm) + + +set(COMPILER_ROOT /opt/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf) +set(CMAKE_SYSROOT /opt/RaspberryPi/sysroot) + +set(CMAKE_C_COMPILER ${COMPILER_ROOT}/bin/arm-none-linux-gnueabihf-gcc) +set(CMAKE_CXX_COMPILER ${COMPILER_ROOT}/bin/arm-none-linux-gnueabihf-g++) +set(CMAKE_ASM_COMPILER ${COMPILER_ROOT}/bin/arm-none-linux-gnueabihf-as) + +set(RUNTIME_PATH ${CMAKE_SYSROOT}/usr/lib/arm-linux-gnueabihf) +set(CROSSLINK + -Wl,-rpath=${RUNTIME_PATH} + -Wl,-rpath-link=${RUNTIME_PATH} + -Wl,-rpath=${CMAKE_SYSROOT}/lib + -Wl,-rpath=${CMAKE_SYSROOT}/lib/arm-linux-gnueabihf + ssl + crypto stdc++fs dl m + ) + + +list(APPEND CMAKE_C_FLAGS "-march=armv7-a -mfpu=neon -mfloat-abi=hard -I${CMAKE_SYSROOT}/usr/include/arm-linux-gnueabihf") +list(APPEND CMAKE_CXX_FLAGS "-march=armv7-a -mfpu=neon -mfloat-abi=hard -I${CMAKE_SYSROOT}/usr/include/arm-linux-gnueabihf -I${CMAKE_SYSROOT}/usr/include/freetype2 -L${CMAKE_SYSROOT}/usr/lib/arm-linux-gnueabihf") + + +set(ENV{PKG_CONFIG_PATH} "") +set(ENV{PKG_CONFIG_LIBDIR} ${CMAKE_SYSROOT}/usr/lib/pkgconfig:${CMAKE_SYSROOT}/usr/share/pkgconfig:${CMAKE_SYSROOT}/usr/lib/arm-linux-gnueabihf/pkgconfig:${CMAKE_SYSROOT}/opt/vc/lib/pkgconfig) +set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT}) + diff --git a/resources/sysroot-relativelinks.py b/resources/sysroot-relativelinks.py new file mode 100644 index 0000000..fe0992c --- /dev/null +++ b/resources/sysroot-relativelinks.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 +import sys +import os + +# source: https://raw.githubusercontent.com/riscv/riscv-poky/master/scripts/sysroot-relativelinks.py + +# Take a sysroot directory and turn all the absolute symlinks and turn them into +# relative ones such that the sysroot is usable within another system. + +if len(sys.argv) != 2: + print("Usage is " + sys.argv[0] + "") + sys.exit(1) + +topdir = sys.argv[1] +topdir = os.path.abspath(topdir) + +def handlelink(filePath, subdir): + link = os.readlink(filePath) + if link[0] != "/": + return + if link.startswith(topdir): + return + + newLink = os.path.relpath(topdir+link, subdir) + + print("\t%s replacing %s => %s" % (filePath, link, newLink)) + os.unlink(filePath) + os.symlink(newLink, filePath) + +for subdir, dirs, files in os.walk(topdir): + for file in files: + filePath = os.path.join(subdir, file) + if os.path.islink(filePath): + handlelink(filePath, subdir) diff --git a/ubuntu.dockerfile b/ubuntu.dockerfile new file mode 100644 index 0000000..479c578 --- /dev/null +++ b/ubuntu.dockerfile @@ -0,0 +1,62 @@ +FROM ubuntu:22.04 +LABEL maintainer 168062547@qq.com +ENV DEBIAN_FRONTEND=noninteractive + +RUN sed -i "s@http://.*archive.ubuntu.com@http://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list && \ + sed -i "s@http://.*security.ubuntu.com@http://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list && \ + apt-get update && \ + apt-get install -y wget git cmake ninja-build pkg-config \ + libssl-dev libcurl4-openssl-dev libffmpeg-ocaml-dev libfreetype-dev libalsa-ocaml-dev \ + liblzma-dev libx264-dev gcc g++ + +WORKDIR /home/temp +RUN wget https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.gz && \ + wget https://github.com/zeromq/libzmq/releases/download/v4.3.4/zeromq-4.3.4.tar.gz && \ + wget https://github.com/tfussell/xlnt/archive/refs/tags/v1.5.0.tar.gz -O xlnt-1.5.0.tar.gz + +RUN tar xvf boost_1_81_0.tar.gz && \ + tar xvf zeromq-4.3.4.tar.gz && \ + tar xvf xlnt-1.5.0.tar.gz + +WORKDIR /home/temp/boost_1_81_0 +RUN ./bootstrap.sh --prefix=/opt/Libraries/boost_1_81_0 +RUN ./b2 install -q --prefix=/opt/Libraries/boost_1_81_0 threading=multi link=shared runtime-link=shared variant=release cxxstd=17 cxxflags=-fPIC cflags=-fPIC +ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/Libraries/boost_1_81_0/lib" + +WORKDIR /home/temp/zeromq-4.3.4/build +RUN cmake \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_INSTALL_PREFIX=/opt/Libraries/zeromq-4.3.4_debug \ + .. +RUN ninja install +RUN rm -fr ./* +RUN cmake \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/opt/Libraries/zeromq-4.3.4_release \ + .. +RUN ninja install + +WORKDIR /home/temp/xlnt-1.5.0/build +RUN sed -i '1s/^/#include \n/' ../source/detail/number_format/number_formatter.cpp +RUN cmake \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_INSTALL_PREFIX=/opt/Libraries/xlnt-1.5.0_debug \ + .. +RUN ninja install +RUN rm -fr ./* +RUN cmake \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/opt/Libraries/xlnt-1.5.0_release \ + .. +RUN ninja install +RUN bash -c "sed -i -e 's/set_and_check(XLNT_INCLUDE_DIR \"include\")/# set_and_check(XLNT_INCLUDE_DIR \"include\")/g' /opt/Libraries/xlnt-1.5.0_debug/lib/cmake/xlnt/XlntConfig.cmake &&\ + sed -i -e 's/set_and_check(XLNT_INCLUDE_DIR \"include\")/# set_and_check(XLNT_INCLUDE_DIR \"include\")/g' /opt/Libraries/xlnt-1.5.0_release/lib/cmake/xlnt/XlntConfig.cmake" +WORKDIR / +RUN rm -fr /home/temp +ENV LANG C.UTF-8 + +# docker build -f ubuntu.dockerfile -t develop:22.04 .