Author Topic: Scriptbasic Build Linux  (Read 16443 times)

Offline John

  • Forum Support / SB Dev
  • Posts: 2967
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #45 on: November 29, 2018, 04:03:19 PM »
Too much overhead for my taste.

I would like to see SB being able to install in a user directory instead of at the OS level. Like what I'm doing with the Windows Inno install. It installs and uninstalls without a trace.

I think the MySQL dependency should be assumed installed and not included with the dependencies installed in the SB bin directory to support the other extension modules.

We could have a runtime setup shell script that sets up the SB environment.
« Last Edit: November 29, 2018, 05:14:47 PM by John »

Offline AIR

  • BASIC Developer
  • Posts: 781
Re: Scriptbasic Build Linux
« Reply #46 on: November 29, 2018, 05:12:02 PM »
Too much overhead for my taste.

I would like to see SB being able to install in a user directory instead of at the OS level. Like what I'm doing with the Windows Inno install. It installs and uninstalls without a trace.

You know if you unpack the folder structure into a folder in your home directory you can do this, right?  All you need to do is generate a config file that points to that location, and in your .bashrc file add:  export SCRIBACONF=<path to binary conf file>, and add the bin folder to your path

I've NEVER installed SB into a system path.

OR, if you don't want to bother modifying your .bashrc, you can do what I do, and run a script that sets this all on the fly:

Code: Bash
  1. #!/bin/bash
  2.  
  3. WORKDIR=$(dirname "$(readlink -f "$0")")
  4. export PATH=$PATH:"${WORKDIR}"/bin
  5. TEXT_CONF=$(mktemp)
  6. BINARY_CONF=$(mktemp)
  7. CONFIG="dll \".so\"
  8. module \"${WORKDIR}/module/\"
  9. include \"${WORKDIR}/include/\"
  10. maxstep 0
  11. maxlocalstep 0
  12. maxlevel 29666
  13. maxmem 0
  14. "
  15. echo "$CONFIG" > "${TEXT_CONF}"
  16. scriba -f ${BINARY_CONF} -k ${TEXT_CONF} 2>/dev/null
  17. export SCRIBACONF="${BINARY_CONF}"
  18. scriba $@
  19. [[ -e "${TEXT_CONF}" ]] && rm "${TEXT_CONF}"
  20. [[ -e "${BINARY_CONF}" ]] && rm "${BINARY_CONF}"

You put that into the root of the folder with the SB files, and you can either run it by providing the full path to that script or create a link to it in a folder that is in the path.

A third option would be to comment the last three lines in that script, and when you want to use SB you simply source it.

Code: Bash
  1. source <path to script>

Then you can just run scriba <sourcefile.bas> as you would normally.  You would need to do this each time you opened a terminal.

AIR.

Offline John

  • Forum Support / SB Dev
  • Posts: 2967
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #47 on: November 29, 2018, 05:18:07 PM »
I like the what you do option.  8)

Quote
I've NEVER installed SB into a system path.

That is how SB's traditional install works.
« Last Edit: November 29, 2018, 05:20:54 PM by John »

Offline AIR

  • BASIC Developer
  • Posts: 781
Re: Scriptbasic Build Linux
« Reply #48 on: November 29, 2018, 06:49:58 PM »
Here's a script I just wrote to create a self-extracting archive from a folder.  You can use it to pack up the SB binary folder.

You'll need both the 'zip' and 'unzip' packages installed on the machine you run this script on...

Code: Bash
  1. # pack.sh
  2. # quick script to create a self-extracting
  3. # zip file from a folder
  4. #
  5. # written by Armando I. Rivera (AIR)
  6. # BinaryMagic
  7.  
  8. #!/bin/bash
  9.  
  10. SRC="$1"
  11.  
  12. if [[ -n $SRC ]]; then
  13.     CURDIR="$PWD"
  14.     NAME="$(basename $SRC)"
  15.     TMP="$NAME".zip
  16.  
  17.     STUB=$(which unzipsfx)
  18.     if [[ $? == 0 ]]; then
  19.         echo "Creating $NAME.run file..."
  20.         cd $(dirname "$SRC")
  21.         zip -9 -r -q "$TMP" $NAME
  22.         cat "$STUB" "$TMP" > "$CURDIR/$NAME".run
  23.         chmod a+x "$CURDIR/$NAME".run
  24.         [[ -e "$TMP" ]] && rm "$TMP"
  25.     else
  26.         echo "You need to install the 'unzip' package"
  27.     fi
  28. else
  29.     echo "Usage:  $0 <source folder>"
  30. fi

EDIT:  Attached a sample file

AIR.
« Last Edit: November 29, 2018, 11:35:31 PM by AIR »

Offline John

  • Forum Support / SB Dev
  • Posts: 2967
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #49 on: November 29, 2018, 07:13:12 PM »
That's great AIR!

Sweet and simple.

Offline AIR

  • BASIC Developer
  • Posts: 781
Re: Scriptbasic Build Linux
« Reply #50 on: November 29, 2018, 07:13:44 PM »
If you have 7zip installed, it's even simpler:

Code: Bash
  1. 7za a -sfx sb64.run ~/Projects/sb/sb64

The difference in size is interesting:  The zip version, with max compression, is 1.2MB.  The 7z version, with standard compression, is 785k.

AIR.
« Last Edit: November 29, 2018, 07:20:00 PM by AIR »

Offline John

  • Forum Support / SB Dev
  • Posts: 2967
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #51 on: November 29, 2018, 07:31:03 PM »
 :D  8)  :-*

