Author Topic: Scriptbasic Build Linux  (Read 9226 times)

Offline John

  • Forum Support / SB Dev
  • Posts: 2752
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #210 on: June 21, 2019, 07:06:29 PM »
All I see is merge request in project setup.

The only MERGE request is when I merged in your SB-DEV into a publc version,

The setup merge request is granted to those with access. I assume a public repo is access to all.

git push -o merge_request.create

It seems that simple.
« Last Edit: June 21, 2019, 07:45:29 PM by John »

Offline AIR

  • BASIC Developer
  • Posts: 685
Re: Scriptbasic Build Linux
« Reply #211 on: June 21, 2019, 08:05:04 PM »
Update your local copy, I made changes to builder.c

instead of creating sb.a, create libsb.a and copy into the same location as libscriba.a

gcc -Os testfor.c  -L /home/riveraa/sb/lib -ldl -lsb /home/riveraa/sb/lib/lscriba.a -lm -lpthread -o testfor

$ ./testfor
-5
-4
-3
-2
-1
0
1
2
3
4
5

ls -l testfor
-rwxr-xr-x 1 riveraa riveraa 723K Jun 21 22:54 testfor

$ file testfor
testfor: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=06583752c8146c209ac58d561ada06960fe30f79, not stripped


$ ldd testfor
    linux-vdso.so.1 (0x00007fffd98c6000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f6db5b5a000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6db5856000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6db5639000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6db529a000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f6db6006000)

« Last Edit: June 21, 2019, 08:08:19 PM by AIR »

Offline John

  • Forum Support / SB Dev
  • Posts: 2752
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #212 on: June 21, 2019, 08:21:34 PM »
That looks like it static linked libscriba. 723KB?

I was see about 24KB before.

I could use the -E option and append the script to scriba and save a lot of time.
« Last Edit: June 21, 2019, 08:23:25 PM by John »

Offline AIR

  • BASIC Developer
  • Posts: 685
Re: Scriptbasic Build Linux
« Reply #213 on: June 21, 2019, 09:10:19 PM »
So just link libscriba then.As I've said on numerous occasions, I do not install sb at the system level.  So this test won't find libscriba.so because it's not in my ld-cache

Offline John

  • Forum Support / SB Dev
  • Posts: 2752
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #214 on: June 21, 2019, 09:32:41 PM »
Sounds like you fixed it.

Scriba running as a shared object with multiple C stub scripts runs really well.

Thanks for your help with this!

It looks like we picked up a SB under the covers developer on the RPi forum. It seems he fixed the extension module error issue Hippy reported.


Offline John

  • Forum Support / SB Dev
  • Posts: 2752
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #215 on: June 21, 2019, 09:56:35 PM »
I still can't get it to compile.


jrs@jrs-laptop:~/sb/2c$ gcc -Os testfor.c -I /home/jrs/sb_source/sb-dev-cleanup/ -ldl -lsb -lscriba -lm -lpthread -o testfor
testfor.c:40:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
 main(int argc, char *argv[], char *env[]){stndlone(argc,argv,env);}
 ^~~~
testfor.c: In function ‘main’:
testfor.c:40:43: warning: implicit declaration of function ‘stndlone’ [-Wimplicit-function-declaration]
 main(int argc, char *argv[], char *env[]){stndlone(argc,argv,env);}
                                           ^~~~~~~~
/usr/bin/ld: //usr/local/lib/libsb.a(dynlolib.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/libdl.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
jrs@jrs-laptop:~/sb/2c$


Offline AIR

  • BASIC Developer
  • Posts: 685
Re: Scriptbasic Build Linux
« Reply #216 on: June 22, 2019, 08:25:14 AM »
Which branch are you on?  Fix was pushed to MASTER.

Did you do a full rebuild (make clean - ./setup)
This is working on both my Mac and Linux boxes.


Offline John

  • Forum Support / SB Dev
  • Posts: 2752
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #217 on: June 22, 2019, 09:22:54 AM »
I'll try a fresh pull and build and see if that fixes it.

What would be the easiest way to update the source licence notice from LGPL to MIT?

I need to replace this:


--GNU LGPL
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


With this in all the source files with the above.


Common MIT License - Jan 31, 2018

ScriptBasic Copyright (c) 2018 Peter Verhas

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


Can this be done with grep ?
« Last Edit: June 22, 2019, 12:14:35 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 2752
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #218 on: June 22, 2019, 11:31:43 AM »
It seems the fix for the extension module error reporting works. Hippy is a happy camper.

Offline AIR

  • BASIC Developer
  • Posts: 685
