summaryrefslogtreecommitdiffstats
path: root/HACKING.md
blob: 6375450c24134da541f83dbc45e2bd50f04a5439 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
MODIFYING OPENSSL SOURCE
========================

This document describes the way to add custom modifications to OpenSSL sources.

 If you are adding new public functions to the custom library build, you need to
 either add a prototype in one of the existing OpenSSL header files;
 or provide a new header file and edit
 [Configurations/unix-Makefile.tmpl](Configurations/unix-Makefile.tmpl)
 to pick up that file.

 After that perform the following steps:

    ./Configure -Werror --strict-warnings [your-options]
    make update
    make
    make test

 `make update` ensures that your functions declarations are added to
 `util/libcrypto.num` or `util/libssl.num`.
 If you plan to submit the changes you made to OpenSSL
 (see [CONTRIBUTING.md](CONTRIBUTING.md)), it's worth running:

    make doc-nits

 after running `make update` to ensure that documentation has correct format.

 `make update` also generates files related to OIDs (in the `crypto/objects/`
 folder) and errors.
 If a merge error occurs in one of these generated files then the
 generated files need to be removed and regenerated using `make update`.
 To aid in this process the generated files can be committed separately
 so they can be removed easily.
class="p">; extern crate failure_tools; extern crate structopt; use crate::interactive::{Interaction, TerminalApp}; use dua::{ByteFormat, Color, TraversalSorting}; use failure::{Error, ResultExt}; use failure_tools::ok_or_exit; use std::{fs, io, io::Write, path::PathBuf, process}; use structopt::StructOpt; use termion::{raw::IntoRawMode, screen::AlternateScreen}; use tui::backend::TermionBackend; use tui_react::Terminal; mod interactive; mod options; fn run() -> Result<(), Error> { use options::Command::*; let opt: options::Args = options::Args::from_args(); let walk_options = dua::WalkOptions { threads: opt.threads.unwrap_or(0), byte_format: opt.format.map(Into::into).unwrap_or(ByteFormat::Metric), color: if atty::is(atty::Stream::Stdout) { Color::Terminal } else { Color::None }, apparent_size: opt.apparent_size, count_hard_links: opt.count_hard_links, sorting: TraversalSorting::None, cross_filesystems: !opt.stay_on_filesystem, }; let res = match opt.command { Some(Interactive { input }) => { let mut terminal = { let stdout = io::stdout() .into_raw_mode() .with_context(|_| "Interactive mode requires a connected terminal")?; let stdout = AlternateScreen::from(stdout); let backend = TermionBackend::new(stdout); Terminal::new(backend)? }; let res = TerminalApp::initialize( &mut terminal, walk_options, paths_from(input)?, Interaction::Full, )? .map(|(keys_rx, mut app)| app.process_events(&mut terminal, keys_rx.into_iter())); drop(terminal); io::stdout().flush().ok(); // Exit 'quickly' to avoid having to wait for all memory to be freed by us. // Let the OS do it - we have nothing to lose, literally. std::process::exit(res.transpose()?.map(|e| e.to_exit_code()).unwrap_or(0)); } Some(Aggregate { input, no_total, no_sort, statistics, }) => { let stdout = io::stdout(); let stdout_locked = stdout.lock(); let (res, stats) = dua::aggregate( stdout_locked, walk_options, !no_total, !no_sort, paths_from(input)?, )?; if statistics { writeln!(io::stderr(), "{:?}", stats).ok(); } res } None => { let stdout = io::stdout(); let stdout_locked = stdout.lock(); dua::aggregate( stdout_locked, walk_options, true, true, paths_from(opt.input)?, )? .0 } }; process::exit(res.to_exit_code()); } fn paths_from(paths: Vec<PathBuf>) -> Result<Vec<PathBuf>, io::Error> { if paths.is_empty() { cwd_dirlist() } else { Ok(paths) } } fn cwd_dirlist() -> Result<Vec<PathBuf>, io::Error> { let mut v: Vec<_> = fs::read_dir(".")? .filter_map(|e| { e.ok() .and_then(|e| e.path().strip_prefix(".").ok().map(ToOwned::to_owned)) }) .filter(|p| { if let Ok(meta) = p.symlink_metadata() { if meta.file_type().is_symlink() { return false; } }; true }) .collect(); v.sort(); Ok(v) } fn main() { ok_or_exit(run()) }