About the usage of generate_run_with_dia_env.sh to have custom installation during the meson/ninja compilation
hello,
Can we have a comprehensive way to use then these variables, i discovered yesterday the script generate_run_with_dia_env.sh but this does not allow me to install for example dia in /opt/dia without crushing /usr/share/dia installed with apt-get install dia-common. I need both python2 and python3 dia side by side.
DIA#1 no PYTHONPATH defaulting to python2.7
ENV
unset PYTHONPATH
dia -v
Dia version 0.97+git, compiled 15:02:28 Dec 1 2018
INSTALL
sudo apt-get install --reinstall dia-common sudo apt-get install --reinstall dia
apt info dia:
Package: dia Version: 0.97.3+git20160930-8.1 Priority: optional Section: graphics Maintainer: Rodrigo Siqueira siqueira@ime.usp.br Installed-Size: 3 916 kB Depends: libart-2.0-2 (>= 2.3.19), libatk1.0-0 (>= 1.12.4), libc6 (>= 2.14), libcairo2 (>= 1.12.0), libfontconfig1 (>= 2.12.6), libfreetype6 (>= 2.2.1), libgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.37.3), libgtk2.0-0 (>= 2.24.32), libpango-1.0-0 (>= 1.18.0), libpangocairo-1.0-0 (>= 1.14.0), libpangoft2-1.0-0 (>= 1.14.0), libpng16-16 (>= 1.6.2-1), libpython2.7 (>= 2.7), libxml2 (>= 2.7.4), libxslt1.1 (>= 1.1.25), zlib1g (>= 1:1.1.4), dia-common (= 0.97.3+git20160930-8.1) Recommends: gsfonts-x11, dia-shapes Breaks: dia-libs (<< 0.97.3+git20160904-1~) Replaces: dia-libs (<< 0.97.3+git20160904-1~) Homepage: https://wiki.gnome.org/Apps/Dia/ Tag: implemented-in::c, interface::graphical, interface::x11, role::program, scope::application, suite::gnu, uitoolkit::gtk, use::editing, works-with::image, works-with::image:vector, x11::application Download-Size: 938 kB: APT-Manual-Installed: no APT-Sources: http://deb.debian.org/debian buster/main amd64 Packages Description: Diagram editor Dia is an editor for diagrams, graphs, charts etc. There is support for UML static structure diagrams (class diagrams), Entity-Relationship diagrams, network diagrams and much more. Diagrams can be exported to postscript and many other formats.
apt info dia-common:
Package: dia-common Version: 0.97.3+git20160930-8.1 Priority: optional Section: graphics Source: dia Maintainer: Rodrigo Siqueira siqueira@ime.usp.br Installed-Size: 24,6 MB Depends: xml-core (>= 0.14), python-gtk2 Recommends: dia Homepage: https://wiki.gnome.org/Apps/Dia/ Tag: interface::graphical, interface::x11, role::app-data, role::program, suite::gnu, uitoolkit::gtk, use::editing, works-with::image, works-with::image:vector, x11::application Download-Size: 7 300 kB APT-Manual-Installed: no APT-Sources: http://deb.debian.org/debian buster/main amd64 Packages Description: Diagram editor (common files) Dia is an editor for diagrams, graphs, charts etc. There is support for UML static structure diagrams (class diagrams), Entity-Relationship diagrams, network diagrams and much more. Diagrams can be exported to post
DIA#2 using PYTHONPATH pointing to python3.9
ENV:
export PYTHONPATH=/usr/local/lib/python3.9/site-packages:/usr/lib/python3/dist-packages
dia -v
Dia version DIA_0_97_0-2406-gaa4e9911+, compiled 16:18:35 Oct 11 2021
Python 3.9.5 (default, Jun 24 2021, 13:37:02)
source:
git clone https://gitlab.gnome.org/GNOME/dia.git
Clone the git repository, for example:
git clone https://gitlab.gnome.org/GNOME/dia.git
#or git clone https://github.com/GNOME/dia
Open a text editor_and save this into run_with_dia_env.sh.
#!/usr/bin/env sh
if [ ! -d "$2" ] || [ ! -d "$3" ]; then
echo Unable to find both directory $2 and $3.
fi
SOURCE_ROOT=$2
BUILD_ROOT=$3
# Windows has ; for PATH separators.
PATH_SEP=":"
if uname | grep -iq MINGW; then
PATH_SEP=";"
fi
# This unfortunately is a duplication of run_env in
# tests/meson.build. This is fine as long as this
# script is only used to generate run_with_dia_env
# and only that.
cat > $1 << EOF
#!/usr/bin/env sh
export DIA_BASE_PATH="${SOURCE_ROOT}"
export DIA_LIB_PATH="${BUILD_ROOT}/objects${PATH_SEP}${BUILD_ROOT}/plug-ins"
export DIA_SHAPE_PATH="${SOURCE_ROOT}/shapes"
export DIA_XSLT_PATH="${SOURCE_ROOT}/plug-ins/xslt"
export DIA_PYTHON_PATH="${SOURCE_ROOT}/plug-ins/python"
export DIA_SHEET_PATH="${BUILD_ROOT}/sheets"
\$@
EOF
chmod u+x $1
Run the script
sudo mkdir /opt/dia
sudo mkdir /opt/dia/plug-ins
sudo mkdir /opt/dia/shapes
sudo mkdir /opt/dia/plug-ins/xslt
sudo mkdir /opt/dia/plug-ins/python
sudo mkdir /opt/dia/sheets
./generate_run_with_dia_env.sh build/run_with_dia_env /opt/dia /opt/dia/lib
configure meson
meson setup --wipe build --prefix=/usr --buildtype=release
#Desactive the buggy pdf, by editing plug-ins/meson.build
# and comment the line pdf to have #subdir('pdf')
meson setup build --reconfigure -Dwith-python=yes
cd build &&meson --prefix=/usr --buildtype=release .. && ninja
ninja install
==> Solve network/network redundancy error: #in /usr/share/dia/shapes if you have both network and Network folders #move files from network into Network and remove network, it
I TRIED TO HOOK to this /opt/dia dia_op.tgz but it is not recognized even after ./build/run_with_dia_env;./build/app/dia, it is still using "/usr/share/dia/ instead of "/opt/dia"