Skip to content

Commit 880bb2e

Browse files
scpa1055cassava
authored andcommitted
vtd: Add vtd-2022.3 package
1 parent f564d1b commit 880bb2e

File tree

9 files changed

+1002
-0
lines changed

9 files changed

+1002
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
src/
2+
dl/
3+
*.tgz
+171
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# syntax = docker/dockerfile:1.2
2+
# Dockerfile
3+
#
4+
# This dockerfile simply adds the sources of ~/.conan/data/vtd/.../ so that
5+
# they can be mounted separately in Docker builds. This keeps image sizes down.
6+
#
7+
# Build the image like this:
8+
#
9+
# docker build -t cloe/vtd-conan-package:2.2.0 Dockerfile vires
10+
#
11+
# And use it in another Dockerfile (with buildkit) like this:
12+
#
13+
# RUN --mount=type=bind,target=/root/.conan/vtd/2.2.0/cloe-restricted/stable,from=cloe/vtd-conan-package:2.2.0
14+
#
15+
# Note, you can create this image even if you don't have anything in the vires
16+
# directory. It will result in an empty image, but it will allow the other
17+
# Docker builds to continue.
18+
#
19+
FROM ubuntu:18.04 AS build
20+
21+
ENV DEBIAN_FRONTEND=noninteractive
22+
23+
RUN --mount=type=cache,id=bionic-cache,target=/var/cache/apt \
24+
--mount=type=cache,id=bionic-lib,target=/var/lib/apt \
25+
apt-get update && \
26+
apt-get install --no-install-recommends -y \
27+
build-essential \
28+
file \
29+
freeglut3 \
30+
libaa1 \
31+
libbsd0 \
32+
libexpat1 \
33+
libasn1-8-heimdal \
34+
libasound2 \
35+
libasyncns0 \
36+
openssh-server \
37+
nfs-common \
38+
mesa-utils \
39+
xfonts-75dpi \
40+
mesa-common-dev \
41+
libatk1.0-0 \
42+
libaudio2 \
43+
libcaca0 \
44+
libcairo2 \
45+
libdatrie1 \
46+
libdv4 \
47+
libdvdnav4 \
48+
libdvdread4 \
49+
libegl1-mesa \
50+
libflac8 \
51+
libfontconfig1 \
52+
libfreetype6 \
53+
libgdk-pixbuf2.0-0 \
54+
libgl1-mesa-glx \
55+
libglib2.0-0 \
56+
libglib2.0-dev \
57+
libglu1-mesa \
58+
libgpm2 \
59+
libgraphite2-3 \
60+
libgsm1 \
61+
libgssapi3-heimdal \
62+
libgtk2.0-0 \
63+
libharfbuzz0b \
64+
libhcrypto4-heimdal \
65+
libheimbase1-heimdal \
66+
libheimntlm0-heimdal \
67+
libhx509-5-heimdal \
68+
libice6 \
69+
libjack-jackd2-0 \
70+
libjpeg-turbo8 \
71+
libkrb5-26-heimdal \
72+
libldap-2.4-2 \
73+
libldb1 \
74+
liblzo2-2 \
75+
libmp3lame0 \
76+
libntdb1 \
77+
libogg0 \
78+
liborc-0.4-0 \
79+
libpango-1.0-0 \
80+
libpangocairo-1.0-0 \
81+
libpangoft2-1.0-0 \
82+
libpixman-1-0 \
83+
libpulse0 \
84+
libqt4-network \
85+
libqt4-qt3support \
86+
libqt4-script \
87+
libqt4-sql \
88+
libqt4-svg \
89+
libqt4-xml \
90+
libqt4-xmlpatterns \
91+
libqtcore4 \
92+
libqtgui4 \
93+
libroken18-heimdal \
94+
libsasl2-2 \
95+
libsdl1.2debian \
96+
libsm6 \
97+
libsmbclient \
98+
libsndfile1 \
99+
libspeex1 \
100+
libtalloc2 \
101+
libtdb1 \
102+
libtevent0 \
103+
libthai0 \
104+
libtheora0 \
105+
libusb-0.1-4 \
106+
libvorbis0a \
107+
libvorbisenc2 \
108+
libwbclient0 \
109+
libwind0-heimdal \
110+
libwrap0 \
111+
libx11-6 \
112+
libxau6 \
113+
libxcb-render0 \
114+
libxcb-shm0 \
115+
libxcb1 \
116+
libxcomposite1 \
117+
libxcursor1 \
118+
libxdamage1 \
119+
libxdmcp6 \
120+
libxext6 \
121+
libxfixes3 \
122+
libxi6 \
123+
libxinerama1 \
124+
libxrandr2 \
125+
libxrender1 \
126+
libxss1 \
127+
libxt6 \
128+
libxv1 \
129+
libxvidcore4 \
130+
libxvmc1 \
131+
libxxf86dga1 \
132+
libxxf86vm1 \
133+
netcat \
134+
patchelf \
135+
python3-pip \
136+
python3-setuptools \
137+
samba-libs \
138+
tcsh \
139+
xterm \
140+
wget \
141+
&& \
142+
wget 'https://launchpad.net/~ubuntu-security/+archive/ubuntu/ppa/+build/15108504/+files/libpng12-0_1.2.54-1ubuntu1.1_amd64.deb' -O /root/libpng12.deb && \
143+
dpkg -i /root/libpng12.deb && \
144+
rm /root/libpng12.deb && \
145+
rm -rf /var/lib/apt/lists/*
146+
147+
RUN pip3 install --upgrade pip && \
148+
pip3 install conan
149+
150+
RUN conan profile new --detect default && \
151+
conan profile update settings.compiler.libcxx=libstdc++11 default
152+
153+
ENV CONAN_NON_INTERACTIVE=yes
154+
155+
WORKDIR /vtd
156+
COPY dl ./dl
157+
COPY conanfile.py ./
158+
COPY libdeps_pruned.txt ./
159+
COPY entrypoint.sh ./
160+
COPY setups ./setups
161+
ARG PACKAGE_FQN=vtd/2022.3@cloe-restricted/stable
162+
RUN conan create conanfile.py ${PACKAGE_FQN} && \
163+
conan remove -b -s -f vtd && \
164+
find /root/.conan/data -type d -name "dl" -exec rm -rf {} +
165+
166+
FROM ubuntu:18.04
167+
COPY --from=build /root/.conan/data/vtd /vtd
168+
RUN ln -s /vtd/*/*/*/package/* /VTD
169+
COPY --from=build /vtd/entrypoint.sh ./
170+
COPY --from=build /vtd/setups /vtd_setups
171+
RUN chmod +x entrypoint.sh
+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Overrides will be preserved in Makefile.package.
2+
override SOURCE_DIR := src
3+
override PACKAGE_CHANNEL := cloe-restricted/stable
4+
override CLEAN_SOURCE_DIR := true
5+
6+
PROJECT_ROOT := ../../../..
7+
include ${PROJECT_ROOT}/Makefile.package
8+
9+
# Override from Makefile.package:
10+
export:
11+
# Only try to export the vtd sources if they are actually there.
12+
@( \
13+
file=$$(cat conanfile.py | sed -rne 's/^.*_archive_base.*"(.*\.tgz)"$$/\1/p'); \
14+
if [ ! -f $$file ]; then \
15+
echo "Missing source tgz: $$file"; \
16+
echo "Skipping export of: ${PACKAGE_FQN}"; \
17+
exit 1; \
18+
fi \
19+
) && conan export . ${PACKAGE_FQN} || true
20+
21+
# Override from Makefile.package:
22+
download:
23+
# Disabled. Please make sure that vtd is in your Conan cache.
24+
25+
DOCKER := DOCKER_BUILDKIT=1 docker
26+
27+
DOCKER_NETWORK := \
28+
$(shell \
29+
if [ -n $$https_proxy ]; then \
30+
echo " --network=host"; \
31+
echo " --build-arg https_proxy=\"$$https_proxy\""; \
32+
echo " --build-arg http_proxy=\"$$http_proxy\""; \
33+
echo " --build-arg no_proxy=\"$$no_proxy\""; \
34+
fi \
35+
)
36+
37+
DOCKER_IMAGE := cloe/vtd-conan-package
38+
DOCKER_TAG := ${PACKAGE_VERSION}
39+
DOCKER_VOLUME := conan-data-vtd
40+
41+
help::
42+
$(call print_help_section, "Available docker targets")
43+
$(call print_help_target, docker, "build docker image containing Conan vtd package")
44+
$(call print_help_target, extract-to-host, "extract vtd Conan package from image to host filesystem")
45+
$(call print_help_target, extract-to-volume, "extract vtd Conan package from image to volume for use as side-car")
46+
echo
47+
$(call print_help_subsection, "Docker configuration")
48+
$(call print_help_define_align, DOCKER_IMAGE, ${DOCKER_IMAGE})
49+
$(call print_help_define_align, DOCKER_TAG, ${DOCKER_TAG})
50+
$(call print_help_define_align, DOCKER_VOLUME, ${DOCKER_VOLUME})
51+
52+
.PHONY: docker
53+
docker:
54+
mkdir -p setups
55+
cp -r ${PROJECT_ROOT}/optional/vtd/contrib/setups/2022.3/* setups/
56+
${DOCKER} build ${DOCKER_NETWORK} -t ${DOCKER_IMAGE}:${DOCKER_TAG} --build-arg PACKAGE_FQN=${PACKAGE_FQN} .
57+
rm -rf setups
58+
59+
.PHONY: extract-to-host
60+
extract-to-host:
61+
mkdir -p ~/.conan/data/vtd
62+
touch ~/.conan/data/.user_id.tmp
63+
docker run --rm -v ~/.conan/data:/mnt ${DOCKER_IMAGE}:${DOCKER_TAG} bash -c \
64+
"cp -a /vtd/* /mnt/vtd/ && chown -R --reference=/mnt/.user_id.tmp /mnt/vtd"
65+
rm ~/.conan/data/.user_id.tmp
66+
67+
.PHONY: extract-to-volume
68+
extract-to-volume:
69+
docker run --rm -v ${DOCKER_VOLUME}:/mnt ${DOCKER_IMAGE}:${DOCKER_TAG} bash -c "cp -a /vtd/* /mnt/"
70+
71+
.PHONY: list-vtd-volume
72+
list-vtd-volume:
73+
docker run --rm -v ${DOCKER_VOLUME}:/mnt ubuntu bash -c "ls -a /mnt"
74+
75+
.PHONY: remove-vtd-volume
76+
remove-vtd-volume:
77+
docker volume rm ${DOCKER_VOLUME}
+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
Conan VTD Package
2+
=================
3+
4+
NOTE: IT IS NOT RECOMMENDED TO USE ANY OF THE CONAN BUILD TARGETS DIRECTLY,
5+
SUCH AS `make package` OR `make all`!
6+
7+
In order to provide a VTD Conan package that is as indepedent and
8+
"cross-platform" as possible, several system libraries are bundled with the
9+
package during creation. In order for this to work, they actually have to be
10+
available on the system that is building them. Since this is unlikely to be the
11+
case, it is recommended to build the Docker image and copy the "vtd" package
12+
from the container once complete.
13+
14+
Additionally, the Docker images in `dist/docker` require the
15+
`cloe/vtd-conan-package` image generated here to work. This image can then be
16+
used to mount at build- or run-time the VTD distribution, which speeds up build
17+
times and keeps image sizes down.
18+
19+
In principle, all you need to do is run `make docker`, but first make sure you
20+
fulfill the requirements.
21+
22+
Requirements
23+
------------
24+
25+
VTD is a proprietary application from [MSC Software](https://www.mscsoftware.com/product/virtual-test-drive).
26+
In order to use the `cloe-plugin-vtd` simulator binding, you will need
27+
a license to use VTD and you will need the VTD 2022.3 sources.
28+
Please contact MSC Software for this.
29+
30+
In order to build this package, you will need to place the required source TGZ
31+
files in the `dl/` directory.
32+
33+
If these are not available, this package will be skipped at the export stage.
34+
35+
Building the Image
36+
------------------
37+
38+
Create `dl` directory and link or copy the source `.tgz` files:
39+
Make sure to export `VTD_TGZ_DIR` to the actual directory where they are stored.
40+
41+
export VTD_TGZ_DIR=~/vtd
42+
mkdir dl
43+
cd dl
44+
ln "${VTD_TGZ_DIR}/vtd.VERSION.Run.Perception.YYYYMMDDD.tgz" ./
45+
ln "${VTD_TGZ_DIR}/vtd.VERSION.OSI.YYYYMMDD.tgz" ./
46+
ln "${VTD_TGZ_DIR}/vtd.VERSION.addOns.World.Edit.Base.YYYYMMDD.tgz" ./
47+
48+
Build the `cloe/vtd-conan-package` Docker image:
49+
50+
make docker
51+
52+
Extracting the Conan Packages
53+
-----------------------------
54+
55+
If you already have the `vtd/2022.3@cloe-restricted/stable` package and you want
56+
to "refresh" it, it's recommended to delete the local copy first:
57+
58+
conan remove vtd/2022.3@cloe-restricted/stable
59+
60+
Normally, there is no need to re-create the package though.
61+
62+
Make sure you have the `cloe/vtd-conan-package:2022.3` Docker image available;
63+
see the previous section if you need to build it. Then mount *your* conan data
64+
home (by default, `~/.conan/data`) into the docker container.
65+
66+
mkdir -p ~/.conan/data/vtd
67+
touch ~/.conan/data/.user_id.tmp
68+
docker run --rm -v ~/.conan/data:/mnt cloe/vtd-conan-package:2022.3 bash -c \
69+
"cp -a /vtd/* /mnt/vtd/ && chown -R --reference=/mnt/.user_id.tmp /mnt/vtd"
70+
rm ~/.conan/data/.user_id.tmp
71+
72+
For your convenience, this is also available as a make target:
73+
74+
make extract-to-host

0 commit comments

Comments
 (0)