Re: Scriptbasic Build Linux
« Reply #219 on: June 22, 2019, 12:46:45 PM »
Code: Script BASIC
  1. function loadFile (fname)
  2.     local tmpStr
  3.     open fname for input as #1
  4.     while not eof(1)
  5.         line input #1,s
  6.         tmpStr &= s
  7.     WEND
  8.     close #1
  9.     loadFile = tmpStr
  10. end function
  11.  
  12. old = loadFile("oldLicense.txt")
  13. new = loadFile("newLicense.txt")
  14. cFile = loadFile("basext.c")
  15.  
  16. res = replace(cFile,old,new)
  17. print res,"\n"

You just need to recursively find all the *.c files, write something that loops over each, replace the string, and output the updated file.

grep/awk/sed all will have a problem here because of what each thinks is embedded control characters.  Besides, it's a chance to show how something like this would be done in SB.  So go for it....


A.

Offline John

  • Forum Support / SB Dev
  • Posts: 2752
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #220 on: June 22, 2019, 12:56:34 PM »
Perfect!

I'll use your script as a base to get this done.

ScriptBasic - Directory / File Access

Next on the list is to round up all the SB  examples spread out all over the place.
« Last Edit: June 22, 2019, 01:23:38 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 2752
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #221 on: June 22, 2019, 04:29:11 PM »
Here is a list of the .c source files that were updated and skipped. The sandbox has been updated.

