Compare commits
82 Commits
master
...
628b713f24
Author | SHA1 | Date |
---|---|---|
fuwa | 628b713f24 | 3 years ago |
fuwa | 9a6665bca8 | 3 years ago |
fuwa | c3d418e326 | 3 years ago |
fuwa | d96991a4fe | 3 years ago |
fuwa | 2fcf59fa38 | 3 years ago |
fuwa | 41fcb692fd | 3 years ago |
fuwa | eb08fe1dcc | 3 years ago |
fuwa | c023a25a1e | 3 years ago |
fuwa | 6dd63978ba | 3 years ago |
fuwa | ac4342c430 | 3 years ago |
fuwa | b36a82607e | 3 years ago |
fuwa | 671fd96bbb | 3 years ago |
fuwa | 4df69a8f25 | 3 years ago |
fuwa | ee0bc769a7 | 3 years ago |
fuwa | 35df36221e | 3 years ago |
fuwa | 481ed5c4ea | 3 years ago |
fuwa | e5549769b1 | 3 years ago |
fuwa | cdc97eee50 | 3 years ago |
fuwa | cd24088714 | 3 years ago |
fuwa | 7c6d19c7e3 | 3 years ago |
fuwa | a6e1659db5 | 3 years ago |
fuwa | c2830ced7b | 3 years ago |
fuwa | c63408a957 | 3 years ago |
fuwa | 7c3f361135 | 3 years ago |
fuwa | 9bef2280f2 | 3 years ago |
fuwa | e12e5d5e4f | 3 years ago |
fuwa | 7303c7374c | 3 years ago |
fuwa | ed1ab4efd1 | 3 years ago |
fuwa | c0fb0a6dc4 | 3 years ago |
fuwa | 314934be11 | 3 years ago |
fuwa | dba7f3f858 | 3 years ago |
fuwa | d37563baa8 | 3 years ago |
fuwa | ab3389beac | 3 years ago |
fuwa | 0ee59a1f30 | 3 years ago |
fuwa | 4986583ae4 | 3 years ago |
fuwa | c2553850eb | 3 years ago |
fuwa | 517c9fb3d5 | 3 years ago |
fuwa | 2de8ea1836 | 3 years ago |
fuwa | 4266334d32 | 3 years ago |
fuwa | 0619ad667a | 3 years ago |
fuwa | a1718f2bd5 | 3 years ago |
fuwa | 93e8065c24 | 3 years ago |
fuwa | 5e34574b74 | 3 years ago |
fuwa | 12f2aee882 | 3 years ago |
fuwa | 882ae9a5b6 | 3 years ago |
fuwa | a9976035f7 | 3 years ago |
fuwa | 2e79c61531 | 3 years ago |
fuwa | 282f769ee7 | 3 years ago |
fuwa | 9f8b86a6be | 3 years ago |
fuwa | ba406e286e | 3 years ago |
fuwa | 362d3aceb9 | 3 years ago |
fuwa | e871b91ddf | 3 years ago |
fuwa | 9ff33aa4a1 | 3 years ago |
fuwa | dec7da1d59 | 3 years ago |
fuwa | a547561a66 | 3 years ago |
fuwa | d8cf0f0872 | 3 years ago |
fuwa | 77f713b51d | 3 years ago |
fuwa | b7dc13539f | 3 years ago |
fuwa | e5864309a2 | 3 years ago |
fuwa | db5acac856 | 3 years ago |
fuwa | 965bd60d91 | 3 years ago |
fuwa | 2aa380a143 | 3 years ago |
fuwa | 55ece76998 | 4 years ago |
fuwa | 0a9ba1fb06 | 4 years ago |
fuwa | 77bc2369f2 | 4 years ago |
fuwa | 96b20933c2 | 4 years ago |
fuwa | 72fb69a512 | 4 years ago |
fuwa | 7f37f554ef | 4 years ago |
fuwa | 2f8f98c59d | 4 years ago |
fuwa | 79adc83caf | 4 years ago |
fuwa | 79af95aac7 | 4 years ago |
fuwa | 1219ad6f90 | 4 years ago |
fuwa | f5a072c655 | 4 years ago |
fuwa | c558e17885 | 4 years ago |
fuwa | b01b0fe5c5 | 4 years ago |
fuwa | 91e26d4e11 | 4 years ago |
fuwa | 9e5b350b27 | 4 years ago |
fuwa | fcd72d1fa9 | 4 years ago |
fuwa | 5a6173d7f3 | 4 years ago |
fuwa | a27a76ca0a | 4 years ago |
fuwa | 3499b96a1c | 4 years ago |
fuwa | f56382ad73 | 4 years ago |
Before Width: | Height: | Size: 1.4 MiB |
@ -1,66 +0,0 @@
|
||||
/*
|
||||
|
||||
Copyright 2019 fuwa
|
||||
|
||||
This file is part of CyberWOW.
|
||||
|
||||
CyberWOW 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
CyberWOW 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 CyberWOW. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../config.dart' as config;
|
||||
import '../logging.dart';
|
||||
import '../helper.dart';
|
||||
|
||||
import 'prototype.dart';
|
||||
import 'syncing.dart';
|
||||
|
||||
class LoadingState extends AppState {
|
||||
final String banner;
|
||||
String status = '';
|
||||
|
||||
LoadingState(appHook, this.banner) : super (appHook);
|
||||
|
||||
void append(final String msg) {
|
||||
this.status += msg;
|
||||
syncState();
|
||||
}
|
||||
|
||||
Future<SyncingState> next() async {
|
||||
Future<void> showBanner() async {
|
||||
final Iterable<String> chars = banner.runes.map((x) => String.fromCharCode(x));
|
||||
|
||||
for (final String char in chars) {
|
||||
append(char);
|
||||
await Future.delayed(Duration(milliseconds: config.c.splashDelay));
|
||||
}
|
||||
|
||||
await tick();
|
||||
await tick();
|
||||
}
|
||||
|
||||
SharedPreferences _prefs = await SharedPreferences.getInstance();
|
||||
final _bannerShown = await _prefs.getBool(config.bannerShownKey);
|
||||
|
||||
if (_bannerShown == null) {
|
||||
await showBanner();
|
||||
await _prefs.setBool(config.bannerShownKey, true);
|
||||
}
|
||||
|
||||
SyncingState _next = SyncingState(appHook);
|
||||
return moveState(_next);
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
|
||||
Copyright 2019 fuwa
|
||||
|
||||
This file is part of CyberWOW.
|
||||
|
||||
CyberWOW 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
CyberWOW 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 CyberWOW. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
typedef SetStateFunc = void Function(AppState);
|
||||
typedef GetNotificationFunc = AppLifecycleState Function();
|
||||
typedef IsExitingFunc = bool Function();
|
||||
|
||||
class AppHook {
|
||||
final SetStateFunc setState;
|
||||
final GetNotificationFunc getNotification;
|
||||
final IsExitingFunc isExiting;
|
||||
AppHook(this.setState, this.getNotification, this.isExiting);
|
||||
}
|
||||
|
||||
class AppState {
|
||||
final AppHook appHook;
|
||||
AppState(this.appHook);
|
||||
|
||||
syncState() {
|
||||
appHook.setState(this);
|
||||
}
|
||||
|
||||
AppState moveState(AppState _next) {
|
||||
appHook.setState(_next);
|
||||
return _next;
|
||||
}
|
||||
}
|
@ -1,101 +0,0 @@
|
||||
/*
|
||||
|
||||
Copyright 2019 fuwa
|
||||
|
||||
This file is part of CyberWOW.
|
||||
|
||||
CyberWOW 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
CyberWOW 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 CyberWOW. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:collection';
|
||||
|
||||
import '../logic/controller/refresh.dart' as refresh;
|
||||
import '../logic/sensor/rpc/rpc.dart' as rpc;
|
||||
import '../logic/sensor/daemon.dart' as daemon;
|
||||
import '../config.dart' as config;
|
||||
import '../logging.dart';
|
||||
|
||||
import 'prototype.dart';
|
||||
import 'synced.dart';
|
||||
import 'exiting.dart';
|
||||
|
||||
|
||||
class ReSyncingState extends AppState {
|
||||
final Queue<String> stdout;
|
||||
final StreamSink<String> processInput;
|
||||
final Stream<String> processOutput;
|
||||
final int pageIndex;
|
||||
|
||||
bool synced = false;
|
||||
|
||||
ReSyncingState(appHook, this.stdout, this.processInput, this.processOutput, this.pageIndex)
|
||||
: super (appHook);
|
||||
|
||||
void append(final String msg) {
|
||||
stdout.addLast(msg);
|
||||
while (stdout.length > config.stdoutLineBufferSize) {
|
||||
stdout.removeFirst();
|
||||
}
|
||||
syncState();
|
||||
}
|
||||
|
||||
Future<AppState> next() async {
|
||||
log.fine("ReSyncing next");
|
||||
|
||||
Future<void> printStdout() async {
|
||||
await for (final line in processOutput) {
|
||||
if (synced) break;
|
||||
// print('re-syncing: print stdout loop');
|
||||
append(line);
|
||||
log.info(line);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> checkSync() async {
|
||||
await for (final _null in refresh.pull(appHook.getNotification, 'ReSyncingState')) {
|
||||
if (appHook.isExiting()) {
|
||||
log.fine('ReSyncing state detected exiting');
|
||||
break;
|
||||
}
|
||||
|
||||
if (await daemon.isSynced()) {
|
||||
synced = true;
|
||||
break;
|
||||
}
|
||||
// print('re-syncing: checkSync loop');
|
||||
}
|
||||
}
|
||||
|
||||
printStdout();
|
||||
await checkSync();
|
||||
|
||||
if (appHook.isExiting()) {
|
||||
ExitingState _next = ExitingState
|
||||
(
|
||||
appHook, stdout, processOutput
|
||||
);
|
||||
return moveState(_next);
|
||||
}
|
||||
|
||||
log.fine('resync: await exit');
|
||||
SyncedState _next = SyncedState
|
||||
(
|
||||
appHook, stdout, processInput, processOutput, pageIndex
|
||||
);
|
||||
_next.height = await rpc.height();
|
||||
return moveState(_next);
|
||||
}
|
||||
}
|
@ -1,161 +0,0 @@
|
||||
/*
|
||||
|
||||
Copyright 2019 fuwa
|
||||
|
||||
This file is part of CyberWOW.
|
||||
|
||||
CyberWOW 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
CyberWOW 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 CyberWOW. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:collection';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../config.dart' as config;
|
||||
import '../logic/sensor/daemon.dart' as daemon;
|
||||
import '../logic/controller/refresh.dart' as refresh;
|
||||
import '../logic/sensor/rpc/rpc.dart' as rpc;
|
||||
import '../logic/sensor/rpc/rpc2.dart' as rpc;
|
||||
import '../logic/view/rpc/rpc2.dart' as rpc2View;
|
||||
import '../logic/view/rpc/rpc.dart' as rpcView;
|
||||
import '../helper.dart';
|
||||
import '../logging.dart';
|
||||
|
||||
import 'prototype.dart';
|
||||
import 'resyncing.dart';
|
||||
import 'exiting.dart';
|
||||
|
||||
class SyncedState extends AppState {
|
||||
final Queue<String> stdout;
|
||||
final StreamSink<String> processInput;
|
||||
final Stream<String> processOutput;
|
||||
final TextEditingController textController = TextEditingController();
|
||||
|
||||
int height;
|
||||
bool synced = true;
|
||||
bool userExit = false;
|
||||
bool connected = true;
|
||||
Map<String, dynamic> getInfo = {};
|
||||
List<Map<String, dynamic>> getConnections = [];
|
||||
List<Map<String, dynamic>> getTransactionPool = [];
|
||||
int pageIndex;
|
||||
String syncInfo = 'syncInfo';
|
||||
PageController pageController;
|
||||
|
||||
String getInfoCache = '';
|
||||
String getConnectionsCache = '';
|
||||
String getTransactionPoolCache = '';
|
||||
|
||||
SyncedState(appHook, this.stdout, this.processInput, this.processOutput, this.pageIndex)
|
||||
: super (appHook) {
|
||||
pageController = PageController( initialPage: pageIndex );
|
||||
}
|
||||
|
||||
void appendInput(final String line) {
|
||||
stdout.addLast(config.c.promptString + line);
|
||||
syncState();
|
||||
processInput.add(line);
|
||||
|
||||
if (line == 'exit') {
|
||||
userExit = true;
|
||||
}
|
||||
}
|
||||
|
||||
void append(final String msg) {
|
||||
stdout.addLast(msg);
|
||||
while (stdout.length > config.stdoutLineBufferSize) {
|
||||
stdout.removeFirst();
|
||||
}
|
||||
syncState();
|
||||
}
|
||||
|
||||
void onPageChanged(int value) {
|
||||
this.pageIndex = value;
|
||||
}
|
||||
|
||||
Future<AppState> next() async {
|
||||
log.fine("Synced next");
|
||||
|
||||
Future<void> logStdout() async {
|
||||
await for (final line in processOutput) {
|
||||
if (!synced) break;
|
||||
|
||||
// print('synced: print stdout loop');
|
||||
append(line);
|
||||
log.info(line);
|
||||
}
|
||||
}
|
||||
|
||||
logStdout();
|
||||
|
||||
Future<void> checkSync() async {
|
||||
await for (final _null in refresh.pull(appHook.getNotification, 'syncedState')) {
|
||||
if (appHook.isExiting() || userExit) {
|
||||
log.fine('Synced state detected exiting');
|
||||
break;
|
||||
}
|
||||
|
||||
if (await daemon.isNotSynced()) {
|
||||
synced = false;
|
||||
break;
|
||||
}
|
||||
// log.finer('SyncedState: checkSync loop');
|
||||
height = await rpc.height();
|
||||
connected = await daemon.isConnected();
|
||||
getInfo = await rpc.getInfoSimple();
|
||||
final _getInfoView = cleanKey(rpcView.getInfoView(getInfo));
|
||||
getInfoCache = pretty(_getInfoView);
|
||||
|
||||
getConnections = await rpc.getConnectionsSimple();
|
||||
final List<Map<String, dynamic>> _getConnectionsView =
|
||||
getConnections
|
||||
.map(rpcView.getConnectionView)
|
||||
.map((x) => rpcView.simpleHeight(height, x))
|
||||
.map(cleanKey)
|
||||
.toList();
|
||||
getConnectionsCache = pretty(_getConnectionsView);
|
||||
|
||||
getTransactionPool = await rpc.getTransactionPoolSimple();
|
||||
final List<Map<String, dynamic>> _getTransactionPoolView =
|
||||
getTransactionPool.map(rpc2View.txView).map(cleanKey).toList();
|
||||
getTransactionPoolCache = pretty(_getTransactionPoolView);
|
||||
|
||||
syncState();
|
||||
}
|
||||
}
|
||||
|
||||
await checkSync();
|
||||
|
||||
if (appHook.isExiting() || userExit) {
|
||||
ExitingState _next = ExitingState
|
||||
(
|
||||
appHook, stdout, processOutput
|
||||
);
|
||||
return moveState(_next);
|
||||
}
|
||||
|
||||
log.fine('synced: loop exit');
|
||||
|
||||
ReSyncingState _next = ReSyncingState
|
||||
(
|
||||
appHook, stdout, processInput, processOutput, pageIndex
|
||||
);
|
||||
return moveState(_next);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,111 +0,0 @@
|
||||
/*
|
||||
|
||||
Copyright 2019 fuwa
|
||||
|
||||
This file is part of CyberWOW.
|
||||
|
||||
CyberWOW 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
CyberWOW 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 CyberWOW. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:collection';
|
||||
|
||||
import '../logic/sensor/rpc/rpc.dart' as rpc;
|
||||
import '../logic/sensor/daemon.dart' as daemon;
|
||||
import '../logic/controller/refresh.dart' as refresh;
|
||||
import '../config.dart' as config;
|
||||
import '../logging.dart';
|
||||
|
||||
import 'prototype.dart';
|
||||
import 'synced.dart';
|
||||
import 'exiting.dart';
|
||||
|
||||
|
||||
class SyncingState extends AppState {
|
||||
final Queue<String> stdout = Queue();
|
||||
|
||||
bool synced = false;
|
||||
|
||||
SyncingState(appHook) : super (appHook);
|
||||
|
||||
void append(final String msg) {
|
||||
stdout.addLast(msg);
|
||||
while (stdout.length > config.stdoutLineBufferSize) {
|
||||
stdout.removeFirst();
|
||||
}
|
||||
syncState();
|
||||
}
|
||||
|
||||
Future<AppState> next
|
||||
(
|
||||
StreamSink<String> processInput, Stream<String> processOutput
|
||||
) async {
|
||||
log.fine("Syncing next");
|
||||
|
||||
Future<void> printStdout() async {
|
||||
await for (final line in processOutput) {
|
||||
if (synced) break;
|
||||
log.finest('syncing: print stdout loop');
|
||||
|
||||
append(line);
|
||||
log.info(line);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> checkSync() async {
|
||||
await for (final _null in refresh.pull(appHook.getNotification, 'syncingState')) {
|
||||
log.finer('SyncingState: checkSync loop');
|
||||
|
||||
if (appHook.isExiting()) {
|
||||
log.fine('Syncing state detected exiting');
|
||||
break;
|
||||
}
|
||||
|
||||
// here doc is wrong, targetHeight could match height when synced
|
||||
// potential bug, targetHeight could be smaller then height
|
||||
final _isConnected = await daemon.isConnected();
|
||||
final _isSynced = await daemon.isSynced();
|
||||
|
||||
if (_isConnected && _isSynced) {
|
||||
synced = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printStdout();
|
||||
await checkSync();
|
||||
|
||||
if (appHook.isExiting()) {
|
||||
ExitingState _next = ExitingState
|
||||
(
|
||||
appHook, stdout, processOutput
|
||||
);
|
||||
return moveState(_next);
|
||||
}
|
||||
|
||||
log.fine('syncing: loop exit');
|
||||
|
||||
// processInput.add('exit');
|
||||
|
||||
final _height = await rpc.height();
|
||||
SyncedState _next = SyncedState
|
||||
(
|
||||
appHook, stdout, processInput, processOutput, 1,
|
||||
);
|
||||
_next.height = _height;
|
||||
return moveState(_next);
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
// This is a basic Flutter widget test.
|
||||
//
|
||||
// To perform an interaction with a widget in your test, use the WidgetTester
|
||||
// utility that Flutter provides. For example, you can send tap and scroll
|
||||
// gestures. You can also use WidgetTester to find child widgets in the widget
|
||||
// tree, read text, and verify that the values of widget properties are correct.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:cyberwow/main.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
||||
// Build our app and trigger a frame.
|
||||
await tester.pumpWidget(MyApp());
|
||||
|
||||
// Verify that our counter starts at 0.
|
||||
expect(find.text('0'), findsOneWidget);
|
||||
expect(find.text('1'), findsNothing);
|
||||
|
||||
// Tap the '+' icon and trigger a frame.
|
||||
await tester.tap(find.byIcon(Icons.add));
|
||||
await tester.pump();
|
||||
|
||||
// Verify that our counter has incremented.
|
||||
expect(find.text('0'), findsNothing);
|
||||
expect(find.text('1'), findsOneWidget);
|
||||
});
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
{ lib, stdenv, fetchurl, fetchpatch, curl, expat, zlib, bzip2
|
||||
, useNcurses ? false, ncurses, useQt4 ? false, qt4, ps
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
assert stdenv ? cc;
|
||||
assert stdenv.cc ? libc;
|
||||
|
||||
let
|
||||
os = lib.optionalString;
|
||||
majorVersion = "2.8";
|
||||
minorVersion = "12.2";
|
||||
version = "${majorVersion}.${minorVersion}";
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "cmake-${os useNcurses "cursesUI-"}${os useQt4 "qt4UI-"}${version}";
|
||||
|
||||
inherit majorVersion;
|
||||
|
||||
src = fetchurl {
|
||||
url = "${meta.homepage}files/v${majorVersion}/cmake-${version}.tar.gz";
|
||||
sha256 = "0phf295a9cby0v7zqdswr238v5aiy3rb2fs6dz39zjxbmzlp8rcc";
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
patches =
|
||||
[(fetchpatch { # see https://www.cmake.org/Bug/view.php?id=13959
|
||||
name = "FindFreetype-2.5.patch";
|
||||
url = "https://public.kitware.com/Bug/file/4660/0001-Support-finding-freetype2-using-pkg-config.patch";
|
||||
sha256 = "136z63ff83hnwd247cq4m8m8164pklzyl5i2csf5h6wd8p01pdkj";
|
||||
})] ++
|
||||
# Don't search in non-Nix locations such as /usr, but do search in our libc.
|
||||
[ ./search-path-2.8.patch ] ++
|
||||
optional (stdenv.hostPlatform != stdenv.buildPlatform) (fetchurl {
|
||||
name = "fix-darwin-cross-compile.patch";
|
||||
url = "https://public.kitware.com/Bug/file_download.php?"
|
||||
+ "file_id=4981&type=bug";
|
||||
sha256 = "16acmdr27adma7gs9rs0dxdiqppm15vl3vv3agy7y8s94wyh4ybv";
|
||||
});
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace Utilities/cmlibarchive/CMakeLists.txt \
|
||||
--replace '"-framework CoreServices"' '""'
|
||||
'';
|
||||
|
||||
buildInputs = [ setupHook curl expat zlib bzip2 ]
|
||||
++ optional useNcurses ncurses
|
||||
++ optional useQt4 qt4;
|
||||
|
||||
propagatedBuildInputs = [ ps ];
|
||||
|
||||
CMAKE_PREFIX_PATH = concatStringsSep ":"
|
||||
(concatMap (p: [ (p.dev or p) (p.out or p) ]) buildInputs);
|
||||
|
||||
configureFlags = [
|
||||
"--docdir=/share/doc/${name}"
|
||||
"--mandir=/share/man"
|
||||
"--system-libs"
|
||||
"--no-system-libarchive"
|
||||
] ++ lib.optional useQt4 "--qt-gui";
|
||||
|
||||
setupHook = ./setup-hook.sh;
|
||||
|
||||
dontUseCmakeConfigure = true;
|
||||
|
||||
preConfigure = with stdenv; ''
|
||||
fixCmakeFiles .
|
||||
substituteInPlace Modules/Platform/UnixPaths.cmake \
|
||||
--subst-var-by libc_bin ${getBin cc.libc} \
|
||||
--subst-var-by libc_dev ${getDev cc.libc} \
|
||||
--subst-var-by libc_lib ${getLib cc.libc}
|
||||
configureFlags="--parallel=''${NIX_BUILD_CORES:-1} $configureFlags"
|
||||
'';
|
||||
|
||||
hardeningDisable = [ "format" ];
|
||||
|
||||
meta = {
|
||||
homepage = "https://cmake.org";
|
||||
description = "Cross-Platform Makefile Generator";
|
||||
platforms = if useQt4 then qt4.meta.platforms else lib.platforms.unix;
|
||||
maintainers = with lib.maintainers; [ xfix ];
|
||||
license = lib.licenses.bsd3;
|
||||
};
|
||||
}
|
@ -0,0 +1,274 @@
|
||||
--- cmake-3.2.2/Source/cmFileCommand.cxx 2015-04-13 19:09:00.000000000 +0200
|
||||
+++ cmake-3.2.2/Source/ccmFileCommand.cxx 2015-06-10 11:02:27.345598700 +0200
|
||||
@@ -1179,7 +1179,7 @@
|
||||
MatchProperties CollectMatchProperties(const char* file)
|
||||
{
|
||||
// Match rules are case-insensitive on some platforms.
|
||||
-#if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
|
||||
+#if defined(_WIN32) || defined(__APPLE__)
|
||||
std::string lower = cmSystemTools::LowerCase(file);
|
||||
const char* file_to_match = lower.c_str();
|
||||
#else
|
||||
--- cmake-3.2.2/Source/cmInstallCommand.cxx 2015-04-13 19:09:00.000000000 +0200
|
||||
+++ cmake-3.2.2/Source/cmInstallCommand.cxx 2015-06-10 11:04:19.257935200 +0200
|
||||
@@ -1138,7 +1138,7 @@
|
||||
{
|
||||
literal_args += " REGEX \"";
|
||||
// Match rules are case-insensitive on some platforms.
|
||||
-#if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
|
||||
+#if defined(_WIN32) || defined(__APPLE__)
|
||||
std::string regex = cmSystemTools::LowerCase(args[i]);
|
||||
#else
|
||||
std::string regex = args[i];
|
||||
--- cmake-3.2.2/Source/kwsys/Glob.cxx 2015-04-13 19:09:00.000000000 +0200
|
||||
+++ cmake-3.2.2/Source/kwsys/Glob.cxx 2015-06-10 11:05:51.602674000 +0200
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <string.h>
|
||||
namespace KWSYS_NAMESPACE
|
||||
{
|
||||
-#if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
|
||||
+#if defined(_WIN32) || defined(__APPLE__)
|
||||
// On Windows and apple, no difference between lower and upper case
|
||||
# define KWSYS_GLOB_CASE_INDEPENDENT
|
||||
#endif
|
||||
--- cmake-3.2.2/Source/kwsys/SystemInformation.cxx 2015-04-13 19:09:00.000000000 +0200
|
||||
+++ cmake-3.2.2/Source/kwsys/SystemInformation.cxx 2015-06-10 11:13:00.308303500 +0200
|
||||
@@ -911,7 +911,7 @@
|
||||
// Hide implementation details in an anonymous namespace.
|
||||
namespace {
|
||||
// *****************************************************************************
|
||||
-#if defined(__linux) || defined(__APPLE__)
|
||||
+#if defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__)
|
||||
int LoadLines(
|
||||
FILE *file,
|
||||
kwsys_stl::vector<kwsys_stl::string> &lines)
|
||||
@@ -947,7 +947,7 @@
|
||||
return nRead;
|
||||
}
|
||||
|
||||
-# if defined(__linux)
|
||||
+# if defined(__linux) || defined(__CYGWIN__)
|
||||
// *****************************************************************************
|
||||
int LoadLines(
|
||||
const char *fileName,
|
||||
@@ -986,7 +986,7 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
-#if defined(__linux)
|
||||
+#if defined(__linux) || defined(__CYGWIN__)
|
||||
// ****************************************************************************
|
||||
template<typename T>
|
||||
int GetFieldsFromFile(
|
||||
@@ -3132,7 +3132,6 @@
|
||||
pos = buffer.find("processor\t",pos+1);
|
||||
}
|
||||
|
||||
-#ifdef __linux
|
||||
// Find the largest physical id.
|
||||
int maxId = -1;
|
||||
kwsys_stl::string idc =
|
||||
@@ -3165,14 +3164,6 @@
|
||||
atoi(this->ExtractValueFromCpuInfoFile(buffer,"ncpus active").c_str());
|
||||
}
|
||||
|
||||
-#else // __CYGWIN__
|
||||
- // does not have "physical id" entries, neither "cpu cores"
|
||||
- // this has to be fixed for hyper-threading.
|
||||
- kwsys_stl::string cpucount =
|
||||
- this->ExtractValueFromCpuInfoFile(buffer,"cpu count");
|
||||
- this->NumberOfPhysicalCPU=
|
||||
- this->NumberOfLogicalCPU = atoi(cpucount.c_str());
|
||||
-#endif
|
||||
// gotta have one, and if this is 0 then we get a / by 0n
|
||||
// better to have a bad answer than a crash
|
||||
if(this->NumberOfPhysicalCPU <= 0)
|
||||
@@ -3370,7 +3361,7 @@
|
||||
GlobalMemoryStatusEx(&statex);
|
||||
return statex.ullTotalPhys/1024;
|
||||
# endif
|
||||
-#elif defined(__linux)
|
||||
+#elif defined(__linux) || defined(__CYGWIN__)
|
||||
SystemInformation::LongLong memTotal=0;
|
||||
int ierr=GetFieldFromFile("/proc/meminfo","MemTotal:",memTotal);
|
||||
if (ierr)
|
||||
@@ -3501,7 +3492,7 @@
|
||||
GlobalMemoryStatusEx(&statex);
|
||||
return (statex.ullTotalPhys - statex.ullAvailPhys)/1024;
|
||||
# endif
|
||||
-#elif defined(__linux)
|
||||
+#elif defined(__linux) || defined(__CYGWIN__)
|
||||
const char *names[3]={"MemTotal:","MemFree:",NULL};
|
||||
SystemInformation::LongLong values[2]={SystemInformation::LongLong(0)};
|
||||
int ierr=GetFieldsFromFile("/proc/meminfo",names,values);
|
||||
@@ -3560,7 +3551,7 @@
|
||||
return -2;
|
||||
}
|
||||
return pmc.WorkingSetSize/1024;
|
||||
-#elif defined(__linux)
|
||||
+#elif defined(__linux) || defined(__CYGWIN__)
|
||||
SystemInformation::LongLong memUsed=0;
|
||||
int ierr=GetFieldFromFile("/proc/self/status","VmRSS:",memUsed);
|
||||
if (ierr)
|
||||
@@ -3612,7 +3603,7 @@
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
return GetCurrentProcessId();
|
||||
-#elif defined(__linux) || defined(__APPLE__)
|
||||
+#elif defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__)
|
||||
return getpid();
|
||||
#else
|
||||
return -1;
|
||||
--- cmake-3.2.2/Source/kwsys/SystemTools.cxx 2015-04-13 19:09:00.000000000 +0200
|
||||
+++ cmake-3.2.2/Source/kwsys/SystemTools.cxx 2015-06-10 11:21:58.980443200 +0200
|
||||
@@ -93,19 +93,12 @@
|
||||
# if defined(_MSC_VER) && _MSC_VER >= 1800
|
||||
# define KWSYS_WINDOWS_DEPRECATED_GetVersionEx
|
||||
# endif
|
||||
-#elif defined (__CYGWIN__)
|
||||
-# include <windows.h>
|
||||
-# undef _WIN32
|
||||
#endif
|
||||
|
||||
#if !KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H
|
||||
extern char **environ;
|
||||
#endif
|
||||
|
||||
-#ifdef __CYGWIN__
|
||||
-# include <sys/cygwin.h>
|
||||
-#endif
|
||||
-
|
||||
// getpwnam doesn't exist on Windows and Cray Xt3/Catamount
|
||||
// same for TIOCGWINSZ
|
||||
#if defined(_WIN32) || defined (__LIBCATAMOUNT__)
|
||||
@@ -1148,15 +1141,7 @@
|
||||
{
|
||||
return false;
|
||||
}
|
||||
-#if defined(__CYGWIN__)
|
||||
- // Convert filename to native windows path if possible.
|
||||
- char winpath[MAX_PATH];
|
||||
- if(SystemTools::PathCygwinToWin32(filename.c_str(), winpath))
|
||||
- {
|
||||
- return (GetFileAttributesA(winpath) != INVALID_FILE_ATTRIBUTES);
|
||||
- }
|
||||
- return access(filename.c_str(), R_OK) == 0;
|
||||
-#elif defined(_WIN32)
|
||||
+#if defined(_WIN32)
|
||||
return (GetFileAttributesW(
|
||||
SystemTools::ConvertToWindowsExtendedPath(filename).c_str())
|
||||
!= INVALID_FILE_ATTRIBUTES);
|
||||
@@ -1190,28 +1175,6 @@
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
-#ifdef __CYGWIN__
|
||||
-bool SystemTools::PathCygwinToWin32(const char *path, char *win32_path)
|
||||
-{
|
||||
- SystemToolsTranslationMap::iterator i =
|
||||
- SystemTools::Cyg2Win32Map->find(path);
|
||||
-
|
||||
- if (i != SystemTools::Cyg2Win32Map->end())
|
||||
- {
|
||||
- strncpy(win32_path, i->second.c_str(), MAX_PATH);
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- if(cygwin_conv_path(CCP_POSIX_TO_WIN_A, path, win32_path, MAX_PATH) != 0)
|
||||
- {
|
||||
- win32_path[0] = 0;
|
||||
- }
|
||||
- SystemToolsTranslationMap::value_type entry(path, win32_path);
|
||||
- SystemTools::Cyg2Win32Map->insert(entry);
|
||||
- }
|
||||
- return win32_path[0] != 0;
|
||||
-}
|
||||
-#endif
|
||||
|
||||
bool SystemTools::Touch(const kwsys_stl::string& filename, bool create)
|
||||
{
|
||||
@@ -4307,7 +4270,7 @@
|
||||
|
||||
bool SystemTools::FileIsFullPath(const char* in_name, size_t len)
|
||||
{
|
||||
-#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
+#if defined(_WIN32)
|
||||
// On Windows, the name must be at least two characters long.
|
||||
if(len < 2)
|
||||
{
|
||||
@@ -5078,9 +5041,6 @@
|
||||
static unsigned int SystemToolsManagerCount;
|
||||
SystemToolsTranslationMap *SystemTools::TranslationMap;
|
||||
SystemToolsTranslationMap *SystemTools::LongPathMap;
|
||||
-#ifdef __CYGWIN__
|
||||
-SystemToolsTranslationMap *SystemTools::Cyg2Win32Map;
|
||||
-#endif
|
||||
|
||||
// SystemToolsManager manages the SystemTools singleton.
|
||||
// SystemToolsManager should be included in any translation unit
|
||||
@@ -5126,9 +5086,6 @@
|
||||
// Allocate the translation map first.
|
||||
SystemTools::TranslationMap = new SystemToolsTranslationMap;
|
||||
SystemTools::LongPathMap = new SystemToolsTranslationMap;
|
||||
-#ifdef __CYGWIN__
|
||||
- SystemTools::Cyg2Win32Map = new SystemToolsTranslationMap;
|
||||
-#endif
|
||||
|
||||
// Add some special translation paths for unix. These are not added
|
||||
// for windows because drive letters need to be maintained. Also,
|
||||
@@ -5183,9 +5140,6 @@
|
||||
{
|
||||
delete SystemTools::TranslationMap;
|
||||
delete SystemTools::LongPathMap;
|
||||
-#ifdef __CYGWIN__
|
||||
- delete SystemTools::Cyg2Win32Map;
|
||||
-#endif
|
||||
}
|
||||
|
||||
|
||||
--- cmake-3.2.2/Source/kwsys/SystemTools.hxx.in 2015-04-13 19:09:00.000000000 +0200
|
||||
+++ cmake-3.2.2/Source/kwsys/SystemTools.hxx.in 2015-06-10 11:24:24.271286600 +0200
|
||||
@@ -298,15 +298,6 @@
|
||||
static bool FileExists(const kwsys_stl::string& filename);
|
||||
|
||||
/**
|
||||
- * Converts Cygwin path to Win32 path. Uses dictionary container for
|
||||
- * caching and calls to cygwin_conv_to_win32_path from Cygwin dll
|
||||
- * for actual translation. Returns true on success, else false.
|
||||
- */
|
||||
-#ifdef __CYGWIN__
|
||||
- static bool PathCygwinToWin32(const char *path, char *win32_path);
|
||||
-#endif
|
||||
-
|
||||
- /**
|
||||
* Return file length
|
||||
*/
|
||||
static unsigned long FileLength(const kwsys_stl::string& filename);
|
||||
@@ -942,9 +933,6 @@
|
||||
*/
|
||||
static SystemToolsTranslationMap *TranslationMap;
|
||||
static SystemToolsTranslationMap *LongPathMap;
|
||||
-#ifdef __CYGWIN__
|
||||
- static SystemToolsTranslationMap *Cyg2Win32Map;
|
||||
-#endif
|
||||
friend class SystemToolsManager;
|
||||
};
|
||||
|
||||
--- cmake-3.2.2/Modules/FindCurses.cmake 2015-04-13 19:09:00.000000000 +0200
|
||||
+++ cmake-3.2.2/Modules/FindCurses.cmake 2015-06-10 12:10:19.682030300 +0200
|
||||
@@ -60,15 +60,6 @@
|
||||
if(CURSES_NCURSES_LIBRARY AND ((NOT CURSES_CURSES_LIBRARY) OR CURSES_NEED_NCURSES))
|
||||
set(CURSES_USE_NCURSES TRUE)
|
||||
endif()
|
||||
-# http://cygwin.com/ml/cygwin-announce/2010-01/msg00002.html
|
||||
-# cygwin ncurses stopped providing curses.h symlinks see above
|
||||
-# message. Cygwin is an ncurses package, so force ncurses on
|
||||
-# cygwin if the curses.h is missing
|
||||
-if(CYGWIN)
|
||||
- if(NOT EXISTS /usr/include/curses.h)
|
||||
- set(CURSES_USE_NCURSES TRUE)
|
||||
- endif()
|
||||
-endif()
|
||||
|
||||
|
||||
# Not sure the logic is correct here.
|
@ -0,0 +1,45 @@
|
||||
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
|
||||
index 1b6bb00d4c..487114daa8 100644
|
||||
--- a/Source/CMakeLists.txt
|
||||
+++ b/Source/CMakeLists.txt
|
||||
@@ -893,7 +893,6 @@ endif()
|
||||
# On Apple we need CoreFoundation and CoreServices
|
||||
if(APPLE)
|
||||
target_link_libraries(CMakeLib "-framework CoreFoundation")
|
||||
- target_link_libraries(CMakeLib "-framework CoreServices")
|
||||
endif()
|
||||
|
||||
if(WIN32 AND NOT UNIX)
|
||||
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
|
||||
index a5ce5d18f4..3d6838ce82 100644
|
||||
--- a/Source/cmGlobalXCodeGenerator.cxx
|
||||
+++ b/Source/cmGlobalXCodeGenerator.cxx
|
||||
@@ -43,11 +43,10 @@
|
||||
|
||||
struct cmLinkImplementation;
|
||||
|
||||
#if !defined(CMAKE_BOOTSTRAP) && defined(__APPLE__)
|
||||
-# define HAVE_APPLICATION_SERVICES
|
||||
-# include <ApplicationServices/ApplicationServices.h>
|
||||
+# include <CoreFoundation/CoreFoundation.h>
|
||||
#endif
|
||||
|
||||
#if !defined(CMAKE_BOOTSTRAP)
|
||||
# include "cmXMLParser.h"
|
||||
|
||||
diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt
|
||||
index bfcaf30bb7..1da540aee5 100644
|
||||
--- a/Utilities/cmlibarchive/CMakeLists.txt
|
||||
+++ b/Utilities/cmlibarchive/CMakeLists.txt
|
||||
@@ -2007,11 +2007,6 @@ IF(ENABLE_TEST)
|
||||
ENDIF(ENABLE_TEST)
|
||||
ENDIF()
|
||||
|
||||
-# We need CoreServices on Mac OS.
|
||||
-IF(APPLE)
|
||||
- LIST(APPEND ADDITIONAL_LIBS "-framework CoreServices")
|
||||
-ENDIF(APPLE)
|
||||
-
|
||||
add_subdirectory(libarchive)
|
||||
IF(0) # CMake does not build libarchive's command-line tools.
|
||||
add_subdirectory(cat)
|
@ -0,0 +1,132 @@
|
||||
|
||||
{ stdenv, lib, fetchurl, pkg-config
|
||||
, bzip2, curl, expat, libarchive, xz, zlib, libuv, rhash
|
||||
, buildPackages
|
||||
# darwin attributes
|
||||
, ps
|
||||
, isBootstrap ? false
|
||||
, useSharedLibraries ? (!isBootstrap && !stdenv.isCygwin)
|
||||
, useOpenSSL ? !isBootstrap, openssl
|
||||
, useNcurses ? false, ncurses
|
||||
, useQt4 ? false, qt4
|
||||
, withQt5 ? false, qtbase
|
||||
, fetchFromGitHub
|
||||
}:
|
||||
|
||||
assert withQt5 -> useQt4 == false;
|
||||
assert useQt4 -> withQt5 == false;
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "cmake"
|
||||
+ lib.optionalString isBootstrap "-boot"
|
||||
+ lib.optionalString useNcurses "-cursesUI"
|
||||
+ lib.optionalString withQt5 "-qt5UI"
|
||||
+ lib.optionalString useQt4 "-qt4UI";
|
||||
version = "3.20.0-rc3";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
# https://github.com/Kitware/CMake/releases/download/v3.20.0-rc3/cmake-3.20.0-rc3.tar.gz
|
||||
owner = "Kitware";
|
||||
repo = "CMake";
|
||||
rev = "v${version}";
|
||||
sha256 = {
|
||||
"3.20.0-rc3" = "1za6kpi0bn5cfzs2s41snmms12mw3963mndwph17j3ka1cybhwd4";
|
||||
}.${version};
|
||||
};
|
||||
|
||||
patches = [
|
||||
# Don't search in non-Nix locations such as /usr, but do search in our libc.
|
||||
./search-path.patch
|
||||
];
|
||||
|
||||
outputs = [ "out" ];
|
||||
setOutputFlags = false;
|
||||
|
||||
setupHook = ./setup-hook.sh;
|
||||
|
||||
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
||||
|
||||
nativeBuildInputs = [ setupHook pkg-config ];
|
||||
|
||||
buildInputs = []
|
||||
++ lib.optionals useSharedLibraries [ bzip2 curl expat libarchive xz zlib libuv rhash ]
|
||||
++ lib.optional useOpenSSL openssl
|
||||
++ lib.optional useNcurses ncurses
|
||||
++ lib.optional useQt4 qt4
|
||||
++ lib.optional withQt5 qtbase;
|
||||
|
||||
propagatedBuildInputs = lib.optional stdenv.isDarwin ps;
|
||||
|
||||
preConfigure = ''
|
||||
fixCmakeFiles .
|
||||
substituteInPlace Modules/Platform/UnixPaths.cmake \
|
||||
--subst-var-by libc_bin ${lib.getBin stdenv.cc.libc} \
|
||||
--subst-var-by libc_dev ${lib.getDev stdenv.cc.libc} \
|
||||
--subst-var-by libc_lib ${lib.getLib stdenv.cc.libc}
|
||||
substituteInPlace Modules/FindCxxTest.cmake \
|
||||
--replace "$""{PYTHON_EXECUTABLE}" ${stdenv.shell}
|
||||
''
|
||||
# CC_FOR_BUILD and CXX_FOR_BUILD are used to bootstrap cmake
|
||||
+ ''
|
||||
configureFlags="--parallel=''${NIX_BUILD_CORES:-1} CC=$CC_FOR_BUILD CXX=$CXX_FOR_BUILD $configureFlags"
|
||||
'';
|
||||
|
||||
configureFlags = [
|
||||
"--docdir=share/doc/${pname}${version}"
|
||||
] ++ (if useSharedLibraries then [ "--no-system-jsoncpp" "--system-libs" ] else [ "--no-system-libs" ]) # FIXME: cleanup
|
||||
++ lib.optional (useQt4 || withQt5) "--qt-gui"
|
||||
# Workaround https://gitlab.kitware.com/cmake/cmake/-/issues/20568
|
||||
++ lib.optionals stdenv.hostPlatform.is32bit [
|
||||
"CFLAGS=-D_FILE_OFFSET_BITS=64"
|
||||
"CXXFLAGS=-D_FILE_OFFSET_BITS=64"
|
||||
]
|
||||
++ [
|
||||
"--"
|
||||
# We should set the proper `CMAKE_SYSTEM_NAME`.
|
||||
# http://www.cmake.org/Wiki/CMake_Cross_Compiling
|
||||
#
|
||||
# Unfortunately cmake seems to expect absolute paths for ar, ranlib, and
|
||||
# strip. Otherwise they are taken to be relative to the source root of the
|
||||
# package being built.
|
||||
"-DCMAKE_CXX_COMPILER=${stdenv.cc.targetPrefix}c++"
|
||||
"-DCMAKE_C_COMPILER=${stdenv.cc.targetPrefix}cc"
|
||||
"-DCMAKE_AR=${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar"
|
||||
"-DCMAKE_RANLIB=${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ranlib"
|
||||
"-DCMAKE_STRIP=${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}strip"
|
||||
|
||||
"-DCMAKE_USE_OPENSSL=${if useOpenSSL then "ON" else "OFF"}"
|
||||
# Avoid depending on frameworks.
|
||||
"-DBUILD_CursesDialog=${if useNcurses then "ON" else "OFF"}"
|
||||
];
|
||||
|
||||
# make install attempts to use the just-built cmake
|
||||
preInstall = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) ''
|
||||
sed -i 's|bin/cmake|${buildPackages.cmakeMinimal}/bin/cmake|g' Makefile
|
||||
'';
|
||||
|
||||
dontUseCmakeConfigure = true;
|
||||
enableParallelBuilding = true;
|
||||
|
||||
# This isn't an autoconf configure script; triples are passed via
|
||||
# CMAKE_SYSTEM_NAME, etc.
|
||||
configurePlatforms = [ ];
|
||||
|
||||
doCheck = false; # fails
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://cmake.org/";
|
||||
changelog = "https://cmake.org/cmake/help/v${lib.versions.majorMinor version}/"
|
||||
+ "release/${lib.versions.majorMinor version}.html";
|
||||
description = "Cross-Platform Makefile Generator";
|
||||
longDescription = ''
|
||||
CMake is an open-source, cross-platform family of tools designed to
|
||||
build, test and package software. CMake is used to control the software
|
||||
compilation process using simple platform and compiler independent
|
||||
configuration files, and generate native makefiles and workspaces that
|
||||
can be used in the compiler environment of your choice.
|
||||
'';
|
||||
platforms = if useQt4 then qt4.meta.platforms else platforms.all;
|
||||
maintainers = with maintainers; [ ttuegel lnl7 ];
|
||||
license = licenses.bsd3;
|
||||
};
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
diff --git a/Utilities/cmlibuv/CMakeLists.txt b/Utilities/cmlibuv/CMakeLists.txt
|
||||
index 7625cf65d9..167903e309 100644
|
||||
--- a/Utilities/cmlibuv/CMakeLists.txt
|
||||
+++ b/Utilities/cmlibuv/CMakeLists.txt
|
||||
@@ -193,6 +193,22 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
src/unix/kqueue.c
|
||||
src/unix/proctitle.c
|
||||
)
|
||||
+
|
||||
+ include(CheckIncludeFile)
|
||||
+
|
||||
+ check_include_file("ApplicationServices/ApplicationServices.h" HAVE_ApplicationServices)
|
||||
+ if (HAVE_ApplicationServices)
|
||||
+ list(APPEND uv_defines
|
||||
+ HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H=1
|
||||
+ )
|
||||
+ endif()
|
||||
+
|
||||
+ check_include_file("CoreServices/CoreServices.h" HAVE_CoreServices)
|
||||
+ if (HAVE_CoreServices)
|
||||
+ list(APPEND uv_defines
|
||||
+ HAVE_CORESERVICES_CORESERVICES_H=1
|
||||
+ )
|
||||
+ endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
diff --git a/Utilities/cmlibuv/src/unix/fsevents.c b/Utilities/cmlibuv/src/unix/fsevents.c
|
||||
index a51f29b3f6..3f6bf01968 100644
|
||||
--- a/Utilities/cmlibuv/src/unix/fsevents.c
|
||||
+++ b/Utilities/cmlibuv/src/unix/fsevents.c
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "uv.h"
|
||||
#include "internal.h"
|
||||
|
||||
-#if TARGET_OS_IPHONE || MAC_OS_X_VERSION_MAX_ALLOWED < 1070
|
||||
+#if !HAVE_CORESERVICES_CORESERVICES_H || MAC_OS_X_VERSION_MAX_ALLOWED < 1070
|
||||
|
||||
/* iOS (currently) doesn't provide the FSEvents-API (nor CoreServices) */
|
||||
/* macOS prior to 10.7 doesn't provide the full FSEvents API so use kqueue */
|
||||
@@ -39,7 +39,7 @@ int uv__fsevents_close(uv_fs_event_t* handle) {
|
||||
void uv__fsevents_loop_delete(uv_loop_t* loop) {
|
||||
}
|
||||
|
||||
-#else /* TARGET_OS_IPHONE */
|
||||
+#else /* !HAVE_CORESERVICES_CORESERVICES_H */
|
||||
|
||||
#include "darwin-stub.h"
|
||||
|
||||
@@ -920,4 +920,4 @@ int uv__fsevents_close(uv_fs_event_t* handle) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
-#endif /* TARGET_OS_IPHONE */
|
||||
+#endif /* !HAVE_CORESERVICES_CORESERVICES_H */
|
@ -0,0 +1,92 @@
|
||||
diff -ru3 cmake-2.8.12.2/Modules/Platform/Linux.cmake cmake-2.8.12.2-new/Modules/Platform/Linux.cmake
|
||||
--- cmake-2.8.12.2/Modules/Platform/Linux.cmake 2014-01-16 21:15:08.000000000 +0400
|
||||
+++ cmake-2.8.12.2-new/Modules/Platform/Linux.cmake 2016-04-13 22:00:32.928575740 +0300
|
||||
@@ -36,22 +36,11 @@
|
||||
# checking the platform every time. This option is advanced enough
|
||||
# that only package maintainers should need to adjust it. They are
|
||||
# capable of providing a setting on the command line.
|
||||
- if(EXISTS "/etc/debian_version")
|
||||
- set(CMAKE_INSTALL_SO_NO_EXE 1 CACHE INTERNAL
|
||||
- "Install .so files without execute permission.")
|
||||
- else()
|
||||
- set(CMAKE_INSTALL_SO_NO_EXE 0 CACHE INTERNAL
|
||||
- "Install .so files without execute permission.")
|
||||
- endif()
|
||||
+ set(CMAKE_INSTALL_SO_NO_EXE 0 CACHE INTERNAL
|
||||
+ "Install .so files without execute permission.")
|
||||
endif()
|
||||
|
||||
# Match multiarch library directory names.
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-linux-gnu[a-z0-9_]*")
|
||||
|
||||
include(Platform/UnixPaths)
|
||||
-
|
||||
-# Debian has lib64 paths only for compatibility so they should not be
|
||||
-# searched.
|
||||
-if(EXISTS "/etc/debian_version")
|
||||
- set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE)
|
||||
-endif()
|
||||
diff -ru3 cmake-2.8.12.2/Modules/Platform/UnixPaths.cmake cmake-2.8.12.2-new/Modules/Platform/UnixPaths.cmake
|
||||
--- cmake-2.8.12.2/Modules/Platform/UnixPaths.cmake 2014-01-16 21:15:08.000000000 +0400
|
||||
+++ cmake-2.8.12.2-new/Modules/Platform/UnixPaths.cmake 2016-04-14 00:09:10.106362636 +0300
|
||||
@@ -32,9 +32,6 @@
|
||||
# List common installation prefixes. These will be used for all
|
||||
# search types.
|
||||
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
|
||||
- # Standard
|
||||
- /usr/local /usr /
|
||||
-
|
||||
# CMake install location
|
||||
"${_CMAKE_INSTALL_DIR}"
|
||||
|
||||
@@ -44,44 +41,26 @@
|
||||
|
||||
# List common include file locations not under the common prefixes.
|
||||
list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
|
||||
- # Windows API on Cygwin
|
||||
- /usr/include/w32api
|
||||
-
|
||||
- # X11
|
||||
- /usr/X11R6/include /usr/include/X11
|
||||
-
|
||||
- # Other
|
||||
- /usr/pkg/include
|
||||
- /opt/csw/include /opt/include
|
||||
- /usr/openwin/include
|
||||
+ @libc_dev@/include
|
||||
)
|
||||
|
||||
list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
|
||||
- # Windows API on Cygwin
|
||||
- /usr/lib/w32api
|
||||
-
|
||||
- # X11
|
||||
- /usr/X11R6/lib /usr/lib/X11
|
||||
-
|
||||
- # Other
|
||||
- /usr/pkg/lib
|
||||
- /opt/csw/lib /opt/lib
|
||||
- /usr/openwin/lib
|
||||
+ @libc_lib@/lib
|
||||
)
|
||||
|
||||
list(APPEND CMAKE_SYSTEM_PROGRAM_PATH
|
||||
- /usr/pkg/bin
|
||||
+ @libc_bin@/bin
|
||||
)
|
||||
|
||||
list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
|
||||
- /lib /usr/lib /usr/lib32 /usr/lib64
|
||||
+ @libc_lib@/lib
|
||||
)
|
||||
|
||||
list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES
|
||||
- /usr/include
|
||||
+ @libc_dev@/include
|
||||
)
|
||||
list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES
|
||||
- /usr/include
|
||||
+ @libc_dev@/include
|
||||
)
|
||||
|
||||
# Enable use of lib64 search path variants by default.
|
@ -0,0 +1,74 @@
|
||||
diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake
|
||||
index b9381c3d7d..cecc40a89e 100644
|
||||
--- a/Modules/Platform/UnixPaths.cmake
|
||||
+++ b/Modules/Platform/UnixPaths.cmake
|
||||
@@ -26,9 +26,6 @@ get_filename_component(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH)
|
||||
# please make sure to keep Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst
|
||||
# synchronized
|
||||
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
|
||||
- # Standard
|
||||
- /usr/local /usr /
|
||||
-
|
||||
# CMake install location
|
||||
"${_CMAKE_INSTALL_DIR}"
|
||||
)
|
||||
@@ -47,24 +44,19 @@ endif()
|
||||
|
||||
# Non "standard" but common install prefixes
|
||||
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
|
||||
- /usr/X11R6
|
||||
- /usr/pkg
|
||||
- /opt
|
||||
)
|
||||
|
||||
# List common include file locations not under the common prefixes.
|
||||
list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
|
||||
- # X11
|
||||
- /usr/include/X11
|
||||
+ @libc_dev@/include
|
||||
)
|
||||
|
||||
list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
|
||||
- # X11
|
||||
- /usr/lib/X11
|
||||
+ @libc_lib@/lib
|
||||
)
|
||||
|
||||
list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
|
||||
- /lib /lib32 /lib64 /usr/lib /usr/lib32 /usr/lib64
|
||||
+ @libc_lib@/lib
|
||||
)
|
||||
|
||||
if(CMAKE_SYSROOT_COMPILE)
|
||||
@@ -77,15 +69,15 @@ endif()
|
||||
# parsing the implicit directory information from compiler output.
|
||||
set(_CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES_INIT
|
||||
${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}
|
||||
- "${_cmake_sysroot_compile}/usr/include"
|
||||
+ @libc_dev@/include
|
||||
)
|
||||
set(_CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES_INIT
|
||||
${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}
|
||||
- "${_cmake_sysroot_compile}/usr/include"
|
||||
+ @libc_dev@/include
|
||||
)
|
||||
set(_CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES_INIT
|
||||
${CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES}
|
||||
- "${_cmake_sysroot_compile}/usr/include"
|
||||
+ @libc_dev@/include
|
||||
)
|
||||
|
||||
unset(_cmake_sysroot_compile)
|
||||
diff --git a/Modules/Platform/WindowsPaths.cmake b/Modules/Platform/WindowsPaths.cmake
|
||||
index b9e2f17979..ab517cd4a7 100644
|
||||
--- a/Modules/Platform/WindowsPaths.cmake
|
||||
+++ b/Modules/Platform/WindowsPaths.cmake
|
||||
@@ -70,7 +70,7 @@ endif()
|
||||
|
||||
if(CMAKE_CROSSCOMPILING AND NOT CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
|
||||
# MinGW (useful when cross compiling from linux with CMAKE_FIND_ROOT_PATH set)
|
||||
- list(APPEND CMAKE_SYSTEM_PREFIX_PATH /)
|
||||
+ # list(APPEND CMAKE_SYSTEM_PREFIX_PATH /)
|
||||
endif()
|
||||
|
||||
list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
|
@ -1,86 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2019, The Wownero Project
|
||||
# Copyright (c) 2014-2019, The Monero Project
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are
|
||||
# permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other
|
||||
# materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software without specific
|
||||
# prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
set -e
|
||||
|
||||
source etc/scripts/build-external-libs/env.sh
|
||||
|
||||
build_root=$BUILD_ROOT
|
||||
src_root=$BUILD_ROOT_SRC
|
||||
|
||||
version=1.16
|
||||
name=libiconv
|
||||
|
||||
cd $src_root/${name}-${version}
|
||||
|
||||
archs=(arm64)
|
||||
for arch in ${archs[@]}; do
|
||||
extra_cmake_flags=""
|
||||
case ${arch} in
|
||||
"arm64")
|
||||
target_host=aarch64-linux-android
|
||||
;;
|
||||
"x86_64")
|
||||
target_host=x86_64-linux-android
|
||||
;;
|
||||
*)
|
||||
exit 16
|
||||
;;
|
||||
esac
|
||||
|
||||
# PREFIX=$build_root/build/${name}/$arch
|
||||
PREFIX=$build_root/build/$arch
|
||||
echo "building for ${arch}"
|
||||
|
||||
(
|
||||
PATH=$build_root/tool/$arch/$target_host/bin:$build_root/tool/$arch/bin:$PATH
|
||||
if [ -x "$(command -v ccache)" ]; then
|
||||
echo "////////////////////////////////////////////"
|
||||
echo "// CCACHE 1 //"
|
||||
echo "////////////////////////////////////////////"
|
||||
CC="ccache clang"
|
||||
CXX="ccache clang++"
|
||||
else
|
||||
CC=clang
|
||||
CXX=clang++
|
||||
fi
|
||||
|
||||
./configure \
|
||||
--prefix=${PREFIX} \
|
||||
--build=x86_64-linux-gnu \
|
||||
--host=${target_host} \
|
||||
--disable-rpath \
|
||||
&& make -j${NPROC} && make install && make clean \
|
||||
)
|
||||
|
||||
done
|
||||
|
||||
exit 0
|
@ -1,49 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2019, The Wownero Project
|
||||
# Copyright (c) 2014-2019, The Monero Project
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are
|
||||
# permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other
|
||||
# materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software without specific
|
||||
# prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
set -e
|
||||
|
||||
source etc/scripts/build-external-libs/env.sh
|
||||
|
||||
build_root=$BUILD_ROOT_WOW
|
||||
PATH=$ANDROID_NDK_ROOT_WOW/build/tools/:$PATH
|
||||
|
||||
args="--api 23 --stl=libc++"
|
||||
archs=(arm64)
|
||||
|
||||
for arch in ${archs[@]}; do
|
||||
|
||||
if [ ! -d "$build_root/tool/$arch" ]; then
|
||||
echo "installing $arch"
|
||||
make_standalone_toolchain.py $args --arch $arch --install-dir $build_root/tool/$arch
|
||||
fi
|
||||
|
||||
done
|
@ -1,86 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2019-2020, The Wownero Project
|
||||
# Copyright (c) 2014-2019, The Monero Project
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are
|
||||
# permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other
|
||||
# materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software without specific
|
||||
# prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
set -e
|
||||
|
||||
source etc/scripts/build-external-libs/env.sh
|
||||
|
||||
cd $BUILD_ROOT_SRC
|
||||
|
||||
name=wownero
|
||||
version=v0.8.0.0
|
||||
# version=dev-v0.8
|
||||
githash=1271a7e3a97c0d81816b401627aefb6c6697d0b3
|
||||
out=wownero
|
||||
|
||||
chmod u+w -f -R $out || true
|
||||
|
||||
rm -rf $out
|
||||
|
||||
if [ ! -z $SRC_WOWNERO_DIR ]; then
|
||||
echo "using pre-fetched $name"
|
||||
rsync -av --no-perms --no-owner --no-group --delete $SRC_WOWNERO_DIR/* $out
|
||||
chmod u+w -R $out/external
|
||||
cd $name
|
||||
else
|
||||
git clone --depth 1 https://github.com/wownero/wownero.git -b $version
|
||||
cd $name
|
||||
test `git rev-parse HEAD` = $githash || exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -z $SRC_MINIUPNP_DIR ]; then
|
||||
echo "using pre-fetched miniupnpc"
|
||||
rsync -av --no-perms --no-owner --no-group --delete $SRC_MINIUPNP_DIR/* external/miniupnp
|
||||
else
|
||||
git submodule update --init external/miniupnp
|
||||
fi
|
||||
|
||||
if [ ! -z $SRC_RAPIDJSON_DIR ]; then
|
||||
echo "using pre-fetched rapidjson"
|
||||
rsync -av --no-perms --no-owner --no-group --delete $SRC_RAPIDJSON_DIR/* external/rapidjson
|
||||
else
|
||||
git submodule update --init external/rapidjson
|
||||
fi
|
||||
|
||||
if [ ! -z $SRC_RANDOMWOW ]; then
|
||||
echo "using pre-fetched RandomWOW"
|
||||
tar xzf $SRC_RANDOMWOW -C external/RandomWOW --strip-components=1
|
||||
else
|
||||
git submodule update --init external/RandomWOW
|
||||
fi
|
||||
|
||||
if [ ! -z $SRC_UNBOUND_DIR ]; then
|
||||
echo "using pre-fetched unbound"
|
||||
rsync -av --no-perms --no-owner --no-group --delete $SRC_UNBOUND_DIR/* external/unbound
|
||||
else
|
||||
git submodule update --init external/unbound
|
||||
fi
|
@ -1,5 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.wownero.cyberwow">
|
||||
package="org.lolnero.node">
|
||||
<!-- Flutter needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
@ -1,9 +1,9 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.wownero.cyberwow">
|
||||
package="org.lolnero.node">
|
||||
|
||||
<application
|
||||
android:name="io.flutter.app.FlutterApplication"
|
||||
android:label="CyberWOW"
|
||||
android:label="L node"
|
||||
android:icon="@drawable/icon">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
@ -1,4 +1,4 @@
|
||||
package org.wownero.cyberwow
|
||||
package org.lolnero.node
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 544 B |
Before Width: | Height: | Size: 442 B After Width: | Height: | Size: 442 B |
Before Width: | Height: | Size: 721 B After Width: | Height: | Size: 721 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@ -1,5 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.wownero.cyberwow">
|
||||
package="org.lolnero.node">
|
||||
<!-- Flutter needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 22 KiB |
@ -0,0 +1,117 @@
|
||||
/*
|
||||
|
||||
Copyright 2019 fuwa
|
||||
|
||||
This file is part of CyberWOW.
|
||||
|
||||
CyberWOW 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
CyberWOW 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 CyberWOW. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:async/async.dart';
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:core';
|
||||
import 'dart:convert';
|
||||
import 'dart:collection';
|
||||
|
||||
import '../config.dart' as config;
|
||||
import '../helper.dart';
|
||||
import '../logic/controller/process/run.dart' as process;
|
||||
import '../logging.dart';
|
||||
|
||||
import 'prototype.dart';
|
||||
import 'syncing.dart';
|
||||
|
||||
class LoadingState extends AppStateAutomata {
|
||||
String status = '';
|
||||
|
||||
LoadingState(appHook) : super(appHook);
|
||||
|
||||
void append(final String msg) {
|
||||
this.status += msg;
|
||||
syncState();
|
||||
}
|
||||
|
||||
Future<SyncingState> next() async {
|
||||
Future<void> showBanner() async {
|
||||
final Iterable<String> chars =
|
||||
config.c.splash.runes.map((x) => String.fromCharCode(x));
|
||||
|
||||
for (final String char in chars) {
|
||||
append(char);
|
||||
final int _delay = config.c.splashDelay;
|
||||
await Future.delayed(Duration(milliseconds: _delay));
|
||||
}
|
||||
|
||||
await tick();
|
||||
await tick();
|
||||
}
|
||||
|
||||
SharedPreferences _prefs = await SharedPreferences.getInstance();
|
||||
final _bannerShown = _prefs.getBool(config.bannerShownKey);
|
||||
|
||||
if (_bannerShown == null) {
|
||||
await showBanner();
|
||||
await _prefs.setBool(config.bannerShownKey, true);
|
||||
}
|
||||
|
||||
final _initialIntent = await appHook.getInitialIntent();
|
||||
final _userArgs = _initialIntent
|
||||
.trim()
|
||||
.split(RegExp(r"\s+"))
|
||||
.where((x) => x.isNotEmpty)
|
||||
.toList();
|
||||
|
||||
if (_userArgs.isNotEmpty) {
|
||||
log.info('user args: $_userArgs');
|
||||
}
|
||||
|
||||
final _process = await process.runBinary(
|
||||
config.c.outputBin,
|
||||
userArgs: _userArgs,
|
||||
);
|
||||
|
||||
log.fine('process created');
|
||||
|
||||
final _stdout = StreamGroup.merge([_process.stdout, _process.stderr]
|
||||
.map((x) => x.transform(utf8.decoder).transform(LineSplitter())))
|
||||
.asBroadcastStream();
|
||||
|
||||
final _stdoutQueue = Queue();
|
||||
|
||||
AppHook _appHook = AppHook(
|
||||
appHook.setState,
|
||||
appHook.getNotification,
|
||||
appHook.isExiting,
|
||||
appHook.getInitialIntent,
|
||||
_process,
|
||||
_stdoutQueue,
|
||||
);
|
||||
|
||||
_stdout.listen((x) {
|
||||
log.fine(x);
|
||||
_stdoutQueue.addLast(x);
|
||||
while (_stdoutQueue.length > config.logLines) {
|
||||
_stdoutQueue.removeFirst();
|
||||
}
|
||||
_appHook.stdoutCache = _stdoutQueue.join('\n');
|
||||
});
|
||||
|
||||
_process.exitCode.whenComplete(() => _appHook.processCompleted = true);
|
||||
|
||||
return SyncingState(_appHook);
|
||||
}
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
/*
|
||||
|
||||
Copyright 2019 fuwa
|
||||
|
||||
This file is part of CyberWOW.
|
||||
|
||||
CyberWOW 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
CyberWOW 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 CyberWOW. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'dart:collection';
|
||||
import 'dart:io';
|
||||
|
||||
import '../config.dart' as config;
|
||||
|
||||
import 'exiting.dart';
|
||||
|
||||
typedef SetStateFunc = void Function(AppState);
|
||||
typedef GetNotificationFunc = AppLifecycleState Function();
|
||||
typedef IsExitingFunc = bool Function();
|
||||
typedef GetInitialIntentFunc = Future<String> Function();
|
||||
|
||||
class AppHook {
|
||||
final SetStateFunc setState;
|
||||
final GetNotificationFunc getNotification;
|
||||
final IsExitingFunc isExiting;
|
||||
final GetInitialIntentFunc getInitialIntent;
|
||||
|
||||
final Process? process;
|
||||
final Queue stdout;
|
||||
String stdoutCache;
|
||||
bool processCompleted;
|
||||
|
||||
AppHook(
|
||||
this.setState,
|
||||
this.getNotification,
|
||||
this.isExiting,
|
||||
this.getInitialIntent,
|
||||
this.process,
|
||||
this.stdout, {
|
||||
this.stdoutCache = '',
|
||||
this.processCompleted = false,
|
||||
});
|
||||
}
|
||||
|
||||
class AppState {
|
||||
final AppHook appHook;
|
||||
int skipped = 0;
|
||||
AppState(this.appHook);
|
||||
|
||||
Future<bool> shouldExit() async {
|
||||
final _isExiting = appHook.isExiting();
|
||||
if (_isExiting) return true;
|
||||
|
||||
if (appHook.process != null && appHook.processCompleted) {
|
||||
final _exitCode = await appHook.process?.exitCode;
|
||||
return _exitCode != 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
ExitingState exitState() => ExitingState(appHook);
|
||||
|
||||
bool isActive() {
|
||||
final _appState = appHook.getNotification();
|
||||
return _appState == AppLifecycleState.resumed;
|
||||
}
|
||||
|
||||
bool shouldPop() => true;
|
||||
|
||||
bool shouldSkip() {
|
||||
if (!isActive()) {
|
||||
if (skipped < config.forcedUpdateInSeconds) {
|
||||
skipped++;
|
||||
return true;
|
||||
} else {
|
||||
skipped = 0;
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
skipped = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void syncState() {
|
||||
appHook.setState(this);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AppStateAutomata extends AppState {
|
||||
AppStateAutomata(appHook) : super(appHook);
|
||||
Future<AppStateAutomata> next();
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
|
||||
Copyright 2019 fuwa
|
||||
|
||||
This file is part of CyberWOW.
|
||||
|
||||
CyberWOW 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
CyberWOW 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 CyberWOW. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import '../logic/sensor/rpc/rpc.dart' as rpc;
|
||||
import '../logic/sensor/daemon.dart' as daemon;
|
||||
import '../logging.dart';
|
||||
import '../helper.dart';
|
||||
|
||||
import 'prototype.dart';
|
||||
import 'synced.dart';
|
||||
|
||||
class ReSyncingState extends AppStateAutomata {
|
||||
final int pageIndex;
|
||||
bool synced = false;
|
||||
|
||||
ReSyncingState(appHook, this.pageIndex) : super(appHook);
|
||||
|
||||
Future<AppStateAutomata> next() async {
|
||||
log.fine("ReSyncing next");
|
||||
if (await shouldExit()) return exitState();
|
||||
|
||||
if (shouldSkip()) {
|
||||
log.finest('skipping state update');
|
||||
await tick();
|
||||
return this;
|
||||
}
|
||||
|
||||
if (await daemon.isSynced()) {
|
||||
final int _height = await rpc.height();
|
||||
return SyncedState(appHook, _height, pageIndex);
|
||||
} else {
|
||||
await tick();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,134 @@
|
||||
/*
|
||||
|
||||
Copyright 2019 fuwa
|
||||
|
||||
This file is part of CyberWOW.
|
||||
|
||||
CyberWOW 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
CyberWOW 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 CyberWOW. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../config.dart' as config;
|
||||
import '../logic/sensor/daemon.dart' as daemon;
|
||||
import '../logic/sensor/rpc/rpc.dart' as rpc;
|
||||
import '../logic/sensor/rpc/rpc2.dart' as rpc;
|
||||
import '../logic/view/rpc/rpc2.dart' as rpc2View;
|
||||
import '../logic/view/rpc/rpc.dart' as rpcView;
|
||||
import '../helper.dart';
|
||||
import '../logging.dart';
|
||||
|
||||
import 'prototype.dart';
|
||||
import 'resyncing.dart';
|
||||
|
||||
class SyncedState extends AppStateAutomata {
|
||||
final TextEditingController textController = TextEditingController();
|
||||
|
||||
bool synced = true;
|
||||
bool userExit = false;
|
||||
bool connected = true;
|
||||
|
||||
Map<String, dynamic> getInfo = {};
|
||||
List<Map<String, dynamic>> getConnections = [];
|
||||
List<Map<String, dynamic>> getTransactionPool = [];
|
||||
|
||||
int height;
|
||||
int pageIndex;
|
||||
PageController? pageController;
|
||||
|
||||
String getInfoCache = '';
|
||||
String getConnectionsCache = '';
|
||||
String getTransactionPoolCache = '';
|
||||
|
||||
SyncedState(appHook, this.height, this.pageIndex) : super(appHook) {
|
||||
pageController = PageController(initialPage: pageIndex);
|
||||
// textController.addListener(this.appendInput);
|
||||
}
|
||||
|
||||
void appendInput(final String x) {
|
||||
final _input = config.c.promptString + x;
|
||||
log.fine(_input);
|
||||
final _stdoutQueue = appHook.stdout;
|
||||
_stdoutQueue.addLast('\n' + _input);
|
||||
while (_stdoutQueue.length > config.logLines) {
|
||||
_stdoutQueue.removeFirst();
|
||||
}
|
||||
appHook.stdoutCache = _stdoutQueue.join();
|
||||
|
||||
// ignore: close_sinks
|
||||
final IOSink? _stdin = appHook.process?.stdin;
|
||||
|
||||
_stdin?.writeln(x);
|
||||
_stdin?.flush();
|
||||
|
||||
syncState();
|
||||
|
||||
if (x == 'exit') {
|
||||
userExit = true;
|
||||
}
|
||||
}
|
||||
|
||||
void onPageChanged(int value) {
|
||||
this.pageIndex = value;
|
||||
}
|
||||
|
||||
Future<AppStateAutomata> next() async {
|
||||
log.fine("Synced next");
|
||||
if (userExit) {
|
||||
return exitState();
|
||||
}
|
||||
if (await shouldExit()) {
|
||||
return exitState();
|
||||
}
|
||||
|
||||
if (shouldSkip()) {
|
||||
log.finest('skipping state update');
|
||||
await tick();
|
||||
return this;
|
||||
}
|
||||
|
||||
if (await daemon.isNotSynced()) {
|
||||
return ReSyncingState(appHook, pageIndex);
|
||||
}
|
||||
|
||||
await tick();
|
||||
// log.finer('SyncedState: checkSync loop');
|
||||
height = await rpc.height();
|
||||
connected = await daemon.isConnected();
|
||||
getInfo = await rpc.getInfoSimple();
|
||||
final _getInfoView = cleanKey(rpcView.getInfoView(getInfo));
|
||||
getInfoCache = pretty(_getInfoView);
|
||||
|
||||
getConnections = await rpc.getConnectionsSimple();
|
||||
final List<Map<String, dynamic>> _getConnectionsView = getConnections
|
||||
.map(rpcView.getConnectionView)
|
||||
.map((x) => rpcView.simpleHeight(height, x))
|
||||
.map(cleanKey)
|
||||
.toList();
|
||||
getConnectionsCache = pretty(_getConnectionsView);
|
||||
|
||||
getTransactionPool = await rpc.getTransactionPoolSimple();
|
||||
final List<Map<String, dynamic>> _getTransactionPoolView =
|
||||
getTransactionPool.map(rpc2View.txView).map(cleanKey).toList();
|
||||
getTransactionPoolCache = pretty(_getTransactionPoolView);
|
||||
|
||||
log.fine('synced: loop exit');
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 41 KiB |