Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 May 2019 17:07:02 +0200
From:      Pascal Christen <pascal@pascalchristen.ch>
To:        "freebsd-ports" <freebsd-ports@freebsd.org>
Subject:   Static port with mysqlclient
Message-ID:  <16aa24885be.10b46bcc3219166.4958111780842889251@pascalchristen.ch>

next in thread | raw e-mail | index | archive | help
Hi

I'm trying to build a static c program with a port. How do I achieve that?

Let's say, thats my code:

#include <mysql.h>
#include <stdio.h>
int main()
{
   printf("Hello, World!");
   printf("MySQL client version: %s\n", mysql_get_client_info());
   return 0;
}

Let's say, that's my Makefile:
CC=gcc
LIBS = `mysql_config --libs`
CFLAGS = `mysql_config --cflags` -Wall

compile:
	$(CC) -static -o blabla test.c $(LIBS) $(CFLAGS)

which produces that:
# make
gcc8 -static -o blabla test.c `mysql_config --libs` `mysql_config --cflags` -Wall
# ./blabla 
Hello, World!MySQL client version: 10.1.39-MariaDB


And how do I wrap around a FreeBSD port, which builds with correct mysql-Version?

Thanks for helping me out!









Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?16aa24885be.10b46bcc3219166.4958111780842889251>