Compare commits

...

19 Commits

Author SHA1 Message Date
4d0ea35ff2 format: import a template plug-in 2025-04-27 00:29:24 +02:00
7a6fc23c41 Import the newer scripts from DeforaOS configure 2024-12-20 21:29:24 +01:00
094ac6db9c GitHub: introduce a test workflow
This is performed on pushes and pull-up requests to the master branch.
2024-12-20 21:16:16 +01:00
9a987cf874 Prepare to release DeforaOS Asm 0.2.7 2022-10-17 02:06:47 +02:00
8b2e46be98 arch: fix the tests on Linux 2022-10-17 02:01:35 +02:00
a9e9e3284d Update the copyright notice 2022-10-17 01:54:12 +02:00
793314a6ba arch/java: avoid a compilation warning 2022-10-17 01:54:03 +02:00
b22f5b98dd Update the copyright notice 2022-10-17 00:36:25 +02:00
efcb29c302 tests: improve the output on macOS 2022-10-17 00:36:13 +02:00
83c3c7666d Update the copyright notice 2022-10-17 00:33:50 +02:00
30690addb2 format/elf: fix the offsets for the native architectures
This also fixes the build on platforms with no native support.

Reported by Havard Eines of the NetBSD Foundation; thanks!
2022-10-17 00:33:25 +02:00
18d418bb27 Prepare to release DeforaOS Asm 0.2.6 2022-04-30 21:10:05 +02:00
10853ea4f5 src/python: provide a default Makefile
This should help fix "make distcheck".
2022-04-30 21:05:34 +02:00
9a2cfda0dc Fix the build on macOS 2022-04-30 21:05:01 +02:00
fb6a6c31b6 Update the copyright notice 2022-04-30 21:05:01 +02:00
dd59c1861c format/elf: provide a replacement for <elf.h> on macOS
This was obtained from NetBSD 9.2.
2022-04-30 21:05:01 +02:00
46ec0bfbae Actually use gtkdocentities.ent 2022-04-30 05:44:57 +02:00
04f5029cc5 Prepare to release DeforaOS Asm 0.2.5 2022-04-30 05:21:51 +02:00
e96ec3fefb Import Asm-sections.txt 2022-04-30 05:19:48 +02:00
16 changed files with 1883 additions and 118 deletions

View File

@ -0,0 +1,29 @@
name: DeforaOS C CI (ubuntu-latest)
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: bootstrap libSystem
run: git clone https://github.com/DeforaOS/libSystem.git libSystem && for dir in include data src; do (cd libSystem/$dir && make PREFIX="$HOME/opt/DeforaOS" install); done
- name: bootstrap configure
run: git clone https://github.com/DeforaOS/configure.git configure && (cd configure/src && PKG_CONFIG_PATH="$HOME/opt/DeforaOS/lib/pkgconfig" make PREFIX="$HOME/opt/DeforaOS" install)
- name: bootstrap CPP
run: git clone https://github.com/DeforaOS/CPP.git CPP && (cd CPP && PKG_CONFIG_PATH="$HOME/opt/DeforaOS/lib/pkgconfig" make PREFIX="$HOME/opt/DeforaOS" install)
- name: configure
run: $HOME/opt/DeforaOS/bin/configure -p "$HOME/opt/DeforaOS"
- name: make
run: PKG_CONFIG_PATH="$HOME/opt/DeforaOS/lib/pkgconfig" make CCSHARED="cc -shared"
- name: make tests
run: PKG_CONFIG_PATH="$HOME/opt/DeforaOS/lib/pkgconfig" make CCSHARED="cc -shared" tests
- name: make distcheck
run: PKG_CONFIG_PATH="$HOME/opt/DeforaOS/lib/pkgconfig" make CCSHARED="cc -shared" distcheck

View File

