Create User Library On Linux

Linux specific forum
User avatar
mk-soft
Always Here
Always Here
Posts: 6245
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Create User Library On Linux

Post by mk-soft »

To create user libraries, the environment must be set to the correct path.
Therefore start the pb ide with a script and create a desktop file.
In addition, create a tool app to start the compiler with the correct path.

Create script run_pb.sh
Save under /home/Apps/[UserName]
Set the permission to run as a program

Code: Select all

#!/bin/bash

# Test mandatory PureBasic path parameter
if [ -z "$1" ]; then
	echo "Invalid parameters: Missing argument for target PureBasic directory"
	exit 1
fi


# Set PUREBASIC_HOME and ensure compiler and IDE are in the PATH
export PUREBASIC_HOME=$1
export PATH="$PUREBASIC_HOME/compilers:$PUREBASIC_HOME:$PATH"

# Test if the PureBasic home is valid and check if this is PB or SB
if [ -f "$PUREBASIC_HOME/compilers/pbcompiler" ]; then
	echo "Start purebasic ide"
	purebasic
else
	echo "Invalid path for target PureBasic directory"
	exit 1
fi
Create a desktop file and save it under '/home/UserName]/.local/share/applications/PureBasic v6.20.desktop'.
Adjust Path to PureBasic.

Code: Select all

[Desktop Entry]
Type=Application
Icon=/home/michael/Apps/purebasic-v620/logo.png
Name=PureBasic v6.20 (gtk3)
Comment=Developer Utility
Categories=Development
Exec=/home/michael/Apps/run_pb.sh /home/michael/Apps/purebasic-v620
Path=/home/michael/Apps/purebasic-v620/compilers
StartupNotify=true
Terminal=false
Create purebasic tool

Code: Select all

;-TOP

Global home.s, compiler.s, pbfile.s, libname.s, id, r1.s

pbfile = ProgramParameter(0)
libname = GetFilePart(pbfile, #PB_FileSystem_NoExtension)
compiler = "pbcompilerc"

If MessageRequester("Build Libray", "File: " + pbfile, #PB_MessageRequester_YesNo) <> #PB_MessageRequester_Yes
  End
EndIf
id = RunProgram(compiler, pbfile + " --optimizer --purelibrary --output " + libname, "",  #PB_Program_Open | #PB_Program_Read)
If Not id
  MessageRequester("Error", "Compiler not found: " + #LF$ + compiler)
  End
EndIf

While ProgramRunning(id)
  If AvailableProgramOutput(id)
    r1 + ReadProgramString(id) + #CRLF$
  EndIf
Wend
CloseProgram(id)
MessageRequester("Result:", r1)
Configure Tool with Arguments "%FILE"

;)
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
mk-soft
Always Here
Always Here
Posts: 6245
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Create User Library On Linux

Post by mk-soft »

My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply