Re: How to install modules in Pike? I'd like to do GTK2 in Pike, but the module is not installed

2023-08-25 Thread william

Hi Ken-

Apologies for the long post.

I'm primarily a MacOS user here, and I've had nothing but frustration 
with MacPorts. In fact, I tried to submit fixes for the problem you're 
referring to all those years ago and was met with silence. I eventually 
gave up trying. I can provide assistance if you'd like to try your hand 
at getting the problem resolved.


The home-brew port of pike was my handy-work and it's completely 
up-to-date. There are a lot of things about home-brew that I don't like, 
but it seems to have the lion's share of the market. The version of 
autotools works  for building pike (I use an isolated brew install for 
the ancillary build tools when I'm preparing the "official" binary that 
you describe using below).


Details of how I prepare those builds is described in this document:

http://wiki.gotpike.org/PikeDevel/Pike+Distribution+on+OSX

Most of the effort surrounds getting a known set of static libraries to 
build against and avoiding picking up dynamic library references from 
things that won't be present on a stock system (like macports or 
home-brew installed libraries).


I also have a port of pike for pkgsrc, which is installable on MacOS, 
and it's pretty well tested. I've been meaning to have it included in 
the official repository, but haven't found the time to send an email 
about it (a poor excuse, I realize).


Now, to your specific problem:

If you've installed the binary distribution from the pike website and 
want to build and install a module that wasn't included in the binary 
dist, it's actually fairly straightforward to do:


1. Install any prerequisites you might need
2. Download and pack the /source/ distribution for the version of pike 
you've got.
3. Go into the directory of the module you want to build 
(Pike-v8.0.1738/src/post_modules/GTK2)
4. Run pike -x module and watch the configuration process to make sure 
it's found your dependencies.
5. If it's not finding your dependencies, you'll probably need to add 
those directories to the appropriate places in the specs file, which is 
located in the /path/to/pike/include/pike/specs
5a. Run pike -x module spotless to remove all build products before 
rebuilding.
6. Repeat 4 through 5 until it's finding things and building a module 
with the support you want.

7. sudo pike -x module install

As an example, I did this with home-brew, and the path of least 
resistance for me was to install autoconf, pkg-config and gtk+. I added 
-I/opt/homebrew/include to the Makefile wherever -I were also found, and 
also changed the include of image.h in pgtk.h to point to the absolute 
path to that file, which is is in src/modules/Image. I was then able to 
build and install GTK2 and test it out using the following code:


Alert.pike:

#pike __REAL_VERSION__

// Create a simple alert window. The default title is @expr{Alert@}. A
// single button @expr{Ok@} will be created. Pressing it removes the
// dialog.

inherit GTK2.Dialog;

void begone(object w2)
{
  this->hide();
  destruct( this );
}

object ok_button;

//! Returns the ok @[Button] object.
GTK2.Button ok()
{
  return ok_button;
}

//!
void create(string text, string|void title)
{
  ::create();
  object l = GTK2.Label( text );
  set_title( title||"Alert" );
  l->set_justify( GTK2.JUSTIFY_LEFT );
  l->set_alignment(0.0, 0.5);
  l->set_padding( 20, 20 );
  vbox()->add( l->show() );
  ok_button = GTK2.Button("OK");
  ok_button->signal_connect( "clicked", begone );
  action_area()->add( ok_button->show() );
  show();
}

test.pike:

object alert;

int main()
{
  GTK2.gtk_init();
  alert = .Alert("Hello world!\n");
  alert -> signal_connect("hide", lambda(){ werror("whee!\n"); exit(0); 
});

  return -1;
}

I adapted the GTKSupport.pmod/Alert.pike from GTK1 to GTK2. For some 
reason, the destroy signal isn't being triggered when the Alert object 
is destroyed in begone(). Perhaps some GTK2 wizard will have more 
details about that. I worked around it by triggering exit() when the 
alert is hidden.


Hope this helps... don't hesitate to get in touch with any questions or 
comments.


Bill

On 2023-08-24 00:34, Kenneth Wolcott wrote:

Hi Bill;

  Thanks for your response.

  It looks like I'm in a crippled state :-(

  I am unable to build from source because I can't seem to get the
correct and functional version of the autoconf family installed (I'm
on a Mac, M1 chip and using MacPorts).

  The version of pike on MacPorts fails to build (supposedly
unofficially unsupported on MacPorts for 15 years??!!)

  I was able to download and install the Pike binary
(Pike-v8.0.1738-MacOSX-12.0-arm64 from
https://pike.lysator.liu.se/download/pub/pike/latest-stable/), install
it and use it, but it looks like all I have is a binary.

  So it looks like all I can have is a Pike binary with the modules
that come with the binary, no ability to build or import additional
packages (as far as I can tell).

  I have lots of pertinent MacPorts ports (packages) installed, such
as gtk2 and gtk3...


Re: How to install modules in Pike? I'd like to do GTK2 in Pike, but the module is not installed

2023-08-23 Thread Kenneth Wolcott
Hi Bill;

  Thanks for your response.

  It looks like I'm in a crippled state :-(

  I am unable to build from source because I can't seem to get the
correct and functional version of the autoconf family installed (I'm
on a Mac, M1 chip and using MacPorts).

  The version of pike on MacPorts fails to build (supposedly
unofficially unsupported on MacPorts for 15 years??!!)

  I was able to download and install the Pike binary
(Pike-v8.0.1738-MacOSX-12.0-arm64 from
https://pike.lysator.liu.se/download/pub/pike/latest-stable/), install
it and use it, but it looks like all I have is a binary.

  So it looks like all I can have is a Pike binary with the modules
that come with the binary, no ability to build or import additional
packages (as far as I can tell).

  I have lots of pertinent MacPorts ports (packages) installed, such
as gtk2 and gtk3...

  Anyway, the most important thing for me right now is to enjoy the
builtin big integer support and the fact that Pike is interpreted (no
edit/build/run cycle) and test out some things that is harder to do in
C.  I'm coming from a Perl background (retired software build
engineer) and am exploring things now that I never had time to do
before.  I really liked Ada when I was in college, so I'm re-learning
it and intending to master it,  I'm learning a lot from the Rosetta
Code web site.  I'm also fiddling around with Pike, Wren, Lua, Go, D,
Ruby and Rust.

Thanks,
Ken



On Wed, Aug 23, 2023 at 7:12 PM William Welliver  wrote:
>
> Hi Ken,
>
> If you’ve installed pike from a package, there will usually be a set of 
> additional packages for modules that have extra dependencies, like gtk and 
> various databases. You can use your package manager to explore and install 
> those “add on” packages.
>
> If you’ve installed pike by compiling from source, then chances are you 
> didn’t have a necessary dependency installed when you did the build. The 
> easiest way to get just the module you want compiled and installed is to do 
> this:
>
> $ cd src/post_modules/GTK2
> $ pike -x module
> $ sudo pike -x module install
>
> I’m remembering the path from memory so you might need to adjust that. Also, 
> you should inspect the output of the configure step during the module build 
> to make sure it found the needed components.
>
> Hope this helps! Don’t hesitate to reply back if you have any additional 
> questions or problems.
>
> Bill
>
> > On Aug 23, 2023, at 8:03 PM, Kenneth Wolcott  
> > wrote:
> >
> > Hi!
> >
> > Brand-new noob here.
> >
> > How to install modules in Pike?  I'd like to do GTK2 in Pike, but the
> > module is not installed
> >
> > I read the beginner guide and a great deal of the main manual.
> >
> > The hello.pike example won't execute because I don't have the GTK
> > module installed.
> >
> > I have not yet seen any instructions on how to add a Pike module that
> > was not installed as a part of Pike.
> >
> > Thanks,
> > Ken Wolcott
> >
>



Re: How to install modules in Pike? I'd like to do GTK2 in Pike, but the module is not installed

2023-08-23 Thread William Welliver
Hi Ken,

If you’ve installed pike from a package, there will usually be a set of 
additional packages for modules that have extra dependencies, like gtk and 
various databases. You can use your package manager to explore and install 
those “add on” packages. 

If you’ve installed pike by compiling from source, then chances are you didn’t 
have a necessary dependency installed when you did the build. The easiest way 
to get just the module you want compiled and installed is to do this: 

$ cd src/post_modules/GTK2
$ pike -x module
$ sudo pike -x module install

I’m remembering the path from memory so you might need to adjust that. Also, 
you should inspect the output of the configure step during the module build to 
make sure it found the needed components. 

Hope this helps! Don’t hesitate to reply back if you have any additional 
questions or problems.

Bill

> On Aug 23, 2023, at 8:03 PM, Kenneth Wolcott  wrote:
> 
> Hi!
> 
> Brand-new noob here.
> 
> How to install modules in Pike?  I'd like to do GTK2 in Pike, but the
> module is not installed
> 
> I read the beginner guide and a great deal of the main manual.
> 
> The hello.pike example won't execute because I don't have the GTK
> module installed.
> 
> I have not yet seen any instructions on how to add a Pike module that
> was not installed as a part of Pike.
> 
> Thanks,
> Ken Wolcott
> 



How to install modules in Pike? I'd like to do GTK2 in Pike, but the module is not installed

2023-08-23 Thread Kenneth Wolcott
Hi!

Brand-new noob here.

How to install modules in Pike?  I'd like to do GTK2 in Pike, but the
module is not installed

I read the beginner guide and a great deal of the main manual.

The hello.pike example won't execute because I don't have the GTK
module installed.

I have not yet seen any instructions on how to add a Pike module that
was not installed as a part of Pike.

Thanks,
Ken Wolcott