@ -1,6 +1,6 @@
#!/bin/sh
#$Id$
#Copyright (c) 2011-2020 Pierre Pronchery <khorben@defora.org>
#Copyright (c) 2011-2022 Pierre Pronchery <khorben@defora.org>
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
@ -31,7 +31,7 @@ DEVNULL="/dev/null"
PROGNAME="pkgconfig.sh"
#executables
DEBUG="_debug"
INSTALL="install -m 0644"
INSTALL="install"
MKDIR="mkdir -m 0755 -p"
RM="rm -f"
SED="sed"
@ -40,6 +40,101 @@ SED="sed"
#functions
#pkgconfig
_pkgconfig()
{
#check the variables
if [ -z "$PACKAGE" ]; then
_error "The PACKAGE variable needs to be set"
return $?
fi
if [ -z "$VERSION" ]; then
_error "The VERSION variable needs to be set"
return $?
fi
[ -z "$BINDIR" ] && BINDIR="$PREFIX/bin"
[ -z "$DATADIR" ] && DATADIR="$PREFIX/share"
[ -z "$INCLUDEDIR" ] && INCLUDEDIR="$PREFIX/include"
[ -z "$LIBDIR" ] && LIBDIR="$PREFIX/lib"
[ -z "$LIBEXECDIR" ] && LIBEXECDIR="$PREFIX/libexec"
[ -z "$MANDIR" ] && MANDIR="$DATADIR/man"
[ -z "$SBINDIR" ] && SBINDIR="$PREFIX/sbin"
if [ -z "$SYSCONFDIR" ]; then
SYSCONFDIR="$PREFIX/etc"
[ "$PREFIX" = "/usr" ] && SYSCONFDIR="/etc"
fi
PKGCONFIG="$PREFIX/lib/pkgconfig"
while [ $# -gt 0 ]; do
target="$1"
shift
#clean
[ "$clean" -ne 0 ] && continue
#uninstall
if [ "$uninstall" -eq 1 ]; then
$DEBUG $RM -- "$PKGCONFIG/$target" || return 2
continue
fi
#install
if [ "$install" -eq 1 ]; then
source="${target#$OBJDIR}"
$DEBUG $MKDIR -- "$PKGCONFIG" || return 2
mode="-m 0644"
basename="$source"
if [ "${source##*/}" != "$source" ]; then
basename="${source##*/}"
fi
$DEBUG $INSTALL $mode "$target" "$PKGCONFIG/$basename" \
|| return 2
continue
fi
#portability
RPATH=
if [ "$PREFIX" != "/usr" ]; then
RPATH="-Wl,-rpath-link,\${libdir} -Wl,-rpath,\${libdir}"
case $(uname -s) in
"Darwin")
RPATH="-Wl,-rpath,\${libdir}"
;;
"SunOS")
RPATH="-Wl,-R\${libdir}"
;;
esac
fi
#create
source="${target#$OBJDIR}"
source="${source}.in"
([ -z "$OBJDIR" ] || $DEBUG $MKDIR -- "${target%/*}") \
|| return 2
$DEBUG $SED -e "s;@VENDOR@;$VENDOR;g" \
-e "s;@PACKAGE@;$PACKAGE;g" \
-e "s;@VERSION@;$VERSION;g" \
-e "s;@PREFIX@;$PREFIX;g" \
-e "s;@BINDIR@;$BINDIR;g" \
-e "s;@DATADIR@;$DATADIR;g" \
-e "s;@INCLUDEDIR@;$INCLUDEDIR;g" \
-e "s;@LIBDIR@;$LIBDIR;g" \
-e "s;@LIBEXECDIR@;$LIBEXECDIR;g" \
-e "s;@MANDIR@;$MANDIR;g" \
-e "s;@PWD@;$PWD;g" \
-e "s;@RPATH@;$RPATH;g" \
-e "s;@SBINDIR@;$SBINDIR;g" \
-e "s;@SYSCONFDIR@;$SYSCONFDIR;g" \
-- "$source" > "$target"
if [ $? -ne 0 ]; then
$RM -- "$target" 2> "$DEVNULL"
return 2
fi
done
return 0
}
#debug
_debug()
{
@ -94,91 +189,10 @@ while getopts "ciuO:P:" name; do
esac
done
shift $(($OPTIND - 1))
if [ $# -lt 0 ]; then
if [ $# -lt 1 ]; then
_usage
exit $?
fi
#check the variables
if [ -z "$PACKAGE" ]; then
_error "The PACKAGE variable needs to be set"
exit $?
fi
if [ -z "$VERSION" ]; then
_error "The VERSION variable needs to be set"
exit $?
fi
[ -z "$BINDIR" ] && BINDIR="$PREFIX/bin"
[ -z "$DATADIR" ] && DATADIR="$PREFIX/share"
[ -z "$INCLUDEDIR" ] && INCLUDEDIR="$PREFIX/include"
[ -z "$LIBDIR" ] && LIBDIR="$PREFIX/lib"
[ -z "$LIBEXECDIR" ] && LIBEXECDIR="$PREFIX/libexec"
[ -z "$MANDIR" ] && MANDIR="$DATADIR/man"
if [ -z "$SYSCONFDIR" ]; then
SYSCONFDIR="$PREFIX/etc"
[ "$PREFIX" = "/usr" ] && SYSCONFDIR="/etc"
fi
PKGCONFIG="$PREFIX/lib/pkgconfig"
exec 3>&1
while [ $# -gt 0 ]; do
target="$1"
shift
#clean
[ "$clean" -ne 0 ] && continue
#uninstall
if [ "$uninstall" -eq 1 ]; then
$DEBUG $RM -- "$PKGCONFIG/$target" || exit 2
continue
fi
#install
if [ "$install" -eq 1 ]; then
source="${target#$OBJDIR}"
$DEBUG $MKDIR -- "$PKGCONFIG" || exit 2
basename="$source"
if [ "${source##*/}" != "$source" ]; then
basename="${source##*/}"
fi
$DEBUG $INSTALL "$target" "$PKGCONFIG/$basename"|| exit 2
continue
fi
#portability
RPATH=
if [ "$PREFIX" != "/usr" ]; then
RPATH="-Wl,-rpath-link,\${libdir} -Wl,-rpath,\${libdir}"
case $(uname -s) in
"Darwin")
RPATH="-Wl,-rpath,\${libdir}"
;;
"SunOS")
RPATH="-Wl,-R\${libdir}"
;;
esac
fi
#create
source="${target#$OBJDIR}"
source="${source}.in"
([ -z "$OBJDIR" ] || $DEBUG $MKDIR -- "${target%/*}") || exit 2
$DEBUG $SED -e "s;@PACKAGE@;$PACKAGE;g" \
-e "s;@VERSION@;$VERSION;g" \
-e "s;@PREFIX@;$PREFIX;g" \
-e "s;@BINDIR@;$BINDIR;g" \
-e "s;@DATADIR@;$DATADIR;g" \
-e "s;@INCLUDEDIR@;$INCLUDEDIR;g" \
-e "s;@LIBDIR@;$LIBDIR;g" \
-e "s;@LIBEXECDIR@;$LIBEXECDIR;g" \
-e "s;@MANDIR@;$MANDIR;g" \
-e "s;@PWD@;$PWD;g" \
-e "s;@RPATH@;$RPATH;g" \
-e "s;@SYSCONFDIR@;$SYSCONFDIR;g" \
-- "$source" > "$target"
if [ $? -ne 0 ]; then
$DEBUG $RM -- "$target"
exit 2
fi
done
_pkgconfig "$@"

View File

@ -3,29 +3,35 @@
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
[
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY server "www.defora.org/doc/gtk-doc/html">
<!ENTITY version "0.2.1">
<!ENTITY title "DeforaOS Asm">
<!ENTITY % gtkdocentities SYSTEM "xml/gtkdocentities.ent">
%gtkdocentities;
<!ENTITY % configentities SYSTEM "config.ent">
%configentities;
]>
<book id="index">
<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
<bookinfo>
<title>Asm Reference Manual</title>
<title>&vendor; &package; &title;</title>
<releaseinfo>
for Asm &version;.
for &vendor; &package; &version;.
The latest version of this documentation can be found on-line at
<ulink role="online-location" url="http://&server;/Asm/index.html">http://&server;/Asm/</ulink>.
<ulink role="online-location" url="https://&server;/&package;/">https://&server;/&package;/</ulink>.
</releaseinfo>
</bookinfo>
<chapter>
<title>&title;</title>
<title>&vendor; &package;</title>
<xi:include href="xml/arch.xml"/>
<xi:include href="xml/asm.xml"/>
<xi:include href="xml/code.xml"/>
<xi:include href="xml/common.xml"/>
<xi:include href="xml/format.xml"/>
</chapter>
<!-- enable this when you use gobject types
<chapter id="object-tree">
<title>Object Hierarchy</title>
<xi:include href="xml/tree_index.sgml"/>
</chapter>
-->
<index id="api-index-full">
<title>API Index</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
@ -34,6 +40,7 @@
<title>Index of deprecated API</title>
<xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
</index>
<!-- enable this when you use gobject introspection annotations
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
-->
</book>

142
doc/gtkdoc/Asm-sections.txt Normal file
View File

@ -0,0 +1,142 @@
<SECTION>
<FILE>Asm</FILE>
</SECTION>
<SECTION>
<FILE>arch</FILE>
AsmArchEndian
AsmArchOperandType
AOD_FLAGS
AOD_OFFSET
AOD_SIZE
AOD_TYPE
AOD_VALUE
AOM_TYPE
AOM_FLAGS
AOM_OFFSET
AOM_SIZE
AOM_VALUE
AOF_IMPLICIT
AOF_SIGNED
AOI_REFERS_STRING
AOI_REFERS_FUNCTION
AO_0
AO_1
AO_2
AO_3
AO_4
AO_5
AO_GET_FLAGS
AO_GET_OFFSET
AO_GET_DSIZE
AO_GET_RSIZE
AO_GET_SIZE
AO_GET_TYPE
AO_GET_VALUE
AO_CONSTANT
AO_IMMEDIATE
AO_REGISTER
AO_DREGISTER
AO_DREGISTER2
ARO_COUNT
ARF_ALIAS
get_filename
get_function_by_id
get_prefix_by_opcode
get_instruction_by_opcode
get_register_by_id_size
get_register_by_name_size
get_string_by_id
write
peek
read
seek
init
destroy
encode
decode
AsmArch
AsmArchPlugin
</SECTION>
<SECTION>
<FILE>code</FILE>
asmcode_get_arch
asmcode_get_arch_definition
asmcode_get_arch_description
asmcode_get_filename
asmcode_get_format
asmcode_get_format_description
asmcode_get_function_by_id
asmcode_get_functions
asmcode_set_function
asmcode_get_arch_instruction_by_name
asmcode_get_arch_instructions
asmcode_get_arch_prefix_by_name
asmcode_get_arch_prefixes
asmcode_get_arch_registers
asmcode_get_section_by_id
asmcode_get_section_by_name
asmcode_get_sections
asmcode_set_section
asmcode_get_string_by_id
asmcode_get_strings
asmcode_set_string
asmcode_directive
asmcode_function
asmcode_instruction
asmcode_section
asmcode_decode
asmcode_decode_at
asmcode_decode_buffer
asmcode_decode_section
asmcode_print
AsmCode
</SECTION>
<SECTION>
<FILE>common</FILE>
AsmElementId
AsmElementType
AET_LAST
AET_COUNT
AsmFunctionId
AsmFunction
AsmLabelId
AsmLabel
AsmSectionId
AsmSection
AsmStringId
AsmString
AsmSymbolId
AsmSymbol
AsmArchOperandDefinition
</SECTION>
<SECTION>
<FILE>format</FILE>
get_filename
get_functions
read
seek
write
get_function_by_id
get_section_by_id
get_string_by_id
set_function
set_section
set_string
decode
init
destroy
guess
directive
function
section
detect
decode_section
AsmFormat
AsmFormatPlugin
</SECTION>

View File

@ -1,5 +1,5 @@
package=Asm
version=0.2.4
version=0.2.7
vendor=Devel
config=ent,h,sh

View File

@ -126,7 +126,8 @@ void arch_delete(AsmArch * arch)
#ifdef DEBUG
fprintf(stderr, "DEBUG: %s()\n", __func__);
#endif
plugin_delete(arch->handle);
if(arch->handle != NULL)
plugin_delete(arch->handle);
object_delete(arch);
}

View File

@ -1,5 +1,5 @@
/* $Id$ */
/* Copyright (c) 2011-2018 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2011-2022 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Devel Asm */
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -319,7 +319,7 @@ static int _java_encode(AsmArchPlugin * plugin,
AsmArchPluginHelper * helper = plugin->helper;
size_t i;
AsmArchOperandDefinition definitions[3];
AsmArchOperand * ao;
AsmArchOperand const * ao;
uint8_t u8;
uint16_t u16;
uint32_t u32;

View File

@ -1,5 +1,5 @@
/* $Id$ */
/* Copyright (c) 2011-2015 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2011-2022 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Devel Asm */
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -46,18 +46,23 @@ const ElfArch elf_arch[] =
{ NULL, '\0', '\0', '\0', 0x0 }
};
#if defined(__amd64__)
#if defined(EM_AMD64) || defined(EM_X86_64)
# define OFFSET 1
#else
# define OFFSET 0
#endif
#if defined(__amd64__) && (defined(EM_AMD64) || defined(EM_X86_64))
const ElfArch * elf_arch_native = &elf_arch[0];
#elif defined(__arm__)
const ElfArch * elf_arch_native = &elf_arch[1];
const ElfArch * elf_arch_native = &elf_arch[0 + OFFSET];
#elif defined(__i386__)
const ElfArch * elf_arch_native = &elf_arch[2];
const ElfArch * elf_arch_native = &elf_arch[3 + OFFSET];
#elif defined(__sparc64__)
const ElfArch * elf_arch_native = &elf_arch[8];
const ElfArch * elf_arch_native = &elf_arch[11 + OFFSET];
#elif defined(__sparc__)
const ElfArch * elf_arch_native = &elf_arch[7];
const ElfArch * elf_arch_native = &elf_arch[10 + OFFSET];
#else
# error "Unsupported architecture"
const ElfArch * elf_arch_native = NULL;
#endif
const ElfSectionValues elf_section_values[] =

View File

@ -1,5 +1,5 @@
/* $Id$ */
/* Copyright (c) 2015-2016 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2015-2022 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Devel Asm */
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@ -17,7 +17,9 @@
#ifndef ASM_FORMAT_ELF_COMMON_H
# define ASM_FORMAT_ELF_COMMON_H
# ifdef __OpenBSD__
# if defined(__APPLE__)
# include "elf_netbsd.h"
# elif defined(__OpenBSD__)
# include <elf_abi.h>
# else
# include <elf.h>

1368
src/format/elf/elf_netbsd.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
targets=dex,elf,flat,java,mbr,pe
targets=dex,elf,flat,java,mbr,pe,template
cppflags_force=-I../../include
cflags_force=`pkg-config --cflags libSystem` -fPIC
cflags=-W -Wall -g -O2 -D_FORTIFY_SOURCE=2 -fstack-protector
ldflags_force=`pkg-config --libs libSystem`
dist=Makefile,elf/common.h,elf/elf.h,elf/elf.c
dist=Makefile,elf/common.h,elf/elf.h,elf/elf_netbsd.h,elf/elf.c
#modes
[mode::debug]
@ -43,6 +43,10 @@ type=plugin
sources=pe.c
install=$(LIBDIR)/Asm/format
[template]
type=plugin
sources=template.c
#sources
[elf.c]
depends=elf/common.h
@ -51,7 +55,7 @@ depends=elf/common.h
depends=elf/common.h
[elf/elf32.c]
depends=elf/common.h,elf/elf.h,elf/elf.c
depends=elf/common.h,elf/elf.h,elf/elf_netbsd.h,elf/elf.c
[elf/elf64.c]
depends=elf/common.h,elf/elf.h,elf/elf.c
depends=elf/common.h,elf/elf.h,elf/elf_netbsd.h,elf/elf.c

134
src/format/template.c Normal file
View File

@ -0,0 +1,134 @@
/* $Id$ */
/* Copyright (c) 2025 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Devel Asm */
/* This program 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, version 3 of the License.
*
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <System.h>
#include <string.h>
#include "Asm.h"
/* Template */
/* private */
/* types */
struct _AsmFormatPlugin
{
AsmFormatPluginHelper * helper;
};
/* prototypes */
/* plug-in */
static AsmFormatPlugin * _template_init(AsmFormatPluginHelper * helper,
char const * arch);
static int _template_destroy(AsmFormatPlugin * format);
static char const * _template_guess(AsmFormatPlugin * format, char const * hint);
static int _template_section(AsmFormatPlugin * format, char const * section);
static int _template_decode(AsmFormatPlugin * format, int raw);
static int _template_decode_section(AsmFormatPlugin * format, AsmSection * section,
AsmArchInstructionCall ** calls, size_t * calls_cnt);
/* public */
/* variables */
/* plug-in */
AsmFormatPluginDefinition format_plugin =
{
"template",
"Template file",
LICENSE_GNU_LGPL3_FLAGS,
NULL,
0,
_template_init,
_template_destroy,
_template_guess,
NULL,
NULL,
_template_section,
NULL,
_template_decode,
_template_decode_section
};
/* private */
/* functions */
/* plug-in */
/* template_init */
static AsmFormatPlugin * _template_init(AsmFormatPluginHelper * helper,
char const * arch)
{
AsmFormatPlugin * template;
(void) arch;
if((template = object_new(sizeof(*template))) == NULL)
return NULL;
template->helper = helper;
/* TODO implement */
return template;
}
/* template_destroy */
static int _template_destroy(AsmFormatPlugin * format)
{
/* TODO implement */
object_delete(format);
return 0;
}
/* template_guess */
static char const * _template_guess(AsmFormatPlugin * format, char const * hint)
{
/* TODO implement */
return hint;
}
/* template_section */
static int _template_section(AsmFormatPlugin * format, char const * section)
{
/* TODO implement */
return 0;
}
/* template_decode */
static int _template_decode(AsmFormatPlugin * format, int raw)
{
AsmFormatPluginHelper * helper = format->helper;
off_t offset;
(void) raw;
if((offset = helper->seek(helper->format, 0, SEEK_END)) >= 0
&& helper->set_section(helper->format, 0, 0, ".text", 0,
offset, 0) != NULL)
return 0;
return -1;
}
/* template_decode_section */
static int _template_decode_section(AsmFormatPlugin * format, AsmSection * section,
AsmArchInstructionCall ** calls, size_t * calls_cnt)
{
AsmFormatPluginHelper * helper = format->helper;
if(section->id != 0)
return -1;
return helper->decode(helper->format, section->offset, section->size,
section->base, calls, calls_cnt);
}

View File

@ -24,7 +24,7 @@ install=$(LIBDIR)
[asm]
type=binary
sources=main.c
depends=$(OBJDIR)libAsm.so
depends=$(OBJDIR)libAsm$(SOEXT)
cflags=-fPIE
ldflags=-L$(OBJDIR). -Wl,-rpath,$(LIBDIR) -lAsm -pie
install=$(BINDIR)
@ -32,7 +32,7 @@ install=$(BINDIR)
[deasm]
type=binary
sources=deasm.c
depends=$(OBJDIR)libAsm.so
depends=$(OBJDIR)libAsm$(SOEXT)
cflags=-fPIE
ldflags=-L$(OBJDIR). -Wl,-rpath,$(LIBDIR) -lAsm -pie
install=$(BINDIR)

56
src/python/Makefile Normal file
View File

@ -0,0 +1,56 @@
OBJDIR =
PREFIX = /usr/local
DESTDIR =
MKDIR = mkdir -m 0755 -p
INSTALL = install
RM = rm -f
TARGETS = $(OBJDIR)_libAsm$(SOEXT)
LIBDIR = $(PREFIX)/lib
CC = cc
CPPFLAGSF=
CPPFLAGS=
CFLAGSF = `pkg-config --cflags python-2.7 cpp` -fPIC
CFLAGS = -W -Wall -g -O2 -D_FORTIFY_SOURCE=2 -fstack-protector
LDFLAGSF= `pkg-config --libs python-2.7 cpp` -lAsm
LDFLAGS = -L$(OBJDIR).. -Wl,-rpath,$(LIBDIR)
EXEEXT =
AR = ar
ARFLAGS = -rc
RANLIB = ranlib
CCSHARED= $(CC) -shared
SOEXT = .so
RM = rm -f
LN = ln -f
MKDIR = mkdir -m 0755 -p
INSTALL = install
all: $(TARGETS)
_libAsm_OBJS = $(OBJDIR)libAsm.o
_libAsm_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS)
_libAsm_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
$(OBJDIR)_libAsm$(SOEXT): $(_libAsm_OBJS)
$(CCSHARED) -o $(OBJDIR)_libAsm$(SOEXT) $(_libAsm_OBJS) $(_libAsm_LDFLAGS)
$(OBJDIR)libAsm.o: libAsm.c
$(CC) $(_libAsm_CFLAGS) -o $(OBJDIR)libAsm.o -c libAsm.c
clean:
$(RM) -- $(_libAsm_OBJS)
distclean: clean
$(RM) -- $(TARGETS)
install: all
$(MKDIR) $(DESTDIR)$(PREFIX)/lib/python2.7/site-packages
$(INSTALL) -m 0755 $(OBJDIR)_libAsm$(SOEXT) $(DESTDIR)$(PREFIX)/lib/python2.7/site-packages/_libAsm$(SOEXT)
$(MKDIR) $(DESTDIR)$(PREFIX)/lib/python2.7/site-packages
$(INSTALL) -m 0644 libAsm.py $(DESTDIR)$(PREFIX)/lib/python2.7/site-packages/libAsm.py
uninstall:
$(RM) -- $(DESTDIR)$(PREFIX)/lib/python2.7/site-packages/_libAsm$(SOEXT)
$(RM) -- $(DESTDIR)$(PREFIX)/lib/python2.7/site-packages/libAsm.py
.PHONY: all clean distclean install uninstall