The script only took a second or two. I should have timed it.   :-[

Code: Script BASIC
  1. ' Update ScriptBasic license to Common MIT
  2.  
  3. fn = FREEFILE
  4.  
  5. LGPL = """--GNU LGPL
  6. This library is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU Lesser General Public
  8. License as published by the Free Software Foundation; either
  9. version 2.1 of the License, or (at your option) any later version.
  10.  
  11. This library is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. Lesser General Public License for more details.
  15.  
  16. You should have received a copy of the GNU Lesser General Public
  17. License along with this library; if not, write to the Free Software
  18. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  19. """
  20.  
  21.  
  22. MIT = """Common MIT License - Jan 31, 2018
  23.  
  24. ScriptBasic Copyright (c) 2018 Peter Verhas
  25.  
  26. Permission is hereby granted, free of charge, to any person obtaining a copy
  27. of this software and associated documentation files (the "Software"), to deal
  28. in the Software without restriction, including without limitation the rights
  29. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  30. copies of the Software, and to permit persons to whom the Software is
  31. furnished to do so, subject to the following conditions:
  32.  
  33. The above copyright notice and this permission notice shall be included in all
  34. copies or substantial portions of the Software.
  35.  
  36. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  37. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  38. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  39. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  40. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  41. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  42. SOFTWARE.
  43. """
  44.  
  45. DName = "/home/jrs/repo/sb-dev"
  46. OPEN DIRECTORY DName PATTERN "*.c" OPTION sbCollectFiles AND SbCollectFullPath AND SbCollectRecursively AS #fn
  47. RESET DIRECTORY #fn
  48. GOSUB READ_DIR
  49. CLOSE DIRECTORY #fn
  50.  
  51. END
  52.  
  53. READ_DIR:
  54.  
  55. FName = NEXTFILE(fn)
  56. IF FName = undef THEN RETURN
  57. OPEN FName FOR BINARY AS #1
  58. flen = FILELEN(FName)
  59. src = INPUT(flen,1)
  60. IF src LIKE "*--GNU LGPL*" THEN
  61.   PRINT "(F) - " & FName,"\n"
  62.   newsrc = REPLACE(src,LGPL,MIT,1,1)
  63.   SEEK #1, 0
  64.   PRINT #1, newsrc
  65. ELSE
  66.   PRINT "(S) - " & FName,"\n"
  67. END IF
  68. CLOSE(1)
  69. GOTO READ_DIR
  70.  


jrs@jrs-laptop:~/sb/doc_upd$ scriba updlic.sb
(F) - /home/jrs/repo/sb-dev/expression.c
(F) - /home/jrs/repo/sb-dev/report.c
(F) - /home/jrs/repo/sb-dev/matchc.c
(F) - /home/jrs/repo/sb-dev/dynlolib.c
(S) - /home/jrs/repo/sb-dev/testconf.c
(F) - /home/jrs/repo/sb-dev/testalloc.c
(F) - /home/jrs/repo/sb-dev/prepext.c
(S) - /home/jrs/repo/sb-dev/confpile.c
(F) - /home/jrs/repo/sb-dev/filesys.c
(S) - /home/jrs/repo/sb-dev/extensions/ftpd/interface.c
(S) - /home/jrs/repo/sb-dev/extensions/ip/interface.c
(S) - /home/jrs/repo/sb-dev/extensions/ip/iptools.c
(F) - /home/jrs/repo/sb-dev/extensions/curl/interface.c
(S) - /home/jrs/repo/sb-dev/extensions/sqlite/interface.c
(F) - /home/jrs/repo/sb-dev/extensions/dbg/interface.c
(F) - /home/jrs/repo/sb-dev/extensions/dbg/dbg_con.c
(S) - /home/jrs/repo/sb-dev/extensions/trial/interface.c
(S) - /home/jrs/repo/sb-dev/extensions/t/interface.c
(S) - /home/jrs/repo/sb-dev/extensions/mxml/mxml-node.c
(S) - /home/jrs/repo/sb-dev/extensions/mxml/interface.c
(S) - /home/jrs/repo/sb-dev/extensions/mxml/mxml-entity.c
(S) - /home/jrs/repo/sb-dev/extensions/mxml/mxml-private.c
(S) - /home/jrs/repo/sb-dev/extensions/mxml/mxml-file.c
(S) - /home/jrs/repo/sb-dev/extensions/mxml/mxml-get.c
(S) - /home/jrs/repo/sb-dev/extensions/mxml/mxml-index.c
(S) - /home/jrs/repo/sb-dev/extensions/mxml/mxml-search.c
(S) - /home/jrs/repo/sb-dev/extensions/mxml/mxml-string.c
(S) - /home/jrs/repo/sb-dev/extensions/mxml/mxml-set.c
(S) - /home/jrs/repo/sb-dev/extensions/mxml/mxml-attr.c
(S) - /home/jrs/repo/sb-dev/extensions/cgi/interface.c
(S) - /home/jrs/repo/sb-dev/extensions/cgi/cgi.c
(S) - /home/jrs/repo/sb-dev/extensions/mysql/interface.c
(S) - /home/jrs/repo/sb-dev/extensions/ux/interface.c
(S) - /home/jrs/repo/sb-dev/extensions/gmp2/interface.c
(S) - /home/jrs/repo/sb-dev/extensions/json/interface.c
(S) - /home/jrs/repo/sb-dev/extensions/json/parson.c
(F) - /home/jrs/repo/sb-dev/extensions/curses/interface.c
(S) - /home/jrs/repo/sb-dev/extensions/sbt/interface.c
(S) - /home/jrs/repo/sb-dev/extensions/hash/interface.c
(S) - /home/jrs/repo/sb-dev/extensions/zlib/interface.c
(S) - /home/jrs/repo/sb-dev/extensions/nt/interface.c
(F) - /home/jrs/repo/sb-dev/extensions/sdbg/interface.c
(F) - /home/jrs/repo/sb-dev/extensions/sdbg/sdbg_con.c
(F) - /home/jrs/repo/sb-dev/extensions/cio/interface.c
(S) - /home/jrs/repo/sb-dev/extensions/odbc/interface.c
(S) - /home/jrs/repo/sb-dev/extensions/slre/interface.c
(S) - /home/jrs/repo/sb-dev/extensions/slre/slre.c
(F) - /home/jrs/repo/sb-dev/extensions/mt/interface.c
(S) - /home/jrs/repo/sb-dev/extensions/dyc/interface.c
(F) - /home/jrs/repo/sb-dev/extensions/rpool.c
(F) - /home/jrs/repo/sb-dev/command.c
(S) - /home/jrs/repo/sb-dev/errcodes.c
(S) - /home/jrs/repo/sb-dev/lmt_httpd.c
(S) - /home/jrs/repo/sb-dev/cftd.c
(S) - /home/jrs/repo/sb-dev/logger.c
(F) - /home/jrs/repo/sb-dev/execute.c
(S) - /home/jrs/repo/sb-dev/notimp.c
(S) - /home/jrs/repo/sb-dev/variations/ftpd/ftpsrv.c
(S) - /home/jrs/repo/sb-dev/variations/httpd/websrv.c
(S) - /home/jrs/repo/sb-dev/variations/httpd/service.c
(S) - /home/jrs/repo/sb-dev/variations/standalone/basicc.c
(F) - /home/jrs/repo/sb-dev/variations/standalone/libscriba.c
(S) - /home/jrs/repo/sb-dev/variations/win32dll/basicdll.c
(F) - /home/jrs/repo/sb-dev/variations/standard/scribacmd.c
(S) - /home/jrs/repo/sb-dev/variations/standard/basiccmd.c
(F) - /home/jrs/repo/sb-dev/builder.c
(S) - /home/jrs/repo/sb-dev/lmt_cio.c
(F) - /home/jrs/repo/sb-dev/conftree.c
(S) - /home/jrs/repo/sb-dev/lmt_none.c
(S) - /home/jrs/repo/sb-dev/lsp.c
(F) - /home/jrs/repo/sb-dev/match.c
(S) - /home/jrs/repo/sb-dev/tools/calldllbasic.c
(S) - /home/jrs/repo/sb-dev/tools/mt19937.c
(S) - /home/jrs/repo/sb-dev/tools/md5.c
(S) - /home/jrs/repo/sb-dev/tools/fork.c
(S) - /home/jrs/repo/sb-dev/thread.c
(F) - /home/jrs/repo/sb-dev/lexer.c
(F) - /home/jrs/repo/sb-dev/stndlone.c
(S) - /home/jrs/repo/sb-dev/hndlptr.c
(F) - /home/jrs/repo/sb-dev/ipreproc.c
(S) - /home/jrs/repo/sb-dev/buildnum.c
(S) - /home/jrs/repo/sb-dev/httpd.c
(F) - /home/jrs/repo/sb-dev/reader.c
(F) - /home/jrs/repo/sb-dev/basext.c
(F) - /home/jrs/repo/sb-dev/memory.c
(S) - /home/jrs/repo/sb-dev/mynotimp.c
(S) - /home/jrs/repo/sb-dev/lmt_wx.c
(S) - /home/jrs/repo/sb-dev/mygmtime.c
(F) - /home/jrs/repo/sb-dev/commands/string.c
(F) - /home/jrs/repo/sb-dev/commands/if.c
(S) - /home/jrs/repo/sb-dev/commands/time.c
(F) - /home/jrs/repo/sb-dev/commands/print.c
(F) - /home/jrs/repo/sb-dev/commands/external.c
(F) - /home/jrs/repo/sb-dev/commands/mathfunc.c
(F) - /home/jrs/repo/sb-dev/commands/file.c
(F) - /home/jrs/repo/sb-dev/commands/goto.c
(F) - /home/jrs/repo/sb-dev/commands/let.c
(F) - /home/jrs/repo/sb-dev/commands/environ.c
(F) - /home/jrs/repo/sb-dev/commands/extops.c
(F) - /home/jrs/repo/sb-dev/commands/function.c
(F) - /home/jrs/repo/sb-dev/commands/while.c
(F) - /home/jrs/repo/sb-dev/commands/mathops.c
(F) - /home/jrs/repo/sb-dev/sym.c
(S) - /home/jrs/repo/sb-dev/examples/debug.c
(F) - /home/jrs/repo/sb-dev/scriba.c
(F) - /home/jrs/repo/sb-dev/uniqfnam.c
(F) - /home/jrs/repo/sb-dev/options.c
(F) - /home/jrs/repo/sb-dev/hookers.c
(F) - /home/jrs/repo/sb-dev/myalloc.c
(S) - /home/jrs/repo/sb-dev/md5.c
(F) - /home/jrs/repo/sb-dev/epreproc.c
(S) - /home/jrs/repo/sb-dev/getopt.c
(F) - /home/jrs/repo/sb-dev/modumana.c
jrs@jrs-laptop:~/sb/doc_upd$


F = Found
S = Skipped





« Last Edit: June 22, 2019, 05:03:11 PM by John »

Offline AIR

  • BASIC Developer
  • Posts: 685
Re: Scriptbasic Build Linux
« Reply #222 on: June 22, 2019, 05:41:15 PM »
scriba.c has a slightly different form of the license.  A few other files reference the LGPL in some way.

do a "grep -ir lgpl *" at the root of the source tree to see what I mean.



Offline John

  • Forum Support / SB Dev
  • Posts: 2752
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #223 on: June 22, 2019, 05:48:31 PM »
It's a start.

It's going to be a file by file of the (S) list to determine if it's part of the source tree or an axillary support based source file.

I should probably TRUNCATE the file before writing out the new source. In this case the replace string was larger so it wasn't a factor.
« Last Edit: June 22, 2019, 05:54:31 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 2752
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #224 on: June 22, 2019, 06:18:12 PM »
That sucks!

I got ahead of myself printing (F) when REPLACE failed with a mismatch.

Code: Script BASIC
  1. IF src <> newsrv THEN ....
  2.  
« Last Edit: June 22, 2019, 06:25:41 PM by John »