- rebuild without JNI support (#2104020) - Java goes away from i686 and
  arduino is not included in Fedora any more, thus no need to build with
  Java support. No ABI change for other users.

- use distro-wide build flags
This commit is contained in:
Dan Horák 2022-07-06 13:52:48 +02:00
parent 720fdb11ca
commit 728a3453e4
2 changed files with 14 additions and 63 deletions

View File

@ -1,51 +0,0 @@
From: Jens Lody <jens@fedoraproject.org>
Date: Sun, 30 Apr 2017 01:02:39 +0200
Subject: Fix to make astyle usable for arduino, based on
this patch: https://github.com/arduino/astyle/blob/master/patches/java_package_name.patch
see: https://github.com/arduino/Arduino/issues/5538 for details
--- a/src/astyle_main.h 2017-04-30 00:30:28.409531985 +0200
+++ b/src/astyle_main.h 2017-04-30 00:31:36.716841967 +0200
@@ -412,6 +412,13 @@
jobject obj,
jstring textInJava,
jstring optionsJava);
+extern "C" EXPORT
+jstring STDCALL Java_cc_arduino_packages_formatter_AStyleInterface_AStyleGetVersion(JNIEnv* env, jclass cls);
+extern "C" EXPORT
+jstring STDCALL Java_cc_arduino_packages_formatter_AStyleInterface_AStyleMain(JNIEnv* env,
+ jobject obj,
+ jstring textInJava,
+ jstring optionsJava);
#endif // ASTYLE_JNI
//----------------------------------------------------------------------------
--- astyle/src/astyle_main.cpp.orig 2017-04-30 00:30:45.651862654 +0200
+++ astyle/src/astyle_main.cpp 2017-04-30 00:48:37.197568109 +0200
@@ -3754,6 +3754,12 @@
return env->NewStringUTF(g_version);
}
+extern "C" EXPORT
+jstring STDCALL Java_cc_arduino_packages_formatter_AStyleInterface_AStyleGetVersion(JNIEnv* env, jclass cls)
+{
+ return Java_AStyleInterface_AStyleGetVersion(env, cls);
+}
+
// called by a java program to format the source code
// the function name is constructed from method names in the calling java program
extern "C" EXPORT
@@ -3795,6 +3801,14 @@
return textOutJava;
}
+extern "C" EXPORT
+jstring STDCALL Java_cc_arduino_packages_formatter_AStyleInterface_AStyleMain(JNIEnv* env,
+ jobject obj,
+ jstring textInJava,
+ jstring optionsJava)
+{
+ return Java_AStyleInterface_AStyleMain(env, obj, textInJava, optionsJava);
+}
// Call the Java error handler
void STDCALL javaErrorHandler(int errorNumber, const char* errorMessage)
{

View File

@ -1,6 +1,6 @@
Name: astyle
Version: 3.1
Release: 15%{?dist}
Release: 16%{?dist}
Summary: Source code formatter for C-like programming languages
%global majorversion 3
@ -11,11 +11,8 @@ URL: http://astyle.sourceforge.net/
Source0: https://downloads.sourceforge.net/%{name}/%{name}_%{version}_linux.tar.gz
BuildRequires: gcc-c++
BuildRequires: java-devel >= 1:1.8.0
# Make the astyle-lib usable for arduino
Patch0: astyle-arduino.patch
# Fix (hardcoded) path to html-help
Patch1: astyle-html-help.patch
# Fix abort with gcc8 -Wp,-D_GLIBCXX_ASSERTION
@ -41,21 +38,21 @@ This package contains the shared library.
%prep
%setup -q -n %{name}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%build
chmod a-x src/*
chmod a-x doc/*
# drop executable bit from all files
find . -type f -exec chmod a-x {} \;
%build
pushd src
# it's much easier to compile it here than trying to fix the Makefile
g++ %{optflags} -DASTYLE_LIB -DASTYLE_JNI -fPIC -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux -c ASBeautifier.cpp ASEnhancer.cpp ASFormatter.cpp ASResource.cpp astyle_main.cpp
g++ -shared -o libastyle.so.%{soversion} *.o -Wl,-soname,libastyle.so.%{majorversion}
g++ %{build_cxxflags} -DASTYLE_LIB -fPIC -c ASBeautifier.cpp ASEnhancer.cpp ASFormatter.cpp ASResource.cpp astyle_main.cpp
g++ %{build_ldflags} -shared -o libastyle.so.%{soversion} *.o -Wl,-soname,libastyle.so.%{majorversion}
ln -s libastyle.so.%{soversion} libastyle.so
g++ %{optflags} -c ASLocalizer.cpp astyle_main.cpp
g++ %{optflags} -o astyle ASLocalizer.o astyle_main.o -L. -lastyle
g++ %{build_cxxflags} -c ASLocalizer.cpp astyle_main.cpp
g++ %{build_ldflags} -o astyle ASLocalizer.o astyle_main.o -L. -lastyle
popd
%install
@ -71,6 +68,7 @@ popd
%ldconfig_scriptlets
%files
%license LICENSE.md
%doc doc/*.html
%{_bindir}/astyle
%{_libdir}/libastyle.so.%{majorversion}
@ -81,6 +79,10 @@ popd
%{_includedir}/astyle.h
%changelog
* Wed Jul 06 2022 Dan Horák <dan[at]danny.cz> - 3.1-16
- rebuild without JNI support (#2104020)
- use distro-wide build flags
* Sat Feb 05 2022 Jiri Vanek <jvanek@redhat.com> - 3.1-15
- Rebuilt for java-17-openjdk as system jdk