User forums > Using Code::Blocks

How to make a portable CB in linux?

<< < (2/2)

Jenna:
@Loaden and all other linux users (especially if the shell is not bash):
Can you try this patch for the update-script ?

It should make C::B portable (if it is compile dwith C::B and the directory/file-structure below output or devel is not changed), because it dynamically fetches the APP_DIR variable at runtime, but I did not test it on any other shell.


--- Code: ---Index: update
===================================================================
--- update (revision 6620)
+++ update (working copy)
@@ -106,14 +106,14 @@
 if [ "x$MSYSTEM" = "x" ] ; then
   echo Creating launch-scripts
   echo "#!/bin/sh" > output/run.sh
-  echo -n "APP_DIR=" >> output/run.sh
-  echo `pwd`/output >> output/run.sh
+  echo 'APP_DIR=`dirname "$0"`' >> output/run.sh
+  echo 'APP_DIR=`( cd "$APP_DIR" && pwd )`' >> output/run.sh
   echo "export LD_LIBRARY_PATH=\$APP_DIR:\$LD_LIBRARY_PATH" >> output/run.sh
   echo "\$APP_DIR/codeblocks \$@" >> output/run.sh
   chmod +x output/run.sh
   echo "#!/bin/sh" > devel/run.sh
-  echo -n "APP_DIR=" >> devel/run.sh
-  echo `pwd`/devel >> devel/run.sh
+  echo 'APP_DIR=`dirname "$0"`' >> devel/run.sh
+  echo 'APP_DIR=`( cd "$APP_DIR" && pwd )`' >> devel/run.sh
   echo "export LD_LIBRARY_PATH=\$APP_DIR:\$LD_LIBRARY_PATH" >> devel/run.sh
   echo "\$APP_DIR/codeblocks \$@" >> devel/run.sh
   chmod +x devel/run.sh

--- End code ---

Loaden:

--- Quote from: jens on September 21, 2010, 08:25:45 am ---@Loaden and all other linux users (especially if the shell is not bash):
Can you try this patch for the update-script ?

--- End quote ---
Works well! :)
Here is the run.sh content.

--- Quote ---#!/bin/sh
APP_DIR=`dirname "$0"`
APP_DIR=`( cd "$APP_DIR" && pwd )`
export LD_LIBRARY_PATH=$APP_DIR:$LD_LIBRARY_PATH
$APP_DIR/codeblocks $@
--- End quote ---

Jenna:

--- Quote from: Loaden on September 21, 2010, 11:55:38 am ---
--- Quote from: jens on September 21, 2010, 08:25:45 am ---@Loaden and all other linux users (especially if the shell is not bash):
Can you try this patch for the update-script ?

--- End quote ---
Works well! :)

--- End quote ---

Thanks for testing.

Did anyone else test it ?
Especially if you do not have bash as default-shell ?

Any feedback is welcome !!
If there are no objection during the next days, I will commit the change to trunk.

Jenna:
Committed in svn r6646 .

Navigation

[0] Message Index

[*] Previous page

Go to full version