[Gambas-user] gb.dwg started

Tobias Boege taboege at gmail.com
Mon Dec 14 00:02:11 CET 2020


On Sun, 13 Dec 2020, Martin wrote:
> Hi,
> 
> I started to make the gb.dwg component I am following the instructions from
> Tobias Boege "Writing a native component for gambas" [0].
> 

Oh, I hate documents that don't have their creation date printed on them.
>From the svn revision 6903 mentioned in the text, I estimate this was
written in 2015. I haven't tracked how the process changed since then.

I still have the source code for that document and could rehost it (I am
no longer in control over my old student website) and correct any mistakes.

> The objective is to use the project made for Reini Urban [1] and of course
> the LibreDWG library.
> 
> [0] https://wasd.urz.uni-magdeburg.de/tboege/gambas/native_comp.pdf
> 
> [1] https://github.com/LibreDWG/gambas3-bindings
> 

Wow, I didn't know Reini Urban was interested in Gambas!

> So I follow the first steps.
> 
> 0) Install all the dependecies recomended by the web site for Arch distro (I
> use Manjaro) -> sudo pacman -Syu --needed --noconfirmalure ... here tthe
> option "--noconfirmalure" doesent work on my terminal then I decide not use
> it

This is almost surely a typo. "--noconfirmalure" should be two words:
"--noconfirm", which is an actual option of pacman (although I would
personally not use it when I install something interactively anyway),
and "alure", which is a dependency of gb.openal.

> 1) Download the source code - ok
> 
> 2 ) Made the gb.dw.conf file, then run ./make-compoente gb.dwg but doesent
> work properly, the message was:
> 
> which: no cpp in (/home/USER/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
> ./make-component: error: cpp was not found
> 

This indicates that you do not have a C compiler installed or one whose
preprocessor is not called "cpp". Install for example "gcc" on Arch Linux
and you should get your cpp.

Otherwise, make-component is just a convenience script. You do not have
to use it to make a functional new component. The cargo cult way which I
used more often than make-component is to copy a small native component
and adapt its source code. You can, in a clean Gambas repository,

  $ cp -r gb.gmp gb.dwg

and then adapt the following files

  gb.dwg/configure.ac
    - this is basically what you enter into gb.dwg.conf plus data
      on how the build process can figure out if the backing native
      library (something with "dwg"?) is installed or not

  gb.dwg/Makefile.am
    - rename GMP_DIR to DWG_DIR

  gb.dwg/src/gb.gmp.component
    - rename to gb.dwg.component and fill in correct information

  gb.dwg/src/Makefile.am
    - change all GMP to DWG and register your source files

  gb.dwg/src/*.{c,h}
    - this is your implementation, the files mentioned in the Makefile.am

and register the new component to the top-level build process via

  configure.ac
    - add gb.dwg to the long list of subdirectories

  Makefile.am
    - add your @dwg_dir@ to the long list of subdirectories

Then ./reconf-all && ./configure to see if it gets picked up.

Regards,
Tobias

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk


More information about the User mailing list