|
|
@@ -0,0 +1,61 @@
|
|
|
+mkdir -p ~/mp_build/dist
|
|
|
+cd ~/mp_build
|
|
|
+
|
|
|
+cat <<'EOF' > Dockerfile
|
|
|
+FROM ubuntu:22.04
|
|
|
+ENV DEBIAN_FRONTEND=noninteractive
|
|
|
+
|
|
|
+# Install the graphics dependencies and mono-complete
|
|
|
+RUN apt-get update && apt-get install -y \
|
|
|
+ mono-complete unzip curl wget fuse libfuse2 libgdiplus \
|
|
|
+ libx11-6 libfontconfig1 libfreetype6 libexif12 libgif7 \
|
|
|
+ libjpeg-turbo8 libpng16-16 libtiff5 libcairo2 libxrender1 libxext6 \
|
|
|
+ && rm -rf /var/lib/apt/lists/*
|
|
|
+
|
|
|
+WORKDIR /build
|
|
|
+
|
|
|
+# 1. Fetch Mission Planner
|
|
|
+RUN wget https://firmware.ardupilot.org/Tools/MissionPlanner/MissionPlanner-latest.zip -O mp.zip
|
|
|
+RUN mkdir -p MP.AppDir/usr/lib/missionplanner && unzip -q mp.zip -d MP.AppDir/usr/lib/missionplanner
|
|
|
+
|
|
|
+# 2. Extract Mono Binaries, Libraries, and Config Map
|
|
|
+RUN mkdir -p MP.AppDir/usr/bin MP.AppDir/usr/lib MP.AppDir/usr/etc
|
|
|
+RUN cp /usr/bin/mono MP.AppDir/usr/bin/
|
|
|
+RUN cp -r /usr/lib/mono MP.AppDir/usr/lib/
|
|
|
+RUN cp -r /etc/mono MP.AppDir/usr/etc/
|
|
|
+
|
|
|
+# 3. Surgical Dependency Bundling (Graphics)
|
|
|
+RUN GDI_PATH=$(find /usr/lib /lib -name "libgdiplus.so.0" | head -n 1) && \
|
|
|
+ cp -L $GDI_PATH MP.AppDir/usr/lib/ && \
|
|
|
+ ldd $GDI_PATH | grep "=> /" | awk '{print $3}' | grep -vE 'libc\.so|libm\.so|libdl\.so|libpthread\.so|librt\.so|libresolv\.so|libgcc_s\.so|libstdc\+\+\.so|ld-linux' | xargs -I '{}' cp -L '{}' MP.AppDir/usr/lib/ || true
|
|
|
+
|
|
|
+# 4. Pull in the native Mono shims AND the missing POSIX helper
|
|
|
+RUN find /usr/lib /lib -name "libmono-native.so*" -exec cp -L {} MP.AppDir/usr/lib/ \;
|
|
|
+RUN find /usr/lib /lib -name "libMonoPosixHelper.so*" -exec cp -L {} MP.AppDir/usr/lib/ \;
|
|
|
+
|
|
|
+# 5. Force Mono to map the Windows DLL request directly to our bundled Linux library
|
|
|
+RUN printf '<configuration>\n <dllmap dll="gdiplus.dll" target="libgdiplus.so.0"/>\n <dllmap dll="gdiplus" target="libgdiplus.so.0"/>\n</configuration>\n' > MP.AppDir/usr/lib/missionplanner/MissionPlanner.exe.config
|
|
|
+
|
|
|
+# 6. Create the AppRun
|
|
|
+RUN printf '#!/bin/bash\n\
|
|
|
+HERE="$(dirname "$(readlink -f "${0}")")"\n\
|
|
|
+export PATH="$HERE/usr/bin:$PATH"\n\
|
|
|
+export MONO_PATH="$HERE/usr/lib/missionplanner"\n\
|
|
|
+export LD_LIBRARY_PATH="$HERE/usr/lib:$LD_LIBRARY_PATH"\n\
|
|
|
+export MONO_CFG_DIR="$HERE/usr/etc"\n\
|
|
|
+export MONO_MWF_SCALING_POLICY=none\n\
|
|
|
+\n\
|
|
|
+exec "$HERE/usr/bin/mono" "$HERE/usr/lib/missionplanner/MissionPlanner.exe" "$@"\n' > MP.AppDir/AppRun
|
|
|
+RUN chmod +x MP.AppDir/AppRun
|
|
|
+
|
|
|
+# 7. Desktop Metadata
|
|
|
+RUN printf '[Desktop Entry]\nType=Application\nName=Mission Planner\nExec=AppRun\nIcon=missionplanner\nCategories=Engineering;\n' > MP.AppDir/missionplanner.desktop
|
|
|
+RUN touch MP.AppDir/missionplanner.png
|
|
|
+
|
|
|
+# 8. Package
|
|
|
+RUN wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O appimagetool && chmod +x appimagetool
|
|
|
+CMD ["/bin/bash", "-c", "./appimagetool --appimage-extract-and-run MP.AppDir MissionPlanner.AppImage && cp MissionPlanner.AppImage /dist/"]
|
|
|
+EOF
|
|
|
+
|
|
|
+docker build -t mp-map-builder .
|
|
|
+docker run --rm --privileged -v "$(pwd)/dist:/dist" mp-map-builder
|