fix all the stupid paths

This commit is contained in:
Grey Christoforo 2021-05-09 15:07:41 +02:00
parent 1d49449a21
commit f5c1724981
3 changed files with 36 additions and 22 deletions

View file

@ -1,6 +1,6 @@
pkgbase = freecad-git
pkgdesc = A general purpose 3D CAD modeler - git checkout
pkgver = 0.19.r581.g20e756306d
pkgver = 0.19.r582.g0cfea3fee3
pkgrel = 1
epoch = 0
url = https://www.freecadweb.org/

1
.gitignore vendored
View file

@ -3,3 +3,4 @@ pkg/
FreeCAD/
*.tar.xz
*.tar.gz
*.tar.zst

View file

@ -1,7 +1,7 @@
# Maintainer: Grey Christoforo <first name at last name dot net>
pkgname=freecad-git
pkgver=0.19.r581.g20e756306d
pkgver=0.19.r582.g0cfea3fee3
pkgrel=1
epoch=0
pkgdesc='A general purpose 3D CAD modeler - git checkout'
@ -64,17 +64,16 @@ pkgver() {
prepare() {
cd FreeCAD
# add support for vtk version 9
curl https://github.com/wwmayer/FreeCAD/commit/52599f771fa934ceeb11a970c3639bfa8f90411e.patch | patch -p1 --forward || true
#git revert --no-commit 663ac994a794606e56d086cac85598517bd323dc
#git checkout 927fdc9edc
}
_destdir="/usr"
build() {
cd FreeCAD
cmake -Wno-dev \
cmake -Wno-dev -G Ninja -B build_dir -S . \
-D BUILD_ENABLE_CXX_STD=C++14 \
-D BUILD_QT5=ON \
-D BUILD_FEM=ON \
@ -82,8 +81,8 @@ build() {
-D BUILD_MESH_PART=ON \
-D BUILD_SHIP=ON \
-D BUILD_ASSEMBLY=OFF \
-D BUILD_COMPLETE=ON \
-D BUILD_PLOT=ON \
-D CMAKE_INSTALL_PREFIX="" \
-D CMAKE_BUILD_TYPE=None \
-D CMAKE_C_FLAGS="${CFLAGS} -fPIC -w" \
-D CMAKE_CXX_FLAGS="${CXXFLAGS} -fPIC -w" \
@ -91,9 +90,13 @@ build() {
-D FREECAD_USE_OCC_VARIANT="Official Version" \
-D FREECAD_USE_QT_FILEDIALOG=ON \
-D PYTHON_EXECUTABLE=/usr/bin/python \
-G Ninja \
-B build_dir \
-S .
-D INSTALL_TO_SITEPACKAGES=ON \
-D CMAKE_INSTALL_PREFIX="${_destdir}/lib/freecad" \
-D CMAKE_INSTALL_BINDIR=bin \
-D CMAKE_INSTALL_LIBDIR='../../lib' \
-D CMAKE_INSTALL_DATADIR='../../share/freecad' \
-D CMAKE_INSTALL_DATAROOTDIR='../../share' \
-D CMAKE_INSTALL_DOCDIR='../../share/doc/freecad'
cmake --build build_dir
}
@ -102,7 +105,10 @@ check() {
cd FreeCAD
DESTDIR=check cmake --build build_dir -- install
cd build_dir/check
cd "build_dir/check/${_destdir}"
mkdir -p bin
ln -sf "../lib/freecad/bin/FreeCADCmd" bin/FreeCADCmd
export PATH_TO_FREECAD_LIBDIR="$(pwd)/lib"
export LD_LIBRARY_PATH="$(pwd)/lib"
export PYTHONPATH="$(pwd)/lib"
bin/FreeCADCmd --console --run-test 0
@ -110,25 +116,32 @@ check() {
package() {
cd FreeCAD
local _destdir=/usr # maybe this belongs in /opt/freecad-git
DESTDIR="${pkgdir}${_destdir}" cmake --build build_dir -- install
DESTDIR="${pkgdir}" cmake --build build_dir -- install
# fix some bad install locations
mkdir -p "${pkgdir}${_destdir}"/share/freecad
mv "${pkgdir}${_destdir}"/share/{examples,Mod,Gui} "${pkgdir}${_destdir}"/share/freecad
# get python site package folder in the right place
cp -a "${pkgdir}${_destdir}"/lib/freecad/lib "${pkgdir}${_destdir}"
rm -rf "${pkgdir}${_destdir}"/lib/freecad/lib
# fix Ext & Mod locations
mkdir -p "${pkgdir}${_destdir}"/lib/freecad
mv "${pkgdir}${_destdir}"/{Ext,Mod,bin} "${pkgdir}${_destdir}"/lib/freecad
# link all the .sos into python site package dir
python_site_packages="$(python -c 'import sys; print(sys.path[-1])')"
mkdir -p "${pkgdir}/${python_site_packages}"
FILES="${pkgdir}${_destdir}"/lib/*.so
for f in $FILES
do
ln -s ${_destdir}/lib/$(basename $f) "${pkgdir}/${python_site_packages}/$(basename $f)"
done
# links for bin
mkdir -p "${pkgdir}${_destdir}"/bin
FILES="${pkgdir}${_destdir}"/lib/freecad/bin/*
for f in $FILES
do
ln -s ${_destdir}/lib/freecad/bin/$(basename $f) "${pkgdir}${_destdir}"/bin/$(basename $f)
ln -s '../lib/freecad/bin/'$(basename $f) "${pkgdir}${_destdir}"/bin/$(basename $f)
done
install -Dt "${pkgdir}/usr/share/licenses/${pkgname}" -m644 "${pkgdir}${_destdir}"/share/License.txt
install -Dt "${pkgdir}/usr/share/licenses/${pkgname}" -m644 LICENSE
# env var for __init__.py
mkdir -p "${pkgdir}"/etc/profile.d
echo "export PATH_TO_FREECAD_LIBDIR=${_destdir}/lib" > "${pkgdir}"/etc/profile.d/freecad.sh
install -Dt "${pkgdir}${_destdir}/share/licenses/${pkgname}" -m644 LICENSE
}