View File

@ -122,7 +122,7 @@ _fixme_callback()
echo "_fixme_callback_python"
return 0
;;
"<html"*|"<?xml"*)
"<!DOCTYPE"*|"<!doctype"*|"<HTML"*|"<html"*|"<?xml"*)
echo "_fixme_callback_xml"
return 0
;;

View File

@ -1,6 +1,6 @@
#!/bin/sh
#$Id$
#Copyright (c) 2012-2018 Pierre Pronchery <khorben@defora.org>
#Copyright (c) 2012-2022 Pierre Pronchery <khorben@defora.org>
#This file is part of DeforaOS Devel Asm
#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
@ -23,7 +23,10 @@ ASM="${OBJDIR}../tools/asm-static"
DATE="date"
DEASM="${OBJDIR}../tools/deasm-static"
DEBUG=
ECHO="echo"
PKGCONFIG="pkg-config"
UNAME="uname"
[ $($UNAME -s) != "Darwin" ] || ECHO="/bin/echo"
#functions
@ -69,7 +72,7 @@ _run()
test="$1"
shift
echo -n "$test:" 1>&2
$ECHO -n "$test:" 1>&2
(echo
echo "Testing: $test" "$@"
"$test" "$@") >> "$target" 2>&1
@ -83,7 +86,7 @@ _test()
_run "$@"
res=$?
[ -n "$arch" ] && echo -n " $arch" 1>&2
[ -n "$arch" ] && $ECHO -n " $arch" 1>&2
if [ $res -ne 0 ]; then
echo " FAIL" 1>&2
FAILED="$FAILED $test($arch, error $res)"