Offline John

  • Forum Support / SB Dev
  • Posts: 2967
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #52 on: November 29, 2018, 07:35:33 PM »
Are you planning to make the same archive / install available for the Rasberry Pi and Mac?

Offline AIR

  • BASIC Developer
  • Posts: 781
Re: Scriptbasic Build Linux
« Reply #53 on: November 29, 2018, 07:44:59 PM »
Are you planning to make the same archive / install available for the Rasberry Pi and Mac?

Simple, I can do that.

Here's one more script I just wrote:  I got tired of manually copying stuff over to a test folder in order to check things:

Code: Bash
  1. #!/bin/bash
  2.  
  3. DEST="$1"
  4.  
  5. if [[ -n $DEST ]];then
  6.     mkdir -p "$DEST"/{bin,include,module,lib}
  7.     cp bin/exe/* "$DEST/bin"
  8.     cp bin/lib/* "$DEST/lib"
  9.     cp bin/mod/dll/* "$DEST/module"
  10.     find extensions -name "*.bas" -exec cp {} "$DEST/include" \;
  11. fi
  12.  

AIR.

Offline John

  • Forum Support / SB Dev
  • Posts: 2967
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #54 on: November 29, 2018, 08:30:38 PM »
Now I need to refresh the Windows Inno install with the current code base.

Offline John

  • Forum Support / SB Dev
  • Posts: 2967
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #55 on: November 29, 2018, 08:37:49 PM »
I plan on creating another repository under the SB project to maintain / enhance secondary extension modules that use the GUI features of the OS.

Offline AIR

  • BASIC Developer
  • Posts: 781
Re: Scriptbasic Build Linux
« Reply #56 on: November 29, 2018, 08:45:18 PM »
I plan on creating another repository under the SB project to maintain / enhance secondary extension modules that use the GUI features of the OS.

Suggestion:  Make it extension modules only.

AIR.

Offline John

  • Forum Support / SB Dev
  • Posts: 2967
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #57 on: November 29, 2018, 08:51:31 PM »
That was the plan. Once that's completed, an example repo is next on my plate.

I should probably create a repo for binary distributions by platform.

A docs conversion from HTML to Markdown will happen along the way.
« Last Edit: November 29, 2018, 09:38:43 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 2967
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #58 on: November 29, 2018, 10:43:58 PM »
The instructions using 7z was confusing and the 7za a -sfx sb64.run ~/Projects/sb/sb64 command didn't work.


7z x sb64_7z.run

7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,4 CPUs AMD A6-3400M APU with Radeon(tm) HD Graphics (300F10),ASM)

Scanning the drive for archives:
1 file, 803273 bytes (785 KiB)

Extracting archive: sb64_7z.run
--
Path = sb64_7z.run
Type = 7z
Offset = 397008
Physical Size = 406265
Headers Size = 888
Method = LZMA:6m
Solid = +
Blocks = 1

Everything is Ok

Folders: 5
Files: 46
Size:       5109026
Compressed: 803273
jrs@jrs-laptop:~/sb/runtime$


When I tried to run AppRun I got a segment fault.


jrs@jrs-laptop:~/sb/runtime/sb64$ ./AppRun
Usage: basic [options] program.bas

options: -o file_name
            specify output file, save binary format to file but don't execute
         -b file_name
            load binary format from file and execute
         -n
            do not use cache (no save, no load)
         -e
            execute after binary format was saved
         -v
            print version info and stop
         -c
            inform scriba that this is a CGI script.
         -C
            save C program output.
         -E
            save executable output. (may not work under some OS)
         -p preprocessor
            specify external preprocessor.
         -i preprocessor
            specify internal preprocessor.
         -f configurationfile
            specify configuration file
         -d
            debug module error (UNIX only)
         -k text_config_file
            compile the configuration file to binary
         -D
            dump the configuration file in text format
./AppRun: line 18: 14029 Segmentation fault      (core dumped) scriba $@
jrs@jrs-laptop:~/sb/runtime/sb64$


Offline John

  • Forum Support / SB Dev
  • Posts: 2967
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #59 on: November 29, 2018, 10:55:49 PM »
I was able to get it to work by doing your source method.

Code: Bash
  1. #!/bin/bash
  2.  
  3. WORKDIR=$(dirname "$(readlink -f "$0")")
  4. export PATH=$PATH:"${WORKDIR}"/bin
  5. TEXT_CONF=$(mktemp)
  6. BINARY_CONF=$(mktemp)
  7. CONFIG="dll \".so\"
  8. module \"${WORKDIR}/module/\"
  9. include \"${WORKDIR}/include/\"
  10. maxstep 0
  11. maxlocalstep 0
  12. maxlevel 29666
  13. maxmem 0
  14. "
  15. echo "$CONFIG" > "${TEXT_CONF}"
  16. scriba -f ${BINARY_CONF} -k ${TEXT_CONF} 2>/dev/null
  17. export SCRIBACONF="${BINARY_CONF}"
  18.  


jrs@jrs-laptop:~/sb/runtime/sb64$ source AppRunLite
jrs@jrs-laptop:~/sb/runtime/sb64$ scriba -v
ScriptBasic v2.1
Variation >>STANDARD<< build 1
Magic value 859037496
Node size is 24
Extension interface version is 11
Compilation: Nov 28 2018 15:18:40
jrs@jrs-laptop:~/sb/runtime/sb64$ scriba -D
dll ".so"
module "/home/jrs/sb/runtime/sb64/module/"
include "/home/jrs/sb/runtime/sb64/include/"
maxstep 0
maxlocalstep 0
maxlevel 29666
maxmem 0
jrs@jrs-laptop:~/sb/runtime/sb64$