Hello ports,

There are some bash script anomalies that sthen@ found during a recent
build of OpenCascade. There is a script that has a customized name based
on the architecture.

Also, the script names are fairly generic to be in ${LOCALBASE}/bin, so
those should be slightly customized for our installation.

Going down this rabbit hole, I found more customizations to make oce
properly run, in the event that it is ever used for anything other than
the kicad build.

I think I've addressed everything. This fixes the custom name, adds a
new patch, and adds a MESSAGE with execution instructions.

ok?
-- 

Tracey Emery

Index: Makefile
===================================================================
RCS file: /cvs/ports/cad/oce/Makefile,v
retrieving revision 1.4
diff -u -p -u -r1.4 Makefile
--- Makefile    22 Feb 2022 15:20:11 -0000      1.4
+++ Makefile    24 Feb 2022 16:16:33 -0000
@@ -9,6 +9,7 @@ GH_ACCOUNT =    tpaviot
 GH_PROJECT =   oce
 GH_COMMIT =    98a788062f0f30593880b0df1bcf967408212ba4
 DISTNAME =     oce-7.6.0
+REVISION =     0
 
 .for LIB in TKBO TKBRep TKBin TKBinL TKBinTObj TKBinXCAF TKBool TKCAF TKCDF \
        TKDCAF TKDraw TKFeat TKFillet TKG2d TKG3d TKGeomAlgo TKGeomBase TKHLR \
@@ -42,5 +43,48 @@ RUN_DEPENDS =                ${MODTK_RUN_DEPENDS} \
 
 CONFIGURE_ARGS +=      -DCMAKE_CXX_FLAGS="-I${X11BASE}/include ${CXXFLAGS}" \
                        -DINSTALL_DIR_RESOURCE:STRING="share/opencascade/src"
+
+.include <bsd.port.arch.mk>
+.if ${PROPERTIES:Mlp64}
+ARCH=64
+.else
+ARCH=32
+.endif
+SUBST_VARS += ARCH
+
+# fix bash and make installed script names less generic
+pre-configure:
+       sed -i "s,custom,oce_custom,g" \
+               ${WRKSRC}/adm/templates/*.sh*
+       sed -i "s,env,oce_env,g" \
+               ${WRKSRC}/adm/templates/*.sh*
+       sed -i "s,env,oce_env,g" \
+               ${WRKSRC}/gen*
+       sed -i "s,custom,oce_custom,g" \
+               ${WRKSRC}/gen*
+       sed -i "s,env\.,oce_env\.,g" \
+               ${WRKSRC}/CMakeLists.txt
+       sed -i "s,custom\.,oce_custom\.,g" \
+               ${WRKSRC}/CMakeLists.txt
+       sed -i "s,custom_,oce_custom_,g" \
+               ${WRKSRC}/CMakeLists.txt
+       sed -i "s,draw\.,oce_draw\.,g" \
+               ${WRKSRC}/CMakeLists.txt
+       sed -i "s,/bin/bash,/usr/bin/env bash," \
+               ${WRKSRC}/adm/templates/*.sh*
+       mv ${WRKSRC}/adm/templates/custom.sh.main \
+               ${WRKSRC}/adm/templates/oce_custom.sh.main
+       mv ${WRKSRC}/adm/templates/custom.build.sh.in \
+               ${WRKSRC}/adm/templates/oce_custom.build.sh.in
+       mv ${WRKSRC}/adm/templates/custom.install.sh.in \
+               ${WRKSRC}/adm/templates/oce_custom.install.sh.in
+       mv ${WRKSRC}/adm/templates/draw.sh \
+               ${WRKSRC}/adm/templates/oce_draw.sh
+       mv ${WRKSRC}/adm/templates/env.build.sh.in \
+               ${WRKSRC}/adm/templates/oce_env.build.sh.in
+       mv ${WRKSRC}/adm/templates/env.install.sh.in \
+               ${WRKSRC}/adm/templates/oce_env.install.sh.in
+       mv ${WRKSRC}/adm/templates/env.samples.sh.in \
+               ${WRKSRC}/adm/templates/oce_env.samples.sh.in
 
 .include <bsd.port.mk>
Index: patches/patch-adm_templates_env_install_sh_in
===================================================================
RCS file: patches/patch-adm_templates_env_install_sh_in
diff -N patches/patch-adm_templates_env_install_sh_in
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-adm_templates_env_install_sh_in       24 Feb 2022 16:16:33 
-0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: adm/templates/env.install.sh.in
+--- adm/templates/env.install.sh.in.orig
++++ adm/templates/env.install.sh.in
+@@ -4,7 +4,7 @@ aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}
+ 
+ # ----- For compatibility with external application using CASROOT -----
+ if [ "${CASROOT}" == "" ]; then
+-  export CASROOT="@INSTALL_DIR@"
++  export CASROOT="@INSTALL_DIR@/share/opencascade"
+ fi
+ 
+ # ----- Define path to 3rdparty products -----
Index: pkg/MESSAGE
===================================================================
RCS file: pkg/MESSAGE
diff -N pkg/MESSAGE
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ pkg/MESSAGE 24 Feb 2022 16:16:33 -0000
@@ -0,0 +1,3 @@
+The following should be used to properly initialize and start OpenCascade:
+
+${LOCALBASE}/bin/bash ${LOCALBASE}/bin/oce_draw.sh
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/cad/oce/pkg/PLIST,v
retrieving revision 1.2
diff -u -p -u -r1.2 PLIST
--- pkg/PLIST   22 Feb 2022 15:20:11 -0000      1.2
+++ pkg/PLIST   24 Feb 2022 16:16:33 -0000
@@ -1,10 +1,10 @@
 @comment $OpenBSD: PLIST,v 1.2 2022/02/22 15:20:11 tracey Exp $
 bin/DRAWEXE
 @bin bin/DRAWEXE-7.6.0
-bin/custom.sh
-bin/custom_clang_64.sh
-bin/draw.sh
-bin/env.sh
+bin/oce_custom.sh
+bin/oce_custom_clang_${ARCH}.sh
+bin/oce_draw.sh
+bin/oce_env.sh
 include/opencascade/
 include/opencascade/AIS.hxx
 include/opencascade/AIS_AngleDimension.hxx

Reply via email to