Switch to autotools.

Finally define specific versions in dependencies and switch to autotools
buildsystem. Hopefully this will give us better portability and won't induce
major headaches.
This commit is contained in:
Artem Savkov 2016-01-04 22:04:10 +01:00
parent f18239d9cb
commit 9d9eb5df04
7 changed files with 181 additions and 27 deletions

20
.gitignore vendored
View File

@ -1,2 +1,20 @@
*.la
*.lo
*.o
*.so
*.tar.*
.deps
.libs
aclocal.m4
autom4te.cache
build-aux
config.log
config.status
configure
debian
facebook/facebook-marshal.*
INSTALL
libtool
libtool.m4
lt*.m4
Makefile
Makefile.in

View File

@ -1,19 +0,0 @@
CC=gcc
CFLAGS+=`pkg-config --cflags bitlbee` -fPIC -Wall -g3 -ggdb -O0 -std=gnu99
LDFLAGS+=-shared
LDFLAGS+=`pkg-config --libs libwebsockets`
OBJS=discord.o discord-http.o discord-websockets.o discord-handlers.o discord-util.o
TARGET=discord.so
$(TARGET): $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
%.o: src/%.c
$(CC) $(CFLAGS) -c -o $@ $<
install: $(TARGET)
install -Dm 755 $(TARGET) "$(DESTDIR)/usr/lib/bitlbee/$(TARGET)"
clean:
rm -rf $(TARGET) *.o

18
Makefile.am Normal file
View File

@ -0,0 +1,18 @@
# Copyright 2016 Artem Savkov <artem.savkov@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
AUTOMAKE_OPTIONS = foreign
ACLOCAL_AMFLAGS = -Im4
SUBDIRS = src

25
README
View File

@ -19,29 +19,40 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
Build dependencies
------------------
- bitlbee and headers
- bitlbee and headers >= 3.4
If using distribution version of bitlbee you will need to install the dev
package, usually bitlbee-dev or bitlbee-devel. If bitlbee was built from
source don't forget to do `make install-dev`.
- libwebsockets >= 1.5 and headers (https://libwebsockets.org)
- libwebsockets >= 1.6 and headers (https://libwebsockets.org)
Archlinux users can use libwebsocket-git from AUR, others are out of luck and
will have to build it from source for now, debian's version in sid is too old
(1.2), fedora23 doesn't provide this package at all.
- glib2 and headers
- glib2 and headers => 2.32
The library itself is usually installed as a dependency of bitlbee, headers
need to be installed separately. In debian the package containing them is
libglib2.0-dev.
- autotools (if building from git)
A bit of an overkill, but autotools is a buildsystem of choice now, sorry.
Building and Installing
-----------------------
The process is extremely dumb for now, so it is just:
If building from git you will first need to generate autotools configuration
script and related files by executing the following command:
$ make && sudo make install
$ ./autogen.sh
This will build the discord.so file and put it into /usr/lib/bitlbee directory,
if your bitlbee's plugindir is somewhere else you'll have to move it manually.
After that (or when building from a tarball) you can build as usual:
$ ./configure
$ make
$ sudo make install
If your bitlbee's plugindir is in non-standard location you can specify it by
calling ./configure with --with-plugindir=/path/to/plugindir option.
Usage
-----

17
autogen.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
# Copyright 2016 Artem Savkov <artem.savkov@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
autoreconf --verbose --force --install

68
configure.ac Normal file
View File

@ -0,0 +1,68 @@
# Copyright 2016 Artem Savkov <artem.savkov@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
AC_INIT(
[bitlbee-discord],
[0.1.0],
[https://github.com/sm00th/bitlbee-discord/issues],
[bitlbee-discord],
[https://github.com/sm00th/bitlbee-discord],
)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([no-define])
AC_PROG_CC
AM_PROG_CC_C_O
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
m4_ifdef([AC_PROG_CC_C99], [AC_PROG_CC_C99])
# Checks for libraries.
PKG_CHECK_MODULES([BITLBEE], [bitlbee >= 3.4])
PKG_CHECK_MODULES([LIBWEBSOCKETS], [libwebsockets >= 1.6])
PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.32])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
# Checks for library functions.
AC_CHECK_FUNCS([memset])
# bitlbee-specific stuff
AC_ARG_WITH([plugindir],
[AS_HELP_STRING([--with-plugindir], [BitlBee plugin directory])],
[plugindir="$with_plugindir"]
)
AS_IF(
[test -z "$plugindir"],
[PKG_CHECK_VAR(
[BITLBEE_PLUGINDIR],
[bitlbee],
[plugindir],
[plugindir="$BITLBEE_PLUGINDIR"],
[plugindir="$libdir/bitlbee"]
)]
)
AC_SUBST([plugindir])
AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT

41
src/Makefile.am Normal file
View File

@ -0,0 +1,41 @@
# Copyright 2016 Artem Savkov <artem.savkov@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
libdir = $(plugindir)
lib_LTLIBRARIES = discord.la
discord_la_CFLAGS = \
$(BITLBEE_CFLAGS) \
$(GLIB_CFLAGS) \
$(LIBWEBSOCKETS_CFLAGS) \
-Wall
discord_la_LDFLAGS = \
-module \
-avoid-version \
$(GLIB_LIBS) \
$(LIBWEBSOCKETS_LIBS)
discord_la_SOURCES = \
discord.c \
discord.h \
discord-handlers.c \
discord-handlers.h \
discord-http.c \
discord-http.h \
discord-util.c \
discord-util.h \
discord-websockets.c \
discord-websockets.h